Hello! I wish everyone who reads this message a good day.
I would appreciate some guidance with the configuration of my Kamailio.
Initially, I have the following architecture:
Endpoints <----Public IP----> Kamailio (listen PrivateIP advertise PublicIP) <----Private IP----> Asterisk
CONFIG:
https://gist.github.com/Carlos-Escalona94/3a289af05b05c69ae563ab29c9ec4710In general, calls initiated from outside the system work perfectly, but I have a problem with calls initiated from Asterisk.
According to what I was able to investigate and understand, the problem arises from the fact that Kamailio uses the public IP for the entire routing system that involves the Record-Route and Route Headers. This in turn causes Asterisk to get lost trying to send messages outside of the INITIAL INVITE transaction, for example, the ACK response to the 200 Ok received from the Endpoint since it tries to use Kamailio's public IP to which Asterisk doesn't have access.
I tried to force Asterisk to send all messages to Kamailio's private IP regardless of their nature, but it doesn't seem like an appropriate solution.
On the other hand, I tried to modify the architecture a bit so that it was something similar to this:
Endpoints <---- Public IP----> Kamailio (listen PrivateIP:P1 advertise PublicIP) <---- PrivateIP-----> Kamailio (listen PrivateIP:P2) <---- PrivateIP ----> Asterisk
CONFIG:
https://gist.github.com/Carlos-Escalona94/4d681bb189c6190941d291965e123889It seems to me that this would solve the problem, but I have two doubts about this architecture, the first is that I would like to know if there is an easier way to solve the problem that I am not considering, and on the other hand, I have not found a way to identify from which interface is receiving the message to perform the routing properly.
Thanks for the attention.