Hello Daniel,

> yes, if you partitioned the users and you know by first digit where it should be registered, then all is fine -- update > the r-uri and then you can relay to the other server.

I do it (update the $ur with the right destination IP) for all calls (INVITEs). If a SIP client registered on Kamailio1 calls a client registered on Kamailio2 then it functions. If an other client calls through an Asterisk (which is registered on Kamailio) then it doesn't function! Kamailio1 doesn't forward INVITE to Kamailio2, Asterisk gets 'Busy'!
Please see my test cases bellow: 3 of them function, 1 of them doesn't function!

Asterisk obviously doesn't send some part of the INVITE message which is needed to call another Kamailio.

Can you give me some advise how to solve it? Which other variable should be set to relay the INVITE to the 2nd Kamailio?

Thank you
Regards
Marko



From: Daniel-Constantin Mierla <miconda@gmail.com>
To: Marko Tirs <marko.tirs@yahoo.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Sent: Wednesday, June 14, 2017 10:43 AM
Subject: Re: [SR-Users] Kamailio+Asterisk - Kamailio doesn't forward INVITE to 2nd Kamailio

Hello,

On 13.06.17 14:35, Marko Tirs wrote:
Hi all,

I have here:
Kamailio 1: 192.168.0.11
Kamailio 2: 192.168.0.21
Asterisk 1: 192.168.0.12

Asterisk1 is registered on Kamailio1 as User 100. Asterisk1 shouldn't be registered on Kamailio2.

User 111 registered on Kamailio1
User 211 registered on Kamailio2
User 121 registered on Asterisk1

Test cases:
---------------------
111 calls 211 - OK
211 calls 111 - OK
121 calls 111 - OK
121 calls 211 - Kamailio1 doesn't forward INVITE to Kamailio2, Asterisk gets 'Busy' !?


Is the approach just to replace destination IP-address in $ru, depending from 1st digit, right?

yes, if you partitioned the users and you know by first digit where it should be registered, then all is fine -- update the r-uri and then you can relay to the other server.

Cheers,
Daniel



If not, what is the right approach to reach the remote users from Asterisk, which are registered on remote Kamailio and not on the local Kamailio?

Thank you
Regards
Marko


My changes in kamailio.cfg in both kamailios (based on kamailio-basic.cfg) :
--------------------------------------------------------------------------------------------------------------
kamailio1.bindip = "192.168.0.11"
kamailio2.bindip = "192.168.0.21"
...
route {
    if (is_method("INVITE")) {
        if($rU=~"^1[0-9][0-9]$") {
            $ru = "sip:" + $rU + "@" + $sel(cfg_get.kamailio1.bindip) + ":5060";
        }
        else if($rU=~"^2[0-9][0-9]$") {
            $ru = "sip:" + $rU + "@" + $sel(cfg_get.kamailio2.bindip) + ":5060";
        }
    }
...

sip.conf in Asterisk1:
----------------------------------
register => 100:abc@192.168.0.124:5060/100

[100]
type=friend
host=192.168.0.11
secret=abc
context=kamailio

[121]
type=friend
secret=abc
host=dynamic
context=kamailio

extensions.conf
-------------------------------
[kamailio]
exten => _[1-4]XX,1,Dial(SIP/100/${EXTEN},30)
exten => _[1-4]XX,n,Hangup()





_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com