[SR-Users] NAT helper frustrations with multiple kamailios

Klaus Darilion klaus.mailinglists at pernau.at
Wed Feb 5 19:04:25 CET 2014

On 05.02.2014 11:20, Daniel Tryba wrote:
> The problem I have with add_contact_alias/handle_ruri_alias is that any
> kamailio in the path will parse these hints whether or not it is actually ment
> for that kamailio.

handle_ruri_alias should only be used by the last proxy in the chain, 
thus by the proxy which does forwarding based on the RURI, not on Router 
headers. This is actually what the default config does:

# URI update for dialog requests
802 route[DLGURI] {
803 #!ifdef WITH_NAT
804         if(!isdsturiset()) {
805                 handle_ruri_alias();
806         }
807 #!endif
808         return;
809 }

loose_route() will no set the dest-uri if it is the last proxy in the chain.

If you do not use record-routing, but some static routing, then you have 
to implement a different logic.

btw: unless you need to save bandwith on media relays you can skip the 
uac_nat_tests and always* add_contact_alias()

*of course always only on the first proxy which receives the request 
(request or response). With requests it is easy: There must be only 1 
Via header. For responses it is more difficult - thus you need some 
manual logic, for example: if you send to an external domain, than the 
external domain must do the NAT traversal, if you send the request 
within you local domain, then the proxy should have proper knowledge if 
the request is sent to a SIP client, or some other proxy.


More information about the sr-users mailing list