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 <[email protected]>
Envoyé : vendredi 24 juin 2022 14:11
À : Patrick Karton <[email protected]>
Cc : Kamailio (SER) - Users Mailing List <[email protected]>
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
______________________________________________________
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to