[SR-Users] Rewriting To on BYE
Daniel-Constantin Mierla
miconda at gmail.com
Mon Oct 24 20:28:14 CEST 2016
Hello,
just to clarify -- did you tried and there were some issues, or just
pure validation of the regex in the subst?
If the second, I would rather use subdt_hf(), but not sure it's in 4.3
or added later. Then instead of \2, I would use $tU (To header username).
Likely you can also completely avoid substitution operations, by doing:
remove_hf("To");
insert_hf("To: <sip:$tU@$rd:rp>;tag=$tt\r\n");
Cheers,
Daniel
On 24/10/16 12:54, Charles Phillips wrote:
> I need a sanity check if you don’t mind… I am setting up a stateless
> proxy for several (separate, not load balanced) Asterisk servers
> behind Kamailio 4.2 (with domain and dispatcher). All works as
> expected except when called party hangs up, as Asterisk seems to
> address the BYE “To” (that is sent to the calling party) to the
> originating domain, and not the IP of the UA (as it does in other
> cases). When this happens, stateless Kamailio does not seem to know
> how to route them, which makes sense. I assume I would need to
> rewrite the “To” field on BYE message so that it contains the UA’s IP
> (to match the BYE’s that are routed correctly). The RURI header
> contains the IP/port of the UA, so I am attempting to use it and here
> is where I am stuck…
>
> Here is the subst from onreply_route:
>
> if (is_method("BYE")) {
> xlog("L_NOTICE", "BYE Detected \n");
> subst('/^To:(.*)<sip:(.*)@(.*)>(.*)$/To: <sip:\2@$rd:$rp
> <sip:%5C2@$rd:$rp>>\4/ig');
> }
>
> Here is the “To”:
>
> To: "Test User 2"
> <sip:102 at zxcv.asdf.qwerty.net>;tag=8AB53900B9646F1DF05330E7FBF846C8
>
> Any obvious glaring mistakes here? Would I then need additional logic
> to forward the BYE on?
>
> My apologies if this is wordy, or nonsensical...
>
>
>
>
>
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Oct 24-26, 2016 - http://www.asipto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161024/949b2a43/attachment.html>
More information about the sr-users
mailing list