Hi -
Can someone help me understand how pseudo-variables interact with branches?
I've written this logic in my failure route to do a reroute of calls if the primary destination fails:
if ( is_method("INVITE") && !t_check_status("407") && ($rd != "127.0.0.1") ) { # Maybe should also check its not just a Busy or similar xlog("L_NOTICE","SLD: INVITE failed $rm ($mt / $rs $rr): $ci::$ft; try via asterisk instead\n"); append_branch("sip:$rU@127.0.0.1:5070"); send_reply("181", "Rerouting call via local failover"); $avp(senttoast) = 1; if (!t_relay()) { sl_reply_error(); # or reply_error ? }
I'm trying to check if the call was already rerouted - by looking at $rd. But in fact I find that $rd keeps the domain from the ORIGINAL invite even if the call that just failed was the one to 127.0.0.1:5070 .
So I'm obviously missing something about how pseudo-variables interact with the branching etc.
Thanks, Steve
Hello,
$rd is the domain from the latest r-uri, not from original r-uri. Can you check to be sure there is no revert_uri() used somewhere around?
If still a problem, then load debugger module, set its parameter cfgtrace to 1 and send the log messages here to see what actions are executed, maybe some revert the uri inside.
Cheers, Daniel
On 8/24/13 8:05 PM, Steve Davies wrote:
Hi -
Can someone help me understand how pseudo-variables interact with branches?
I've written this logic in my failure route to do a reroute of calls if the primary destination fails:
if ( is_method("INVITE") && !t_check_status("407") && ($rd !=
"127.0.0.1") ) { # Maybe should also check its not just a Busy or similar xlog("L_NOTICE","SLD: INVITE failed $rm ($mt / $rs $rr): $ci::$ft; try via asterisk instead\n"); append_branch("sip:$rU@127.0.0.1:5070 http://rU@127.0.0.1:5070"); send_reply("181", "Rerouting call via local failover"); $avp(senttoast) = 1; if (!t_relay()) { sl_reply_error(); # or reply_error ? }
I'm trying to check if the call was already rerouted - by looking at $rd. But in fact I find that $rd keeps the domain from the ORIGINAL invite even if the call that just failed was the one to 127.0.0.1:5070 http://127.0.0.1:5070 .
So I'm obviously missing something about how pseudo-variables interact with the branching etc.
Thanks, Steve
-- Steve Davies: Technical Director, Connection Telecom (Pty) Ltd Email is preferred, but: Phone: 0878200200
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi,
Thanks for picking this up.
There are no revert_uri()s in my kamailio.cfg.
Here's my test:
I send invite to "*26@vc2.connection-telecom.com" from my client on 172.16.230.1.
My Kamaillio config first sends the request upstream That challenges and eventually a second authenticated invite is sent. upstream sends back a 500 In failure_route MANAGE_FAILURE we call route block TRYASTERISK which pushes the call to 127.0.0.1:5070 This is in the logic below.
What I find is that if the call to Asterisk also fails I come back again into TRYASTERISK and $rd for this branch still points to the original upstream destination (vc2.connection-telecom.com).
It seems to be harmless and another invite isn't actually sent to Asterisk. Don't really get that so I apologise if I'm being stupid.
I've attached my kamailio.cfg and also the trace you requested.
Thanks for any pointers.
Steve
On 4 September 2013 12:12, Daniel-Constantin Mierla miconda@gmail.comwrote:
Hello,
$rd is the domain from the latest r-uri, not from original r-uri. Can you check to be sure there is no revert_uri() used somewhere around?
If still a problem, then load debugger module, set its parameter cfgtrace to 1 and send the log messages here to see what actions are executed, maybe some revert the uri inside.
Cheers, Daniel
On 8/24/13 8:05 PM, Steve Davies wrote:
Hi -
Can someone help me understand how pseudo-variables interact with branches?
I've written this logic in my failure route to do a reroute of calls if the primary destination fails:
if ( is_method("INVITE") && !t_check_status("407") && ($rd !=
"127.0.0.1") ) { # Maybe should also check its not just a Busy or similar xlog("L_NOTICE","SLD: INVITE failed $rm ($mt / $rs $rr): $ci::$ft; try via asterisk instead\n"); append_branch("sip:$rU@127.0.0.1:5070"); send_reply("181", "Rerouting call via local failover"); $avp(senttoast) = 1; if (!t_relay()) { sl_reply_error(); # or reply_error ? }
I'm trying to check if the call was already rerouted - by looking at $rd. But in fact I find that $rd keeps the domain from the ORIGINAL invite even if the call that just failed was the one to 127.0.0.1:5070 .
So I'm obviously missing something about how pseudo-variables interact with the branching etc.
Thanks, Steve
-- Steve Davies: Technical Director, Connection Telecom (Pty) Ltd Email is preferred, but: Phone: 0878200200
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
- more details about Kamailio trainings at http://www.asipto.com -
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users