I'm missing something obvious here, throwing this out to get a couple extra sets of eyeballs on it.
I can't get rr modules is_direction() or the $fti / $tti pv's to work in 4.3.x or 4.4.x
Relevant parts of the config:
loadmodule "rr.so" modparam ("rr", "enable_full_lr", 1) modparam ("rr", "append_fromtag", 1)
...
route {
xlog ("L_INFO", "$rm: $fu -> $ru");
record_route ();
if (has_totag ()) { xlog ("L_INFO", "Before Loose route: fti: $fti tti: $tti ci: $ci"); if (loose_route ()) { if (is_direction ("downstream")) { xlog ("L_INFO", "in-dialog $rm request from caller to callee"); } else { xlog ("L_INFO", "in-dialog $rm request from callee to caller"); } xlog ("L_INFO", "After Loose route: fti: $fti tti: $tti ci: $ci"); } }
if (! t_relay ()) { sl_reply_error (); } }
----
Bob and Alice are hard phones, with kamailio + dbaliases in the middle.
Alice calls Bob, then Bob (the callee) sends the BYE
----
Syslog:
01. INVITE: sip:alice@kamailio.org -> sip:bob@kamailio.org:5060 02. Alias lookup returned sip:bob@biloxi.com , sending on 03. ACK: sip:alice@kamailio.org -> sip:bob@biloxi.com 04. Before Loose route: fti: 707601862 tti: 45686ADF-10AAEB28 ci: 8744171@atlanta.com 05. in-dialog ACK request from caller to callee 06. After Loose route: fti: 707601862 tti: 45686ADF-10AAEB28 ci: 8744171@atlanta.com 07. BYE: sip:bob@kamailio.org -> sip:alice@atlanta.com:5066 08. Before Loose route: fti: 45686ADF-10AAEB28 tti: 707601862 ci: 8744171@atlanta.com 09. in-dialog BYE request from caller to callee 10. After Loose route: fti: 45686ADF-10AAEB28 tti: 707601862 ci: 8744171@atlanta.com
Using the above config, is_direction always returns "caller", even when bob is sending the message. Looking at a packet capture:
01. Kamailio Sent: Record-Route: sip:kamailio.org;lr=on;ftag=707601862
<on the 200 ok from Bob> Kamailio Received: Record-Route: sip:kamailio.org;lr=on;ftag=707601862 Kamailio Sent: Record-Route: sip:kamailio.org;lr=on;ftag=707601862
07. Kamailio Received: Route: sip:kamailio.org;lr=on;ftag=707601862 Kamailio Sent: Record-Route: sip:kamailio.org;lr=on;ftag=45686ADF-10AAEB28
I expect $fti to be wrong before the loose_route (line 08); but lines 09 and 10 are wrong.
I'm obviously missing something trivial here. Any ideas what I should check next?
Thanks!
Hello,
you should use $fti and $tti only after loose_route().
If used before, it doesn't find the proper Route header and assumes downstream. The issue actually is the fact that there is some caching done in this case, to avoid doing same processing many times for same sip message. So getting again $fti or $tti after loose route doesn't change anymore the values computed before loose route.
I guess it needs more clarifications in the docs.
Also, record_route() for requests within dialog can take the tag from callee, if the re-invite comes from that side.
Cheers, Daniel
On 13/07/16 22:19, Nathan Angelacos wrote:
I'm missing something obvious here, throwing this out to get a couple extra sets of eyeballs on it.
I can't get rr modules is_direction() or the $fti / $tti pv's to work in 4.3.x or 4.4.x
Relevant parts of the config:
loadmodule "rr.so" modparam ("rr", "enable_full_lr", 1) modparam ("rr", "append_fromtag", 1)
...
route {
xlog ("L_INFO", "$rm: $fu -> $ru");
record_route ();
if (has_totag ()) { xlog ("L_INFO", "Before Loose route: fti: $fti tti: $tti ci: $ci"); if (loose_route ()) { if (is_direction ("downstream")) { xlog ("L_INFO", "in-dialog $rm request from caller to callee"); } else { xlog ("L_INFO", "in-dialog $rm request from callee to caller"); } xlog ("L_INFO", "After Loose route: fti: $fti tti: $tti ci: $ci"); } }
if (! t_relay ()) { sl_reply_error (); } }
Bob and Alice are hard phones, with kamailio + dbaliases in the middle.
Alice calls Bob, then Bob (the callee) sends the BYE
Syslog:
- INVITE: sip:alice@kamailio.org -> sip:bob@kamailio.org:5060
- Alias lookup returned sip:bob@biloxi.com , sending on
- ACK: sip:alice@kamailio.org -> sip:bob@biloxi.com
- Before Loose route: fti: 707601862 tti: 45686ADF-10AAEB28 ci:
8744171@atlanta.com 05. in-dialog ACK request from caller to callee 06. After Loose route: fti: 707601862 tti: 45686ADF-10AAEB28 ci: 8744171@atlanta.com 07. BYE: sip:bob@kamailio.org -> sip:alice@atlanta.com:5066 08. Before Loose route: fti: 45686ADF-10AAEB28 tti: 707601862 ci: 8744171@atlanta.com 09. in-dialog BYE request from caller to callee 10. After Loose route: fti: 45686ADF-10AAEB28 tti: 707601862 ci: 8744171@atlanta.com
Using the above config, is_direction always returns "caller", even when bob is sending the message. Looking at a packet capture:
- Kamailio Sent: Record-Route: sip:kamailio.org;lr=on;ftag=707601862
<on the 200 ok from Bob> Kamailio Received: Record-Route: sip:kamailio.org;lr=on;ftag=707601862 Kamailio Sent: Record-Route: sip:kamailio.org;lr=on;ftag=707601862
- Kamailio Received: Route: sip:kamailio.org;lr=on;ftag=707601862 Kamailio Sent: Record-Route:
sip:kamailio.org;lr=on;ftag=45686ADF-10AAEB28
I expect $fti to be wrong before the loose_route (line 08); but lines 09 and 10 are wrong.
I'm obviously missing something trivial here. Any ideas what I should check next?
Thanks!
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
Thanks!
you should use $fti and $tti only after loose_route().
If used before, it doesn't find the proper Route header and assumes downstream. The issue actually is the fact that there is some caching done in this case, to avoid doing same processing many times for same sip message. So getting again $fti or $tti after loose route doesn't change anymore the values computed before loose route.
Makes perfect sense. I forgot how the parser works. Only parse the headers when they are needed.
So take-away is *only* access a pv /after/ you have run any of its prerequisites. First time a pv is referenced, it is defined and allocated. After that the value (at time of first reference) will be used for the rest of the script. And yes, this is for R/O pv's - R/W can be reassigned.
As always, user support is absolutely the best. Thank you.
I guess it needs more clarifications in the docs.
Maybe, but I'm not sure how to express it clearer.
Also, record_route() for requests within dialog can take the tag from callee, if the re-invite comes from that side.
Right. Forgot that too.
Thanks again. All works as expected now!