Just to add, if you want to get even more flexibility by supporting also different failover levels/domains, you can decide to use different carrier per trunk group.

 

Henning

 

From: Henning Westerholt
Sent: Friday, July 12, 2024 1:49 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Sergio Charrua <sergio.charrua@voip.pt>
Subject: RE: [SR-Users] routing call depending on which IP address SIP message reached Kamailio

 

Hello,

 

of course there are many ways how to do it. One thing that comes into my mind is to use the carrierroute module, which supports different “domains” or levels inside the tree to differentiate between different (trunk) groups.

 

Like use routing tree level 1 for trunk group 1, 2 for trunk group 2 and so on.

 

Cheers,

 

Henning

 

--

Henning Westerholt – https://skalatan.de/blog/

Kamailio services – https://gilawa.com

 

From: Sergio Charrua via sr-users <sr-users@lists.kamailio.org>
Sent: Friday, July 12, 2024 1:20 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Sergio Charrua <sergio.charrua@voip.pt>
Subject: [SR-Users] routing call depending on which IP address SIP message reached Kamailio

 

Hi all!

 

For a project under development, one requirement is to be able to forward/relay the call to a specific destination depending on which IP Address and Port the call was received by Kamailio. 

This also means that Kamailio will be listening on multiple IP Address and Ports

listen=udp:IP_1:port_1  # trunkgroup 1

listen=udp:IP_2:port_2  # trunkgroup 2

listen=udp:IP_3:port_3  # trunkgroup 3

 

I know the pv $Ri and $Rp can be used to identify from which IP address and port the message reached Kamailio and having those details, depending on the value, I can define some conditions that allows Kamailio to relay the call to different destination endpoints.

For example: 

- calls from +32 to + 39 received on trunkgroup1 needs to go to Italy SBC address  A.B.C.D

- but calls from +32 to +39 received on trunkgroup2 need to go to Germany on SBC address 1.2.3.4 (as it is cheaper)

 

Is there a better way of doing this without using IF/THEN/ELSE or SWITCH blocks and "hard code" destination SBC addresses? 

I have read the DRouting module's documentation but not sure if it could help and how...

 

Any suggestions? 

 

 


Atenciosamente / Kind Regards / Cordialement,

 

Sérgio