SIP Contact Header Behind NAT

According to the sip config file:
# Indicate if the server is behind NAT. If so, the server will use STUN
# to guess its own public IP address and use it in the Contact header of
# outgoing requests
behind_nat = true

We find that the contact header in the SIP INVITE uses the local address of the Janus server not the public address determined from STUN. Are we doing this wrong? How can we get Janus to insert the public address in the contact header.

That’s something Sofia SIP is supposed to do on its own, see the “NAT, Firewall and Outbound Support” section in their documentation.

1 Like

As per nua documentation shared by @lorenzo, the natify stuff works only if registration is done. The janus sip plugin skips registration in case of guest or helper sessions, so it won’t work in those cases

The doc also says if application specifies contact header of their own, nua will just respect it.

If the application provides nua with a Contact header of its own (or includes a SIPTAG_CONTACT(NULL) tag in nua_register() tags), the outbound protocol engine is not started. It is assumed that the application knows better what it is doing when it sets the Contact, or it is using experimental CPL upload as specified in draft-lennox-sip-reg-payload-01.txt.

I’m not sure if Janus sip plugin allows this but it can be a way to solve this problem. In other words, have a config and propagate that to contact header in INVITE requests. @lorenzo appreciate your thoughts.