From cea50c92472a957e79e1539095516a65aaf63ffb Mon Sep 17 00:00:00 2001 From: BJ Weschke Date: Sun, 22 Jan 2006 15:13:41 +0000 Subject: [PATCH] Bug fix: Correct some scenarios where CALL_LIMIT could not be getting adjusted properly allowing chan_sip to send calls when it really shouldn't. Bug #6111 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@8433 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 66c6320cf9..6500d90c00 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -560,6 +560,8 @@ 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_FLAGS_TO_COPY \ (SIP_PROMISCREDIR | SIP_TRUSTRPID | SIP_SENDRPID | SIP_DTMF | SIP_REINVITE | \ @@ -2224,7 +2226,8 @@ 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 ) { - (*inuse)--; + if (ast_test_flag(fup,SIP_INC_COUNT)) + (*inuse)--; } else { *inuse = 0; } @@ -2244,6 +2247,7 @@ static int update_call_counter(struct sip_pvt *fup, int event) } } (*inuse)++; + ast_set_flag(fup,SIP_INC_COUNT); if (option_debug > 1 || sipdebug) { ast_log(LOG_DEBUG, "Call %s %s '%s' is %d out of %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *inuse, *call_limit); }