Hi Alex,
We have a similar issue (slightly complex) as it involves sip parallel forking.
The issue is that failure_route[] occurs when all sip forked are exhausted even though
"302 Moved Temporarily" has been responded back by one of the SIP endpoint quite
quickly.
So, we wish to handle 302 onreply_route[] as it is received quite promptly but as you
pointed out Kamailio doesn’t let us set the contact header or append_to_reply.
Please can you suggest me is there any way out we can change the sip contact when using
sip parallel forking.
Many Thanks
Regards
Muhammad Adil M Zaka
-----Original Message-----
From: sr-users <sr-users-bounces(a)lists.kamailio.org> On Behalf Of Alex Balashov
Sent: 16 January 2020 22:32
To: sr-users(a)lists.kamailio.org
Subject: Re: [SR-Users] Trouble with 302 Redirect
Try doing this in a failure_route[]; onreply_route[] isn't really meant to transform
replies, just to passively observe or drop them.
Also, you'll want to use append_to_reply():
https://kamailio.org/docs/modules/5.3.x/modules/textops.html#textops.f.appe…
Note that the conditions that give rise to the invocation of a failure_route are broader
and somewhat more abstract than any given SIP reply -- e.g. transaction reply timeouts.
So, you would want to structure your failure_route like this:
failure_route[REDIRECT_HANDLE] {
if(t_is_canceled())
exit;
if(t_branch_timeout()) {
# Handle the timeout case...
exit;
}
# Use $T_rpl to access reply code ($rs) and reply reason if needed
# ($rs), per:
#
#
https://www.kamailio.org/wiki/cookbooks/5.3.x/pseudovariables#t_rpl_pv
if($T_rpl($rs) == 486) {
append_to_reply("Contact: <sip:...>\r\n");
t_reply("302", "Moved Temporarily");
exit;
}
# Some other case.
}
-- Alex
On Thu, Jan 16, 2020 at 03:54:54PM -0500, Jim Leahy wrote:
Hi All,
I'm having some issues trying to properly send a '302 Moved Temporarily'
reply to the calling UAC (UAC1) when the remote UAC (UAC2) returns a
486 status (Do Not Disturb). The goal is to redirect UAC1 to a
voicemail server when UAC2 is in DND.
Here are the pertinent parts of my config:
route {
# drop some things right away
route(DROP);
# perform sanity check
route(SANITYCHECK);
# handle registrations
if(is_method("REGISTER")) {
route(REGISTRATION);
exit;
}
# handle invites
if(is_method("INVITE")) {
route("INVITE");
exit;
}
route(RELAY);
}
route[INVITE] {
# add this proxy to the record-route so it stays in the loop
record_route();
# if we can find this user in the location DB...
if(lookup("location")) {
# relay the invite to the new dURI
t_on_failure("FOURDIGITFAIL");
t_on_reply("FOURDIGITREPLY");
route(RELAY);
# go back to the main route
return;
}
onreply_route[FOURDIGITREPLY] {
if(t_check_status("4[0-9]{2}")) {
t_reply("302", "Moved Temporarily");
}
}
I'm having issues with the t_reply in the onreply_route. It
successfully sends the reply, but I can't seem to set the Contact
header properly. I'm trying to set it to the location of the user's
mailbox on the voicemail sever (ie sip:1000@vmpbx.domain.com), but nothing I try works.
I've tried:
remove_hf("Contact");
insert_hf("Contact: sip:1000@vmpbx.domain.com");
t_reply("302", "Moved Temporarily");
But as I understand it, that just changes the header in the reply from
UAC2, not the reply I'm sending to UAC1
Then I tried:
append_to_reply("Contact: sip:1000@vmpbx.domain.com" );
t_reply("302", "Moved Temporarily");
But I can't use append_to_reply in an onreply block.
How can I change the Contact header in the reply that's sent? Am I
just going about this the wrong way? Any help would be appreciated.
Thanks
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web:
http://www.evaristesys.com/,
http://www.csrpswitch.com/
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users