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