Hi Daniel

You may want to kill me but I'll be honest, I'm actually using kamailio's 1.5 UAC module on an Opensips 1.6.2   :$   so I don't know if the problem could be related to that.  Anyway, here is the bad register message when using only $uac_req(ruri)="sip:8.14.80.37:5061".   Note that the SIP part itself its correct, but the UDP destination port is wrong:


Internet Protocol, Src: 8.14.80.16 (8.14.80.16), Dst: 8.14.80.37 (8.14.80.37)
User Datagram Protocol, Src Port: sip-tls (5061), Dst Port: sip (5060)
C%E@@PP%
REGISTER sip:8.14.80.37:5061 SIP/2.0
Via: SIP/2.0/UDP 8.14.80.16:5061;branch=z9hG4bK9b35.3e435b31.0
To: sip:LV-SKRUPPA@8.14.80.37
From: <sip:LV-SKRUPPA@8.14.80.37>;tag=a649c0188a5a7b7f4a4dfeaea88004c3-b5bd
CSeq: 10 REGISTER
Call-ID: 52d42e13484b4229-29572@8.14.80.16
Content-Length: 0
User-Agent: OpenSIPS (1.6.2-notls (x86_64/linux))
Contact: <sip:LV-SKRUPPA@8.14.80.16:5061>
Expires: 60


I hope this can be of any help.

Kind regards,


Alejandro Rios Peņa


DISCLAIMER: The opinions expressed are my own, and not necessarily those of my employer.





2011/4/11 Daniel-Constantin Mierla <miconda@gmail.com>
Hello,


On 4/8/11 6:14 PM, Alejandro Rios P. wrote:
Hello Daniel

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:

$uac_req(ouri)="sip:" + $var(asterisk_ip) + ":" + $var(asterisk_port);
....

$uac_req(ouri)="sip:" + $var(asterisk2_ip) + ":" + $var(asterisk2_port);
Interesting, it should work when changing the 'ruri' attribute as well. Can you send a sip trace with changed r-uri for the two requests that go to wrong destination?

Thanks,
Daniel


Thanks!

Alejandro Rios Peņa


DISCLAIMER: The opinions expressed are my own, and not necessarily those of my employer.





2011/4/8 Daniel-Constantin Mierla <miconda@gmail.com>
Hello,


On 4/8/11 12:28 AM, Alejandro Rios P. wrote:

Hi all,

I am testing the scenario described here: http://kb.asipto.com/asterisk:realtime:kamailio-3.1.x-asterisk-1.6.2-astdb

It works great with one instance of Asterisk, but now that I'm testing with two Asterisk instances to load balance, and I see a problem regarding the registration forwarding to the second Asterisk.

I tried adding a second "uac_req_send()" bellow the first one, but Kamailio only sends the first request and the REGISTER never gets to the second Asterisk:

# Forward REGISTER to Asterisk
route[REGFWD]  {
       if(!is_method("REGISTER"))
       {
               return;
       }
       $var(rip)  =  $sel(cfg_get.asterisk.bindip);
       $uac_req(method)="REGISTER";
       $uac_req(ruri)="sip:"  +  $var(rip)  +  ":"  +  $sel(cfg_get.asterisk.bindport);
       $uac_req(furi)="sip:"  +  $au+  "@"  +  $var(rip);
       $uac_req(turi)="sip:"  +  $au+  "@"  +  $var(rip);
       $uac_req(hdrs)="Contact:<sip:"  +  $au+  "@"
                               +  $sel(cfg_get.kamailio.bindip)
                               +  ":"  +  $sel(cfg_get.kamailio.bindport)  +  ">\r\n";
       if($sel(contact.expires)  !=  $null)
               $uac_req(hdrs)=  $uac_req(hdrs)  +  "Expires:"  +  $sel(contact.expires)  +  "\r\n";
       else
               $uac_req(hdrs)=  $uac_req(hdrs)  +  "Expires:"  +  $hdr(Expires)  +  "\r\n";
       uac_req_send();

        $uac_req(all) = null;

       $var(rip2)  =  $sel(cfg_get.asterisk2.bindip);
       $uac_req(method)="REGISTER";
       $uac_req(ruri)="sip:"  +  $var(rip2)  +  ":"  +  $sel(cfg_get.asterisk2.bindport);
       $uac_req(furi)="sip:"  +  $au+  "@"  +  $var(rip2);
       $uac_req(turi)="sip:"  +  $au+  "@"  +  $var(rip2);
       $uac_req(hdrs)="Contact:<sip:"  +  $au+  "@"
                               +  $sel(cfg_get.kamailio.bindip)
                               +  ":"  +  $sel(cfg_get.kamailio.bindport)  +  ">\r\n";
       if($sel(contact.expires)  !=  $null)
               $uac_req(hdrs)=  $uac_req(hdrs)  +  "Expires:"  +  $sel(contact.expires)  +  "\r\n";
       else
               $uac_req(hdrs)=  $uac_req(hdrs)  +  "Expires:"  +  $hdr(Expires)  +  "\r\n";
       uac_req_send();

}

I also tried appending another branch and sending the second  uac_req_send() from there, but it is not being sent.

How can I use uac_req_send() several times for the same request or in parallel?
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.

Do you get any error message in the syslog? Can you watch the traffic on all interfaces 'ngrep -d any -qt -W byline port 5060' ?

I see you assign '$uac_req(all) = null;', it should be '$uac_req(all) = $null;' - but I guess it was a copy&paste thing.

Cheers,
Daniel

--
Daniel-Constantin Mierla
http://www.asipto.com


_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://www.asipto.com