<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
you can do whatever manipulation you want in branch_route</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
just update what you want in branch_route either $rd , $rp.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
no ,need to change $rU because it alreay contains the new user returned from 300.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="color:#d4d4d4;background-color:#1e1e1e;font-family:Consolas, 'Courier New', monospace;font-weight:normal;font-size:14px;line-height:19px">
<span><span style="color:#dcdcaa">t_on_failure</span><span>(</span><span style="color:#ce9178">"REDIRECT"</span><span>);</span></span><br>
<br>
<div><span style="color:#9cdcfe">failure_route</span><span>[REDIRECT] {</span></div>
<div><span>    </span><span style="color:#c586c0">if</span><span>(!</span><span style="color:#dcdcaa">t_check_status</span><span>(</span><span style="color:#ce9178">"3[0-9][0-9]"</span><span>)) {</span></div>
<div><span>        exit;</span></div>
<div><span>    }</span></div>
<div><span>    </span><span style="color:#c586c0">if</span><span> ( </span><span style="color:#dcdcaa">get_redirects</span><span>(</span><span style="color:#ce9178">"3:1"</span><span>) ) {</span></div>
<div><span>        </span><span style="color:#dcdcaa">t_on_branch</span><span>(</span><span style="color:#ce9178">"REDIRECT_ADD_DIVERSION"</span><span>);</span></div>
<div><span>        </span><span style="color:#dcdcaa">t_relay</span><span>();</span></div>
<div><span>    }</span></div>
<div><span>    </span></div>
<div><span>}</span></div>
<br>
<div><span style="color:#9cdcfe">branch_route</span><span>[REDIRECT_ADD_DIVERSION]{</span></div>
<div><span>    $rd = </span><span style="color:#ce9178">'PUT_THE_DOMAIN_YOU_WANT_OR_THE_ONE_BEFORE_300'</span><span>;</span></div>
<div><span>    # $rU = no need to change it ; it already contains the new user from
</span><span style="color:#b5cea8">300</span></div>
<div><span>    </span><span style="color:#dcdcaa">add_diversion</span><span>(</span><span style="color:#ce9178">"user-busy"</span><span>);</span></div>
<div><span>    </span><span style="color:#dcdcaa">add_diversion</span><span>(</span><span style="color:#ce9178">"user-busy"</span><span>,
</span><span style="color:#ce9178">"$ru"</span><span>);</span></div>
<span><span>}</span></span></div>
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De :</b> Benoît Panizzon <benoit.panizzon@imp.ch><br>
<b>Envoyé :</b> vendredi 24 juin 2022 14:11<br>
<b>À :</b> Patrick Karton <patrickarton@hotmail.com><br>
<b>Cc :</b> Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org><br>
<b>Objet :</b> Re: [SR-Users] How to handle a 301 redirect request from a client?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi Gang<br>
<br>
>     if ( get_redirects("3:1") ) {<br>
>         t_on_branch("REDIRECT_ADD_DIVERSION");<br>
>         t_relay();<br>
<br>
Not working quite as expected. This seems to consider the complete URI<br>
received from the customer. I am only interested in the 'user' part<br>
containing the new target phone number not some bogus domain sent by the<br>
customer.<br>
<br>
Is the 302 reply contact uri or user put in any PV I could access and do<br>
some manipulations before sending on (like translating from local<br>
notation to e164).<br>
<br>
So I also attempted to extract the username from $ct only to notice,<br>
that $ct contains the value of the INVITE contact header sent to the<br>
customer, not of the 302 reply contact header.<br>
<br>
-- <br>
Mit freundlichen Grüssen<br>
<br>
-Benoît Panizzon- @ HomeOffice und normal erreichbar<br>
-- <br>
I m p r o W a r e   A G    -    Leiter Commerce Kunden<br>
______________________________________________________<br>
<br>
Zurlindenstrasse 29             Tel  +41 61 826 93 00<br>
CH-4133 Pratteln                Fax  +41 61 826 93 01<br>
Schweiz                         Web  <a href="http://www.imp.ch">http://www.imp.ch</a><br>
______________________________________________________<br>
</div>
</span></font></div>
</body>
</html>