Hello Daniel<br><br>Thanks for pointing out to the SIP traces. I found out that it if the request is to be sent to a destination using a port other than 5060, it is required to add the $uac_req(ouri) parameter too:<br><br>
$uac_req(ouri)=&quot;sip:&quot; + $var(asterisk_ip) + &quot;:&quot; + $var(asterisk_port);<br>....<br><br>$uac_req(ouri)=&quot;sip:&quot; + $var(asterisk2_ip) + &quot;:&quot; + $var(asterisk2_port);<br><br><br>Thanks!<br>
<br clear="all">Alejandro Rios Peņa<br><a href="mailto:alerios@debian.org" target="_blank"></a><br><font size="1"><br>DISCLAIMER: The opinions expressed are my own, and not necessarily those of my employer.</font><br><a href="http://www.avatar.com.co" target="_blank"><br>
</a><br>
<br><br><div class="gmail_quote">2011/4/8 Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<div><div></div><div class="h5"><br>
<br>
On 4/8/11 12:28 AM, Alejandro Rios P. wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi all,<br>
<br>
I am testing the scenario described here: <a href="http://kb.asipto.com/asterisk:realtime:kamailio-3.1.x-asterisk-1.6.2-astdb" target="_blank">http://kb.asipto.com/asterisk:realtime:kamailio-3.1.x-asterisk-1.6.2-astdb</a><br>

<br>
It works great with one instance of Asterisk, but now that I&#39;m testing with two Asterisk instances to load balance, and I see a problem regarding the registration forwarding to the second Asterisk.<br>
<br>
I tried adding a second &quot;uac_req_send()&quot; bellow the first one, but Kamailio only sends the first request and the REGISTER never gets to the second Asterisk:<br>
<br>
# Forward REGISTER to Asterisk<br>
route[REGFWD]  {<br>
        if(!is_method(&quot;REGISTER&quot;))<br>
        {<br>
                return;<br>
        }<br>
        $var(rip)  =  $sel(cfg_get.asterisk.bindip);<br>
        $uac_req(method)=&quot;REGISTER&quot;;<br>
        $uac_req(ruri)=&quot;sip:&quot;  +  $var(rip)  +  &quot;:&quot;  +  $sel(cfg_get.asterisk.bindport);<br>
        $uac_req(furi)=&quot;sip:&quot;  +  $au+  &quot;@&quot;  +  $var(rip);<br>
        $uac_req(turi)=&quot;sip:&quot;  +  $au+  &quot;@&quot;  +  $var(rip);<br>
        $uac_req(hdrs)=&quot;Contact:&lt;sip:&quot;  +  $au+  &quot;@&quot;<br>
                                +  $sel(cfg_get.kamailio.bindip)<br>
                                +  &quot;:&quot;  +  $sel(cfg_get.kamailio.bindport)  +  &quot;&gt;\r\n&quot;;<br>
        if($sel(contact.expires)  !=  $null)<br>
                $uac_req(hdrs)=  $uac_req(hdrs)  +  &quot;Expires:&quot;  +  $sel(contact.expires)  +  &quot;\r\n&quot;;<br>
        else<br>
                $uac_req(hdrs)=  $uac_req(hdrs)  +  &quot;Expires:&quot;  +  $hdr(Expires)  +  &quot;\r\n&quot;;<br>
        uac_req_send();<br>
<br>
         $uac_req(all) = null;<br>
<br>
        $var(rip2)  =  $sel(cfg_get.asterisk2.bindip);<br>
        $uac_req(method)=&quot;REGISTER&quot;;<br>
        $uac_req(ruri)=&quot;sip:&quot;  +  $var(rip2)  +  &quot;:&quot;  +  $sel(cfg_get.asterisk2.bindport);<br>
        $uac_req(furi)=&quot;sip:&quot;  +  $au+  &quot;@&quot;  +  $var(rip2);<br>
        $uac_req(turi)=&quot;sip:&quot;  +  $au+  &quot;@&quot;  +  $var(rip2);<br>
        $uac_req(hdrs)=&quot;Contact:&lt;sip:&quot;  +  $au+  &quot;@&quot;<br>
                                +  $sel(cfg_get.kamailio.bindip)<br>
                                +  &quot;:&quot;  +  $sel(cfg_get.kamailio.bindport)  +  &quot;&gt;\r\n&quot;;<br>
        if($sel(contact.expires)  !=  $null)<br>
                $uac_req(hdrs)=  $uac_req(hdrs)  +  &quot;Expires:&quot;  +  $sel(contact.expires)  +  &quot;\r\n&quot;;<br>
        else<br>
                $uac_req(hdrs)=  $uac_req(hdrs)  +  &quot;Expires:&quot;  +  $hdr(Expires)  +  &quot;\r\n&quot;;<br>
        uac_req_send();<br>
<br>
}<br>
<br>
I also tried appending another branch and sending the second  uac_req_send() from there, but it is not being sent.<br>
<br>
How can I use uac_req_send() several times for the same request or in parallel?<br>
</blockquote></div></div>
it should work one after the other. append_branch() does not affect uac_req_send() at all, this is a separate request built from scratch.<br>
<br>
Do you get any error message in the syslog? Can you watch the traffic on all interfaces &#39;ngrep -d any -qt -W byline port 5060&#39; ?<br>
<br>
I see you assign &#39;$uac_req(all) = null;&#39;, it should be &#39;$uac_req(all) = $null;&#39; - but I guess it was a copy&amp;paste thing.<br>
<br>
Cheers,<br>
Daniel<br><font color="#888888">
<br>
-- <br>
Daniel-Constantin Mierla<br>
<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
<br>
</font></blockquote></div><br>