diff options
author | Mark Michelson <mmichelson@digium.com> | 2008-10-10 21:18:10 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2008-10-10 21:18:10 +0000 |
commit | 1d4bb1ce59e9ab013cf9f69912fb9121c4d9e239 (patch) | |
tree | 1444b31a32c2f41c963168e1b4d0b3a0183f4341 /channels/chan_sip.c | |
parent | 038b588ee898d078e049292bce908ec92d5adfb2 (diff) |
Make sure that the inUse and inRinging fields for
a sip peer cannot go below zero. This is a regression
from 1.4 and so it will be applied to 1.6.0 as well.
(closes issue #13668)
Reported by: mjc
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148373 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8b3f02527..e1926eeae 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4742,13 +4742,13 @@ static int update_call_counter(struct sip_pvt *fup, int event) /* incoming and outgoing affects the inUse counter */ case DEC_CALL_LIMIT: /* Decrement inuse count if applicable */ - if (inuse && ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) { + if (inuse && *inuse > 0 && ast_test_flag(&fup->flags[0], SIP_INC_COUNT)) { ast_atomic_fetchadd_int(inuse, -1); ast_clear_flag(&fup->flags[0], SIP_INC_COUNT); } else *inuse = 0; /* Decrement ringing count if applicable */ - if (inringing && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) { + if (inringing && *inringing > 0 && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) { ast_atomic_fetchadd_int(inringing, -1); ast_clear_flag(&fup->flags[0], SIP_INC_RINGING); } @@ -4786,7 +4786,7 @@ static int update_call_counter(struct sip_pvt *fup, int event) break; case DEC_CALL_RINGING: - if (inringing && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) { + if (inringing && *inringing > 0 && ast_test_flag(&fup->flags[0], SIP_INC_RINGING)) { ast_atomic_fetchadd_int(inringing, -1); ast_clear_flag(&fup->flags[0], SIP_INC_RINGING); } |