Actually, I sent this way too soon. I think I tried a bunch of different things and got confused. This is config is working correctly and sending correctly.
From:
Trey Ormsbee <Trey.Ormsbee@interoptechnologies.com>
Date: Tuesday, June 20, 2023 at 2:54 PM
To: sr-users@lists.kamailio.org <sr-users@lists.kamailio.org>
Subject: How to handle 302 redirects
Hello,
Im having a hard time figuring out how to handle a 302 reidrect, the uac_redirect modules shows a simple configuration. However for me, what it is not doing is changing the 302 back to invite. It is sending
the 302 as is on.
if(!t_check_status("3[0-9][0-9]")) {
exit;
}
get_redirects("3:1");
t_relay();
This code just relays the 302 for me. I should add I am using this with the DISPATCHER module so perhaps that has something to do with my issue.
Setup is this, kamailio is sitting between to sip servers, so the flow goes like this, sip_server_a -> kamailio -> sip_server_b. sip_server_b only responds with 302 redirects, sip_server_a does not
handle 302’s at all. Kamailio will only get invites from sip_server_a, and the redirects from sip_server_b will only have one contact. How can I get kamailio to reply to sip_server_a’s invite with the updated INVITE?
My config is a mesh of the dispatcher example and uac_redirect example with this specific section handling the redirect:
# Sample failure route
failure_route[RTF_DISPATCH] {
xlog("L_NOTICE", "RTF_DISPATCH: ");
if (t_is_canceled()) {
exit;
}
# next DST - only for 500 or local timeout
if (t_check_status("500")
or (t_branch_timeout() and !t_branch_replied()))
{
if(ds_next_dst())
{
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}
}
if (t_check_status("302")) {
xlog("L_NOTICE", "RTF_DISPATCH: 302 ");
if (!get_redirects("1:1")) {
xlog("L_NOTICE", "RTF_DISPATCH: failed to get_redirects ");
t_reply("480", "Temporarily Unavailable");
exit;
}
xlog("L_NOTICE", "RTF_DISPATCH: got redirects ");
t_relay(“sip_server_a”,”5060”);
}
}
Any ideas what I am doing wrong is this supported? Im expecting once I relay this message that it should be an INVITE not a 302 redirect. I cant find any examples of anyone else really doing this.