On 5/17/10 5:47 PM, Juha Heinanen wrote:
Juha Heinanen writes:
any pointer on how to do the same from lcr module? i guess i need to load tm api and call some tm function?
i think i was able to figure this out. the corresponding tm api function is t_gett().
yes, t_gett() is the way. For the reference, if someone needs to play with tm api, looking at tmx module is a good example, since it uses couple of them. also k sl module uses transaction detection for send_reply().
so i went and changed next_gw() implementation so that if no transaction exists, it rewrites request uri and if it exists, it clears possible old branches and appends a new one.
still next_gw() does not work as it should, i.e., second next_gw() call after failing t_relay() results in destination set with two sip uris (the first one and the second one).
then i went and added some more debug to script:
# relay the request if (t_relay()) { xlog("Relaying succeeded with result $rc\n"); exit; } else { xlog("Relaying failed with result $rc\n"); if (t_check_trans()) { xlog("Transaction exists\n"); } else { xlog("Transaction does not exist\n"); }; };
what happens now is that execution of the script stops at t_check_trans() test, i.e., nothing gets printed to syslog after this:
May 17 18:26:09 localhost /usr/sbin/sip-proxy[30400]: ERROR: Relaying failed with result -478
even if t_check_trans() would not be a proper function to call at this point, i don't understand why it does not return.
t_check_trans() returns 0 if transaction exists, iirc, to absorb retransmission.
anyway, then i then went and changed in above t_check_trans() to t_lookup_request() and execution of the script went on and printed this:
May 17 18:36:35 localhost /usr/sbin/sip-proxy[30693]: INFO: Relaying INVITEsip:00358407058055@sars.tutpro.com;transport=tcp to gw May 17 18:36:35 localhost /usr/sbin/sip-proxy[30693]: ERROR: tm [ut.h:295]: ERROR: uri2dst: failed to resolve "sars.tutpro.com" :unresolvable A or AAAA request (-7) May 17 18:36:35 localhost /usr/sbin/sip-proxy[30693]: ERROR: tm [t_fwd.c:1391]: ERROR: t_forward_nonack: failure to add branches May 17 18:36:35 localhost /usr/sbin/sip-proxy[30693]: ERROR: Relaying failed with result -478 May 17 18:36:35 localhost /usr/sbin/sip-proxy[30693]: ERROR: Transaction exists May 17 18:36:36 localhost /usr/sbin/sip-proxy[30693]: ERROR: Calling next_gw() May 17 18:36:36 localhost /usr/sbin/sip-proxy[30693]: ERROR: found next gw<Contact: sip:00358407058055@sars.tutpro.com;transport=tcp, sip:00358407058055@lohi.tutpro.com:5060> May 17 18:36:36 localhost /usr/sbin/sip-proxy[30693]: INFO: Relaying INVITEsip:00358407058055@sars.tutpro.com;transport=tcp to gw ...
so even if t_relay() failed with result -478, transaction was created. as result, next_gw() thought that it must now append a new branch instead of rewriting request uri, which resulted in trying the first gw the second time.
i don't understand, how it is possible that transaction was created, but request uri was not marked as used. also, i don't understand how i can ever get this to work, because i don't have no way to know if i should rewrite request uri or append a branch.
I haven't got into this config situation yet. I will try to look into sources, but might take a bit since I travel. I will ping Andrei, maybe he can give a hint faster.
Cheers, Daniel
andrei, are you around? perhaps you can shed some light on this or better yet implement opensips behavior about which i posted a request to the tracker, which would allow me always just to rewrite request uri and be done with it.
-- juha
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev