]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
- Clean INC_COUNT flag when we decrement call counter
authorOlle Johansson <oej@edvina.net>
Thu, 1 Feb 2007 21:05:34 +0000 (21:05 +0000)
committerOlle Johansson <oej@edvina.net>
Thu, 1 Feb 2007 21:05:34 +0000 (21:05 +0000)
- If it's still set at time of dialog destruction, make sure we decrement the device call counter properly
  before we destroy the dialog

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

channels/chan_sip.c

index aa76a18c36b6efbdc2c0fb426ce2676f5b4f5101..127b2c3260a5ddc47c0250f3f60787453efa6011 100644 (file)
@@ -2885,6 +2885,12 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
        if (sip_debug_test_pvt(p) || option_debug > 2)
                ast_verbose("Really destroying SIP dialog '%s' Method: %s\n", p->callid, sip_methods[p->method].text);
 
+       if (ast_test_flag(&p->flags[0], SIP_INC_COUNT)) {
+               update_call_counter(p, DEC_CALL_LIMIT);
+               if (option_debug > 1)
+                       ast_log(LOG_DEBUG, "This call did not properly clean up call limits. Call ID %s\n", p->callid);
+       }
+
        /* Remove link from peer to subscription of MWI */
        if (p->relatedpeer && p->relatedpeer->mwipvt)
                p->relatedpeer->mwipvt = NULL;
@@ -3020,8 +3026,10 @@ static int update_call_counter(struct sip_pvt *fup, int event)
        /* incoming and outgoing affects the inUse counter */
        case DEC_CALL_LIMIT:
                if ( *inuse > 0 ) {
-                       if (ast_test_flag(&fup->flags[0], SIP_INC_COUNT))
+                       if (ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) {
                                (*inuse)--;
+                               ast_clear_flag(&fup->flags[0], SIP_INC_COUNT);
+                       }
                } else {
                        *inuse = 0;
                }