]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
- Make sure we release call from call counter before we destroy call (maybe #7744...
authorOlle Johansson <oej@edvina.net>
Thu, 1 Feb 2007 21:12:52 +0000 (21:12 +0000)
committerOlle Johansson <oej@edvina.net>
Thu, 1 Feb 2007 21:12:52 +0000 (21:12 +0000)
- Backported by accident from 1.4

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

channels/chan_sip.c

index 5e1613275791d867d6ea9035bc85479834c8ad59..a60f3ee834237f6f0a9bf99aa9ae9e22182ef663 100644 (file)
@@ -567,8 +567,7 @@ struct sip_auth {
 #define SIP_CALL_LIMIT         (1 << 29)
 /* Remote Party-ID Support */
 #define SIP_SENDRPID           (1 << 30)
-/* Did this connection increment the counter of in-use calls? */
-#define SIP_INC_COUNT (1 << 31)
+#define SIP_INC_COUNT          (1 << 31)       /* Did this connection increment the counter of in-use calls? */
 
 #define SIP_FLAGS_TO_COPY \
        (SIP_PROMISCREDIR | SIP_TRUSTRPID | SIP_SENDRPID | SIP_DTMF | SIP_REINVITE | \
@@ -2123,6 +2122,12 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
        if (sip_debug_test_pvt(p))
                ast_verbose("Destroying call '%s'\n", p->callid);
 
+       if (ast_test_flag(p, SIP_INC_COUNT)) {
+               update_call_counter(p, DEC_CALL_LIMIT);
+               if (option_debug)
+                       ast_log(LOG_DEBUG, "Call did not properly clean up call counter. Call ID %s\n", p->callid);
+       }
+
        if (dumphistory)
                sip_dump_history(p);
 
@@ -2249,8 +2254,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,SIP_INC_COUNT))
+                               if (ast_test_flag(fup, SIP_INC_COUNT)) {
                                         (*inuse)--;
+                                       ast_clear_flag(fup, SIP_INC_COUNT);
+                               }
                        } else {
                                *inuse = 0;
                        }