Hello,

I've started playing with an idea to add multiple asterisk servers and using dispatcher to balance the sip load between them. I added the code according to dispatcher module documentation (http://www.kamailio.org/docs/modules/4.2.x/modules/dispatcher.html), but I think there's something off in my setup: 

kamctl ul output shows 2 AORs for one client: 

AOR:: 770@testers.com
Contact:: sip:770@2.2.2.2:64340;rinstance=c634da314e12385f;transport=UDP Q=
Expires:: 3221
Callid:: ZTE1MWYwYzM3NGNjNjMxMmEzM2JjYWNmNzQyZTdiNGI.
Cseq:: 2
User-agent:: Z 3.2.21357 r21367
State:: CS_SYNC
Flags:: 0
Cflag:: 0
Socket:: udp:1.1.1.1:5060
Methods:: 5087
Ruid:: uloc-53bfe447-35ae-2a2
Reg-Id:: 0
Last-Keepalive:: 1405174150
Last-Modified:: 1405174150
AOR:: 770@1.1.1.1
Contact:: sip:770@1.1.1.1:5070 Q=
Expires:: 68
Callid:: 327fcf07641f80006e962821112a61b5@testers.com
Cseq:: 754
User-agent:: Asterisk PBX 11.10.2
State:: CS_SYNC
Flags:: 0
Cflag:: 0
Socket:: udp:1.1.1.1:5060
Methods:: 4294967295
Ruid:: uloc-53bfe447-35af-a82
Reg-Id:: 0
Last-Keepalive:: 1405174477
Last-Modified:: 1405174477


I don't think I should be seeing an AOR for 770 where Contact is the public address of my server (here 1.1.1.1) and User-Agent which is Asterisk. 

I'm using Asterisk Realtime integration, and by what I can tell the sip messages are going nicely, client authenticates with Kamailio and sends this message to Asterisk (which is on the same machine; Kamailio at 5060 and Asterisk at 5070): 

1.1.1.1.sip > 1.1.1.1.vtsas: SIP, length: 374
        REGISTER sip:1.1.1.1:5070 SIP/2.0
        Via: SIP/2.0/UDP 1.1.1.1;branch=z9hG4bKbc8a.f4473947000000000000000000000000.0
        To: <sip:770@1.1.1.1>
        From: <sip:770@1.1.1.1>;tag=4a9c3f1c98b9f1c5704acfd1770d93d2-d0c1
        CSeq: 10 REGISTER
        Call-ID: 7ffa0191-13742@1.1.1.1
        Max-Forwards: 70
        Content-Length: 0
        Contact: <sip:770@1.1.1.1:5060>
        Expires: 3600


Currently I can make calls from 770 to 123 which is an Asterisk extension that answers, plays hello world and hangs up. However I can't call another sip clients when I route calls through Asterisk, they do work fine if I don't use Asterisk for handling calls, but I'd like Kamailio to be in the role of proxy/loadbalancer and Asterisk to handle calls. 

My config is the simple default config, added with realtime stuff and then dispatcher according to the documentation. I wonder if there's something wrong in the REGISTER that Kamailio sends to Asterisk, or maybe something else going wrong?

Has anyone seen results like this and do you spot something here that needs fixing? 

Thanks,
Olli