Thanks for the replies Daniel and Henning!
The problem with the listen address is that it can't be set at run time per call, for example, after reading the value from the DB.... And also it is way too dirty to use the set_advertised_address with a static string value....
Long story short, we have a weird telco setup which only allows the SIP trunk to terminate in their own network, which then puts my Kamailio behind a NAT box only for them. And because they are the biggest carrier in that country, we will have to workaround the issue.....
Kamailio itself has only one network interface to communicate with everyone (other provider and extensions), so I was trying to actually only set the advertise address before sending call to this specific telco. For calls to anyone else I would not set the advertise address. Looks simple, but seems not that easy to implement.....
Cheers,
Patrick Wakano