This is not the right way to do it.<div><br></div><div>just set the initial hostport, then arm the failure route:</div><div>t_on_failure(&quot;1&quot;);</div><div><br></div><div>then t_relay() like normal.</div><div><br></div>

<div>Then setup a failure route:</div><div>failure_route[1] {</div><div><br></div><div>}</div><div><br></div><div>and perform your t_check_status and rewrite etc in there (perform a second rewritehostport) then t_relay again..</div>

<div><br></div><div>This is pretty basic scripting stuff.. I&#39;d encourage you to go over the examples.</div><div><br></div><div>-Brett</div><div><br></div><div><br><div class="gmail_quote">On Mon, Oct 12, 2009 at 10:03 AM, Pacho Baratta [fabbricadigitale] <span dir="ltr">&lt;<a href="mailto:P.Baratta@fabbricadigitale.it">P.Baratta@fabbricadigitale.it</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">








<div lang="IT" link="blue" vlink="purple">

<div>

<p class="MsoNormal"> </p>

<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">Hi all, i need some help with an issue. i&#39;m quite a newbie, so be
patien, please. i need to redirect all calss to a different gateway when the
1st returns a sip404.</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">my route is like this: if (is_method(&quot;INVITE&quot;)) {</span></p>



<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">if(uri=~&quot;^sip:<i>@</i>&quot;) {</span></p>



<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">rewritehostport(&quot;<a href="http://172.30.1.110:5060" target="_blank">172.30.1.110:5060</a>&quot;);</span></p>



<p class="MsoNormal" style="margin-left:112.5pt;background:white"><span lang="EN" style="font-size:10.0pt;color:#5E5E5E">#</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">if (t<i>check</i>status(&quot;404&quot;)) {
sethostport(&quot;<a href="http://192.168.2.100:5060" target="_blank">192.168.2.100:5060</a>&quot;);</span></p>

<p class="MsoNormal" style="margin-right:12.0pt;margin-bottom:12.0pt;margin-left:124.5pt;line-height:120%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:120%;font-family:&quot;Courier New&quot;;color:#5E5E5E">         
t_relay();</span></p>

<p class="MsoNormal" style="margin-right:12.0pt;margin-bottom:12.0pt;margin-left:124.5pt;line-height:120%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:120%;font-family:&quot;Courier New&quot;;color:#5E5E5E">    }</span></p>



<p class="MsoNormal" style="margin-left:112.5pt;background:white"><span lang="EN" style="font-size:10.0pt;color:#5E5E5E">#</span></p>

<p class="MsoNormal" style="margin-right:12.0pt;margin-bottom:12.0pt;margin-left:124.5pt;line-height:120%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:120%;font-family:&quot;Courier New&quot;;color:#5E5E5E">route(1);</span></p>



<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">}</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">but this doesn&#39;t seem to work.</span></p>



<p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">can yoi suggest me the right way to do it?</span></p>



<p class="MsoNormal" style="margin-left:112.5pt;line-height:160%;background:white"><span lang="EN" style="font-size:10.0pt;line-height:160%;color:#5E5E5E">thanks, Pacho</span></p>

<p class="MsoNormal"><span lang="EN"> </span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt">fabbrica<b>digitale</b>
srl </span></p>

<p class="MsoNormal"><b><span lang="PT-BR" style="font-size:8.0pt;color:#E60000">Pacho Baratta | Senior Systems Engineer </span></b></p>

<p class="MsoNormal"><span style="font-size:8.0pt">Tecnhology
Engineering</span></p>

<p class="MsoNormal"><span style="font-size:8.0pt;color:#1F497D">----------------------------- </span><span style="font-size:12.0pt;color:#1F497D"></span></p>

<p class="MsoNormal"><span style="font-size:8.0pt;color:#1F497D">Via A.Volta, 3 - 26041 – Casalmaggiore - CR</span><span style="font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;color:#1F497D"></span></p>

<p class="MsoNormal"><span lang="FR" style="font-size:8.0pt;color:#1F497D">Phone +39 </span><span lang="EN-GB" style="font-size:8.0pt;color:#1F497D">0375 284600</span><span lang="EN-GB" style="color:#1F497D"></span></p>

<p class="MsoNormal"><span lang="FR" style="font-size:8.0pt;color:#1F497D">Fax +39 </span><span lang="EN-GB" style="font-size:8.0pt;color:#1F497D">02 57760002</span><span lang="EN-GB" style="color:#1F497D"></span></p>

<p class="MsoNormal"><u><span lang="FR" style="font-size:8.0pt;color:#1F497D"><a href="mailto:p.baratta@fabbricadigitale.it" target="_blank">mailto:p.baratta@fabbricadigitale.it</a><br>
</span></u><span style="color:#1F497D"><a href="http://www.fabbricadigitale.it/" title="http://www.fabbricadigitale.it/" target="_blank"><span lang="EN-GB" style="font-size:8.0pt">www.fabbricadigitale.it</span></a></span><u><span style="font-size:8.0pt;color:#1F497D"> </span></u><span lang="EN-GB" style="color:#1F497D"></span></p>



<p class="MsoNormal"><span lang="EN-US"> </span></p>

</div>

</div>


<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>