Make the logic for inuse and inringing manipluation match that of 1.4. The old broken...
authorJoshua Colp <jcolp@digium.com>
Tue, 10 Feb 2009 15:37:07 +0000 (15:37 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 10 Feb 2009 15:37:07 +0000 (15:37 +0000)
(closes issue #14399)
Reported by: caspy
(issue #13238)
Reported by: kowalma

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174543 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index bfec672..8d2b8ba 100644 (file)
@@ -5230,9 +5230,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;
                        }
@@ -5244,9 +5246,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;
                        }