[SR-Users] How to configure Kamailio + Asterisk (on same server) to route between several disjoint networks?

Klaus Darilion klaus.mailinglists at pernau.at
Sat Mar 1 17:54:52 CET 2014


Am 27.02.2014 23:43, schrieb Alex Villací­s Lasso:
> Is this setup recognizable as an already-solved problem (minus the 
> localhost trick)? How is it done correctly? 
I think your setup is too complex. If I didn't missed your requirements 
I think you can do it this way:

 From routing point of view, you could do the setup with Asterisk, 
without KAmailio. IF you need Kamailio too (for whatever features) then 
what about this:



                      | Server                             |
                      |                                    |
client1---net1-------| IP1:5060 Kamailio |<-------\
                      | |         \
client2---net2-------| IP2:5060 Kamailio |<--\     |
                      |                                    |   / /
                      | 0.0.0.0:5070 Asterisk |<-------
                      | 0.0.0.0:10000-20000: Asterisk RTP  |


Block port 5070 from outside with iptables, so clients are forced 
through Kamailio. For the communication between Asterisk and Kamailio 
use the same socket as for the communication with the clients and 
Kamailio, eg:


client1-IP ------- IP1:5060 --- Kamailio ---- IP1:5060
                                                   |
IP1:5070 ----
                                                            \
                                                         Asterisk
                                                            /
                                               IP2:5070 ---
                                                   |
client2-IP ------- IP2:5060 --- Kamailio ---- IP2:5060



Asterisk usually uses the local routing table to find the IP address to 
put in the SDP. As the communication with client 1 is via Kamailio IP1 
and with client 2 via Kamailio IP2, Asterisk should populate the SDP 
correctly.

Further, if you configure Kamailio with mhomed=1 and forward to ASterisk 
always using the proper IP, e.g a request which is received on IP1:5060 
is forwarded to IP1:5070, then also the Route/Record-Route and Via 
headers should be populated correctly. For REGISTER routing I think it 
is best to use Path header (new Asterisks should support this).



regards
Klaus

PS: I have not tried it but I am quite sure it should work.



More information about the sr-users mailing list