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;
/* 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;
}