From 5ed074591b774baa20ca8aade7011d665b84f91c Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Tue, 10 Feb 2009 15:39:53 +0000 Subject: [PATCH] Merged revisions 174543 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r174543 | file | 2009-02-10 11:37:07 -0400 (Tue, 10 Feb 2009) | 6 lines Make the logic for inuse and inringing manipluation match that of 1.4. The old broken logic would reset the values back to 0 during certain scenarios causing the wrong state to be reported. (closes issue #14399) Reported by: caspy (issue #13238) Reported by: kowalma ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@174545 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index abe3785534..014ab271a7 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4803,9 +4803,11 @@ static int update_call_counter(struct sip_pvt *fup, int event) if (inuse) { sip_pvt_lock(fup); ao2_lock(p); - if ((*inuse > 0) && ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) { - (*inuse)--; - ast_clear_flag(&fup->flags[0], SIP_INC_COUNT); + if (*inuse > 0) { + if (ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) { + (*inuse)--; + ast_clear_flag(&fup->flags[0], SIP_INC_COUNT); + } } else { *inuse = 0; } @@ -4817,9 +4819,11 @@ static int update_call_counter(struct sip_pvt *fup, int event) if (inringing) { sip_pvt_lock(fup); ao2_lock(p); - if ((*inringing > 0)&& ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) { - (*inringing)--; - ast_clear_flag(&fup->flags[0], SIP_INC_RINGING); + if (*inringing > 0) { + if (ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) { + (*inringing)--; + ast_clear_flag(&fup->flags[0], SIP_INC_RINGING); + } } else { *inringing = 0; }