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