rem: generate_callid();
add: callid_nr++; r=snprintf(callid, rand_len+1, "%0*lx", rand_len, callid_nr ); if (r==-1) { LOG(L_CRIT, "BUG: SORRY, callid calculation failed\n"); goto error00; }  callid[rand_len]=CID_SEP; callid_s.s=callid; callid_s.len=rand_len+callid_suffix_len; DBG("DEBUG: NEW CALLID:%*s\n", callid_s.len, callid_s.s );
context: int t_uac( str *msg_type, str *dst, 	str *headers, str *body, str *from, 	transaction_cb completion_cb, void *cbp, 	dlg_t dlg){	struct cell *new_cell;	struct proxy_l *proxy;	int branch;	int ret;	unsigned int req_len;	char *buf;	union sockaddr_union to;	struct socket_info* send_sock;	struct retr_buf *request;	str dummy_from;	proxy=uri2proxy( dst );	if (proxy==0) {		ser_error=ret=E_BAD_ADDRESS;		LOG(L_ERR, "ERROR: t_uac: can't create a dst proxy\n");		goto done;	}	branch=0;	/* might go away -- we ignore it in send_pr_buffer anyway */	/* T->uac[branch].request.to_len=sizeof(union sockaddr_union); */	hostent2su(&to, &proxy->host, proxy->addr_idx, 		(proxy->port)?htons(proxy->port):htons(SIP_PORT));	send_sock=get_send_socket( &to );	if (send_sock==0) {		LOG(L_ERR, "ERROR: t_uac: no corresponding listening socket "			"for af %d\n", to.s.sa_family );		ret=E_NO_SOCKET;		goto error00;	}	generate_callid();	new_cell = build_cell( NULL ) ; 	if (!new_cell) {		ret=E_OUT_OF_MEM;		LOG(L_ERR, "ERROR: t_uac: short of cell shmem\n");		goto error00;	}	new_cell->completion_cb=completion_cb;	new_cell->cbp=cbp;	/* cbp is installed -- tell error handling bellow not to free it */	cbp=0;	new_cell->is_invite=msg_type->len==INVITE_LEN 		&& memcmp(msg_type->s, INVITE, INVITE_LEN)==0;	new_cell->local=1;	new_cell->kr=REQ_FWDED;	request=&new_cell->uac[branch].request;	request->to=to;	request->send_sock=send_sock;	/* need to put in table to calculate label which is needed for printing */	LOCK_HASH(new_cell->hash_index);	insert_into_hash_table_unsafe(  new_cell );	UNLOCK_HASH(new_cell->hash_index);	if (from) dummy_from=*from; else { dummy_from.s=0; dummy_from.len=0; }	buf=build_uac_request(  *msg_type, *dst, dummy_from, *headers, *body,							branch,							new_cell, /* t carries hash_index, label, md5,										uac[].send_sock and other pieces of										information needed to print a message*/							 &req_len );    if (!buf) {        ret=E_OUT_OF_MEM;        LOG(L_ERR, "ERROR: t_uac: short of req shmem\n");        goto error01;    }      	new_cell->method.s=buf;new_cell->method.len=msg_type->len;	request->buffer = buf;	request->buffer_len = req_len;	new_cell->nr_of_outgoings++;	proxy->tx++;	proxy->tx_bytes+=req_len;	if (SEND_BUFFER( request)==-1) {		LOG(L_ERR, "ERROR: t_uac: UAC sending to %.*s failed\n",			dst->len, dst->s );		proxy->errors++;		proxy->ok=0;	}	start_retr( request );	/* success */	return 1;error01:	LOCK_HASH(new_cell->hash_index);	remove_from_hash_table_unsafe( new_cell );	UNLOCK_HASH(new_cell->hash_index);	free_cell(new_cell);error00:	free_proxy( proxy );	free( proxy );done: 	/* if we did not install cbp, release it now */	if (cbp) shm_free(cbp);	return ser_error=ret;}