Review Board 1.7.16

chan_sip: stale nonce causes failure

Review Request #4367 - Created Jan. 23, 2015 and submitted

Kevin Harwell
When refreshing (with a small expiration) a registration that was sent to chan_sip the nonce would be considered stale and reject the registration. What was happening was that the initial registration's "dialog" still existed in the dialogs container and upon refresh the dialog match algorithm would choose that as the "dialog" instead of the newly created one. This occurred because the algorithm did not check to see if the from tag matched if authentication info was available after the 401. So, it ended up assuming the original "dialog" was a match and stopped the search. The old "dialog" of course had an old nonce, thus the stale nonce message.

This fix attempts to leave the original functionality alone except in the case of a REGISTER. If a REGISTER is received then the from tag is always checked thus allowing the correct "dialog" to be selected.
Setup two asterisk systems, one to register and one to accept registers. Specified a small expiration in the configuration file and then watched as the primary system registered successfully to the secondary system.  Then upon refresh saw the notice message and received a registration rejection message. Applied the fix and the problem no longer occurred.
Review request changed
Updated (Jan. 27, 2015, 2:22 p.m.)
  • changed from pending to submitted
Committed in revision 431215 runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to