[SR-Users] Rewriting To on BYE

Charles Phillips charles at rustybike.com
Mon Oct 24 12:54:48 CEST 2016


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>\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...







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161024/4cdd1ff8/attachment.html>


More information about the sr-users mailing list