<div dir="ltr"><p dir="ltr">Hi,<br>
</p><p>I'm not sure that I fully understand your scenario, there are things not clear to me, like: who is sending the 407? In your script snippets it seems that upon receiving the 302, in the failure route you set the $du and then you pass the message to a RELAY route, which I suppose sends the 407 reply. If you don't need for special reasons that the user performs a proxy authentication, in the failure route you could just relay the INVITE to the target FreeSWITCH after setting $du to the value of your custom header. </p><p>Hope this helps.</p><p>Regards,</p><p>Federico<br></p>
<div class="gmail_quote">On 12 Sep 2014 09:05, "Nicholas Gill" <<a href="mailto:nick@etellicom.com" target="_blank">nick@etellicom.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello sr-users,<br>
<br>
We're using Kamailio to proxy to a number of FreeSWITCH backend servers with the dispatcher module.<br>
<br>
In some specific scenarios it matters to which node the request is sent. In these cases we've configured FS to respond to the invite with 302 and provide a custom header which contains the uri of the needed backend server (Intending to emulate the behaviour of 305 Use Proxy).<br>
<br>
To attempt to handle this I've tried the following in kamailio:<br>
<br>
onreply_route[MANAGE_REPLY] {<br>
...<br>
        if (t_check_status("302") and is_present_hf("X-imx-redirect"<u></u>))<br>
        {<br>
                $avp(imx-redirect) = $hdr(X-imx-redirect);<br>
                xlog("SCRIPT: REDIRECT, Store avp for redirect: $avp(imx-redirect)\n");<br>
        }<br>
}<br>
<br>
Then in the dispatch failure route:<br>
<br>
        if ($avp(imx-redirect) != $null)<br>
        {<br>
                $du = $avp(imx-redirect);<br>
                xlog("SCRIPT: REDIRECT: going to <$ru> via <$du>\n");<br>
                route(RELAY);<br>
                exit;<br>
        }<br>
<br>
Which results in the following sip event sequence:<br>
<br>
// Normal invite sequence<br>
FS1 -> Kamailio SIP/2.0 302 Moved Temporarily (X-imx-redirect = sip:FS2...)<br>
Kamailio -> FS1 ACK<br>
Kamailio -> Caller SIP/2.0 407 Proxy Authentication Required<br>
<br>
Then the caller generates a new INVITE however I'm unsure how to route this INVITE to the specific node. The avp appears (intentionally) tied to the transaction so doesn't seem to be able to be used to correlate in this scenario.<br>
<br>
Advice on how to redirect from a backend server to another specific backend server behind Kamailio would be greatly appreciated.<br>
<br>
Cheers,<br>
<br>
-nick<br>
<br>
<br>
______________________________<u></u>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/<u></u>cgi-bin/mailman/listinfo/sr-<u></u>users</a><br>
</blockquote></div>
</div>