[Serdev] sip_msg* in tmb.t_request_within callback
function asparameter [SOLVED]
Samuel Osorio Calvo
samuel.osorio at nl.thalesgroup.com
Thu Mar 24 14:32:55 UTC 2005
I already found a workaround saving the transaction's identifiers
(hash,label) and later retrieving the transaction using the loaded tmb
functions:
t_get_trans_ident
t_lookup_ident
Now I can go on doing "dirty" things,
Samuel.
Unclassified.
>>> "Samuel Osorio Calvo" <samuel.osorio at nl.thalesgroup.com> 03/22/05
02:43PM >>>
Hi all,
I would like to know if the next scenario is possible and how to
handle
it better:
1) UA ------SIP request 1----> SER
SER creates a UAS transaction to absorb UA's SIP request 1
retransmissions. (t_newtran)
2) SER-----SIP request 2------------>???
this new SIP request 2 is created with tmb.new_dlg and sent with
tmb.t_request[_within|outside]
If no answer is received in the UAC part of SER, transaction 2 will
timeout and I would like to inform user (via transaction 1) of this
fact. Moreover, I would like to return the answer obtained in
transcation 2 to transaction 1. As example, these responses can be a
302, 403, 407, etc....
I guess the only required mechanism would be to pass SIP request 1 as
a
parameter of the callback function in transaction 2 but I have tried
and
got some segmentation faults and core dumps as result :( The failures
are related to the header parsing of tmb.xxx functions (t_gett,
t_reply,
etc...) probably because the SIP msg pointer is not right.
I read that the tmcb_params must be allocated using shared memory and
later freed by the user, is this right?? Because I think the struct
sip_msg* accessible from the SER config file exported functions is
stored in "pkg" memory, is this right?? Thus, do we have to make a
copy
of the original SIP message in shared memory in order to access it
from
the callback function of transaction 2 ( or the required parameters to
create the hash entry in the table) ????
As you can imagine this functionality has been tested in an external
module, without modifying SER tm..( I don't want to modify "standard"
SER behaviour, it's more than good enough to mess it up!!!!). Above
scenario is almost exactly the same as tm behaviour except that
request
1 and request 2 do not have to be the same. It is thus not an
"standard"
relay function...that's why I ask if it is possible with SER....
Summarising, is it possible next structure:
int exported_function_to_config_file(struct sip_msg *msg){
new_tran = tmb.t_newtran( msg ); //create UAS transaction
1
ret=tmb.new_dlg_uac(&callid, &fromtag, DEFAULT_CSEQ, &from,
&to, &dlg); //create UAC transaction 2
ret = tmb.t_request( SIP_message_2, SIP_message_2_hdrs ,
SIP_msg_2_body , dlg, callback_function , (void *) msg); //sent msg 2
via transaction 2
//passing
SIP msg 1 as parameter
}
static void callback_function( struct cell *t, int type, struct
tmcb_params *ps){
tmb.t_reply ( (struct sip_msg *) ps->params, (int)
XXX,
"Whatever"); //sent response to transaction 1
}
Any comment will be highly appreciated!!!
Samuel.
Unclassified.
_______________________________________________
Serdev mailing list
serdev at lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serdev
More information about the Serdev
mailing list