[SR-Users] Trouble with 302 Redirect

Jim Leahy rickfromsunnyvale at gmail.com
Thu Jan 16 21:54:54 CET 2020


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 at vmpbx.domain.com), but nothing I try works. I've tried:
     remove_hf("Contact");
     insert_hf("Contact: sip:1000 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200116/66fc8ba2/attachment.html>


More information about the sr-users mailing list