[SR-Users] How to handle a 301 redirect request from a client?

Patrick Karton patrickarton at hotmail.com
Fri Jun 24 15:55:58 CEST 2022


you can do whatever manipulation you want in branch_route

just update what you want in branch_route either $rd , $rp.

no ,need to change $rU because it alreay contains the new user returned from 300.

t_on_failure("REDIRECT");

failure_route[REDIRECT] {
    if(!t_check_status("3[0-9][0-9]")) {
        exit;
    }
    if ( get_redirects("3:1") ) {
        t_on_branch("REDIRECT_ADD_DIVERSION");
        t_relay();
    }

}

branch_route[REDIRECT_ADD_DIVERSION]{
    $rd = 'PUT_THE_DOMAIN_YOU_WANT_OR_THE_ONE_BEFORE_300';
    # $rU = no need to change it ; it already contains the new user from 300
    add_diversion("user-busy");
    add_diversion("user-busy", "$ru");
}

________________________________
De : Benoît Panizzon <benoit.panizzon at imp.ch>
Envoyé : vendredi 24 juin 2022 14:11
À : Patrick Karton <patrickarton at hotmail.com>
Cc : Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
Objet : Re: [SR-Users] How to handle a 301 redirect request from a client?

Hi Gang

>     if ( get_redirects("3:1") ) {
>         t_on_branch("REDIRECT_ADD_DIVERSION");
>         t_relay();

Not working quite as expected. This seems to consider the complete URI
received from the customer. I am only interested in the 'user' part
containing the new target phone number not some bogus domain sent by the
customer.

Is the 302 reply contact uri or user put in any PV I could access and do
some manipulations before sending on (like translating from local
notation to e164).

So I also attempted to extract the username from $ct only to notice,
that $ct contains the value of the INVITE contact header sent to the
customer, not of the 302 reply contact header.

--
Mit freundlichen Grüssen

-Benoît Panizzon- @ HomeOffice und normal erreichbar
--
I m p r o W a r e   A G    -    Leiter Commerce Kunden
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 00
CH-4133 Pratteln                Fax  +41 61 826 93 01
Schweiz                         Web  http://www.imp.ch
______________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220624/4801c90a/attachment.htm>


More information about the sr-users mailing list