From 9f694d888eb170d91dc457335b21f93b0974104c Mon Sep 17 00:00:00 2001 From: Kevin Harwell <kharwell@digium.com> Date: Tue, 27 Jan 2015 19:19:25 +0000 Subject: [PATCH] chan_sip: stale nonce causes failure 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 if searches for an existing "dialog" matching only on the callid. If the expires value is low enough it will reuse dialog that is there, otherwise it will create a new one. ASTERISK-24715 #close Reported by: John Bigelow Review: https://reviewboard.asterisk.org/r/4367/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431187 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d3fd37045d..73b7eeb416 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9047,7 +9047,8 @@ static struct sip_pvt *find_call(struct sip_request *req, struct ast_sockaddr *a } } - if (!sip_cfg.pedanticsipchecking) { + /* match on callid only for REGISTERs */ + if (!sip_cfg.pedanticsipchecking || req->method == SIP_REGISTER) { struct sip_pvt tmp_dialog = { .callid = callid, }; -- GitLab