Hi,
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.
Hope this helps.
Regards,
Federico
Hello sr-users,
We're using Kamailio to proxy to a number of FreeSWITCH backend servers with the dispatcher module.
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).
To attempt to handle this I've tried the following in kamailio:
onreply_route[MANAGE_REPLY] {
...
if (t_check_status("302") and is_present_hf("X-imx-redirect"))
{
$avp(imx-redirect) = $hdr(X-imx-redirect);
xlog("SCRIPT: REDIRECT, Store avp for redirect: $avp(imx-redirect)\n");
}
}
Then in the dispatch failure route:
if ($avp(imx-redirect) != $null)
{
$du = $avp(imx-redirect);
xlog("SCRIPT: REDIRECT: going to <$ru> via <$du>\n");
route(RELAY);
exit;
}
Which results in the following sip event sequence:
// Normal invite sequence
FS1 -> Kamailio SIP/2.0 302 Moved Temporarily (X-imx-redirect = sip:FS2...)
Kamailio -> FS1 ACK
Kamailio -> Caller SIP/2.0 407 Proxy Authentication Required
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.
Advice on how to redirect from a backend server to another specific backend server behind Kamailio would be greatly appreciated.
Cheers,
-nick
_______________________________________________
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