[OpenSER-Devel] TM-API-Calls: t_request, Presence and others....

Carsten Bock lists at bock.info
Tue Aug 7 11:10:13 CEST 2007


Hi,

i need an Outbound-Proxy in the "t_request"-Method in the TM-API, but i
do not know how to define it properly in the request. I've managed to do
this, by extending the TM-API, where i can define the outbound proxy:

/*
 * Send a transactional request, no dialogs involved
 */
int request_via(str* m, str* ruri, str * via, str* to, str* from, str*
h, str* b, transaction_cb c, void* cp)
{
	str callid, fromtag;
	dlg_t* dialog;
	int res;

	if (check_params(m, to, from, &dialog) < 0) goto err;

	generate_callid(&callid);
	generate_fromtag(&fromtag, &callid);

	if (new_dlg_uac(&callid, &fromtag, DEFAULT_CSEQ, from, to, &dialog) <
0) {
		LOG(L_ERR, "request(): Error while creating temporary dialog\n");
		goto err;
	}

	if (ruri) {
		dialog->rem_target.s = ruri->s;
		dialog->rem_target.len = ruri->len;
		dialog->hooks.request_uri = &dialog->rem_target;
	}i have a question about the t_request from the TM-API:
	w_calculate_hooks(dialog);
	if (via) {
		dialog->hooks.next_hop = via;
	}

	res = t_uac(m, h, b, dialog, c, cp);
	dialog->rem_target.s = 0;
	free_dlg(dialog);
	return res;

 err:
	if (cp) shm_free(cp);
	return -1;
}

/*
 * Send a transactional request, no dialogs involved
 */i have a question about the t_request from the TM-API:
int request(str* m, str* ruri, str* to, str* from, str* h, str* b,
transaction_cb c, void* cp)
{
	return request_via(m, ruri, NULL, to, from, h, b, c, cp);
}

(i can provide a complete patch for OpenSER 1.2.1/Trunk, if required)
Is this the correct way to implement something like this? What about
other modules? For our setup, also the messages generated from the
presence-Module need to go through the outbound proxy (probably the same
with other modules), and i do not know how configure this (and i found
no clue in the docs)...

Thank you,
Carsten





More information about the Devel mailing list