[asterisk-dev] SIP replies to via or to ip/port (according to RFC)

Olle E. Johansson oej at edvina.net
Thu Dec 17 01:20:45 CST 2009

We have a very old bug report that we need to resolve. 

Asterisk currently send SIP responses to the address in the address in the last VIA header in the SIP message received. If NAT support is turned on, we reply to the sender's IP and port.

In the RFC, it's very clear that a user agent ALWAYS should respond to the sender's IP and port. I think that one of the reasons is that a via header might contain a DNS name that points to several servers. If the user agent selects another server to send the respons to than the server that sent the request, the transaction in that server (if it's stateful) fails and we get retransmits and things get crazy. Luckily, that's not very common.

I suggest we take a final stab at resolving this bug report like this:

- We add a setting "replytovia" with yes | no
- We set it default to yes in the code and sample config for all releases (1.4, 1.6.x)
- We set it to no in the code and sample config for trunk

This way, we won't disturb current installs and will make it optional to follow the RFC in these versions. In trunk, we follow the RFC and make it optional (like in Kamailio) to not follow the RFC.

If we can reach consensus about this way forward, I can fix this.


More information about the asterisk-dev mailing list