rem: tm_tags, TOTAG_LEN,
add: tm_tags, TOTAG_VALUE_LEN,
context: static int _reply( struct cell *trans, struct sip_msg* p_msg, 	unsigned int code, char * text, int lock ){#ifndef VOICE_MAIL	unsigned int len, buf_len=0;	char * buf;	struct retr_buf *rb;	branch_bm_t cancel_bitmap;#else	unsigned int len;	char * buf;#endif	if (code>=200) trans->kr|=REQ_RPLD;	/*	buf = build_res_buf_from_sip_req(code,text,trans->uas.tag->s,		trans->uas.tag->len, trans->uas.request,&len);	*/#ifndef VOICE_MAIL	cancel_bitmap=0;#endif	/* compute the buffer in private memory prior to entering lock;	 * create to-tag if needed */	if (code>=180 && p_msg->to 			&& (get_to(p_msg)->tag_value.s==0 			    || get_to(p_msg)->tag_value.len==0)) {		calc_crc_suffix( p_msg, tm_tag_suffix );		buf = build_res_buf_from_sip_req(code,text, 				tm_tags, TOTAG_LEN, 				p_msg,&len);#ifdef VOICE_MAIL		return _reply_light(trans,buf,len,code,text,				    tm_tags, TOTAG_LEN,				    lock);#endif	} else {		buf = build_res_buf_from_sip_req(code,text, 0,0, /* no to-tag */			p_msg,&len);#ifdef VOICE_MAIL		return _reply_light(trans,buf,len,code,text,				    0,0, /* no to-tag */				    lock);#endif	}	DBG("DEBUG: t_reply: buffer computed\n");#ifdef VOICE_MAIL}static int _reply_light( struct cell *trans, char* buf, unsigned int len,			 unsigned int code, char * text, 			 char *to_tag, unsigned int to_tag_len, int lock ){	struct retr_buf *rb;	unsigned int buf_len=0;	branch_bm_t cancel_bitmap=0;#endif	if (!buf)	{		DBG("DEBUG: t_reply: response building failed\n");		/* determine if there are some branches to be cancelled */		if (trans->is_invite) {			if (lock) LOCK_REPLIES( trans );			which_cancel(trans, &cancel_bitmap );			if (lock) UNLOCK_REPLIES( trans );		}		/* and clean-up, including cancellations, if needed */		goto error;	}	if (lock) LOCK_REPLIES( trans );	if (trans->is_invite) which_cancel(trans, &cancel_bitmap );	if (trans->uas.status>=200) {		LOG( L_ERR, "ERROR: t_reply: can't generate %d reply"			" when a final %d was sent out\n", code, trans->uas.status);		goto error2;	}	rb = & trans->uas.response;	rb->activ_type=code;	trans->uas.status = code;	buf_len = rb->buffer ? len : len + REPLY_OVERBUFFER_LEN;	rb->buffer = (char*)shm_resize( rb->buffer, buf_len );	/* puts the reply's buffer to uas.response */	if (! rb->buffer ) {			LOG(L_ERR, "ERROR: t_reply: cannot allocate shmem buffer\n");			goto error2;	}	rb->buffer_len = len ;	memcpy( rb->buffer , buf , len );#ifdef VOICE_MAIL	if(to_tag){	    trans->uas.to_tag.s = (char*)shm_resize( trans->uas.to_tag.s, to_tag_len );	    if(! trans->uas.to_tag.s ){			LOG(L_ERR, "ERROR: t_reply: cannot allocate shmem buffer\n");			// Is it ok? or should i free rb->buffer also, 			// or will it be freed in free_cell() ?			goto error2; 	    }	    trans->uas.to_tag.len = to_tag_len;	    memcpy( trans->uas.to_tag.s, to_tag, to_tag_len );	}#endif	/* needs to be protected too because what timers are set depends	   on current transactions status */	/* t_update_timers_after_sending_reply( rb ); */	update_reply_stats( code );	tm_stats->replied_localy++;	if (lock) UNLOCK_REPLIES( trans );		/* do UAC cleanup procedures in case we generated	   a final answer whereas there are pending UACs */	if (code>=200) {		if (trans->local) {			DBG("DEBUG: local transaction completed from _reply\n");			callback_event( TMCB_LOCAL_COMPLETED, trans, FAKED_REPLY, code );			if (trans->completion_cb) 				trans->completion_cb( trans, FAKED_REPLY, code, 0 /* empty param */);		} else {			callback_event( TMCB_REPLY, trans, FAKED_REPLY, code );		}		cleanup_uac_timers( trans );		if (trans->is_invite) cancel_uacs( trans, cancel_bitmap );		set_final_timer(  trans );	}	/* send it out */	/* first check if we managed to resolve topmost Via -- if	   not yet, don't try to retransmit	*/	if (!trans->uas.response.send_sock) {		LOG(L_ERR, "ERROR: _reply: no resolved dst to send reply to\n");	} else {		SEND_PR_BUFFER( rb, buf, len );		DBG("DEBUG: reply sent out. buf=%p: %.9s..., shmem=%p: %.9s\n", 			buf, buf, rb->buffer, rb->buffer );	}	pkg_free( buf ) ;	DBG("DEBUG: t_reply: finished\n");	return 1;error2:	if (lock) UNLOCK_REPLIES( trans );	pkg_free ( buf );error:	/* do UAC cleanup */	cleanup_uac_timers( trans );	if (trans->is_invite) cancel_uacs( trans, cancel_bitmap );	/* we did not succeed -- put the transaction on wait */	put_on_wait(trans);	return -1;}