rem: if (req || req->msg_flags&(FL_USE_UAC_FROM|FL_USE_UAC_TO|FL_USE_UAC_CSEQ)) {
add: if (req && req->msg_flags&(FL_USE_UAC_FROM|FL_USE_UAC_TO|FL_USE_UAC_CSEQ)) {
context: char *build_local(struct cell *Trans,unsigned int branch,	unsigned int *len, char *method, int method_len, str *uas_to){	char                *cancel_buf, *p, *via;	unsigned int         via_len;	struct hdr_field    *hdr;	struct sip_msg      *req;	char branch_buf[MAX_BRANCH_PARAM_LEN];	str branch_str;	struct hostport hp;	str from;	str to;	str cseq_n;	req = Trans->uas.request;	from = Trans->from;	cseq_n = Trans->cseq_n;	to = *uas_to;	if (req || req->msg_flags&(FL_USE_UAC_FROM|FL_USE_UAC_TO|FL_USE_UAC_CSEQ)) {		if ( extract_hdrs( Trans->uac[branch].request.buffer,		Trans->uac[branch].request.buffer_len,		(req->msg_flags&FL_USE_UAC_FROM)?&from:0 ,		(req->msg_flags&FL_USE_UAC_TO)?&to:0 ,		(req->msg_flags&FL_USE_UAC_CSEQ)?&cseq_n:0 )!=0 ) {			LOG(L_ERR, "ERROR:tm:build_local: "				"failed to extract UAC hdrs\n");			goto error;		}	}	DBG("DEBUG:tm:build_local: using FROM=<%.*s>, TO=<%.*s>, CSEQ_N=<%.*s>\n",		from.len,from.s , to.len,to.s , cseq_n.len,cseq_n.s);	/* method, separators, version  */	*len=SIP_VERSION_LEN + method_len + 2 /* spaces */ + CRLF_LEN;	*len+=Trans->uac[branch].uri.len;	/*via*/	branch_str.s=branch_buf;	if (!t_calc_branch(Trans,  branch, branch_str.s, &branch_str.len ))		goto error;	set_hostport(&hp, (is_local(Trans))?0:req);	via=via_builder(&via_len, Trans->uac[branch].request.dst.send_sock,		&branch_str, 0, Trans->uac[branch].request.dst.proto, &hp );	if (!via)	{		LOG(L_ERR, "ERROR: build_local: "			"no via header got from builder\n");		goto error;	}	*len+= via_len;	/*headers*/	*len+=from.len+Trans->callid.len+to.len+cseq_n.len+1+method_len+CRLF_LEN;	/* copy'n'paste Route headers */	if (!is_local(Trans)) {		for ( hdr=req->headers ; hdr ; hdr=hdr->next )			 if (hdr->type==HDR_ROUTE_T)				*len+=hdr->len;	}	/* User Agent */	if (server_signature) {		*len += USER_AGENT_LEN + CRLF_LEN;	}	/* Content Length, EoM */	*len+=CONTENT_LENGTH_LEN+1 + CRLF_LEN + CRLF_LEN;	cancel_buf=shm_malloc( *len+1 );	if (!cancel_buf)	{		LOG(L_ERR, "ERROR: build_local: cannot allocate memory\n");		goto error01;	}	p = cancel_buf;	append_string( p, method, method_len );	*(p++) = ' ';	append_string( p, Trans->uac[branch].uri.s, Trans->uac[branch].uri.len);	append_string( p, " " SIP_VERSION CRLF, 1+SIP_VERSION_LEN+CRLF_LEN );	/* insert our via */	append_string(p,via,via_len);	/*other headers*/	append_string( p, from.s, from.len );	append_string( p, Trans->callid.s, Trans->callid.len );	append_string( p, to.s, to.len );	append_string( p, cseq_n.s, cseq_n.len );	*(p++) = ' ';	append_string( p, method, method_len );	append_string( p, CRLF, CRLF_LEN );	if (!is_local(Trans))  {		for ( hdr=req->headers ; hdr ; hdr=hdr->next )			if(hdr->type==HDR_ROUTE_T) {				append_string(p, hdr->name.s, hdr->len );			}	}	/* User Agent header */	if (server_signature) {		append_string(p,USER_AGENT CRLF, USER_AGENT_LEN+CRLF_LEN );	}	/* Content Length, EoM */	append_string(p, CONTENT_LENGTH "0" CRLF CRLF ,		CONTENT_LENGTH_LEN+1 + CRLF_LEN + CRLF_LEN);	*p=0;	pkg_free(via);	return cancel_buf;error01:	pkg_free(via);error:	return NULL;}