From: Jeff Peeler Date: Wed, 7 Oct 2009 20:08:14 +0000 (+0000) Subject: Change ringt (ring timeout) styles to be consistent across chan_dahdi. X-Git-Tag: 11.0.0-beta1~4067 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4ae6bee6daf578b96aaff95b284d80b48194bd68;p=thirdparty%2Fasterisk.git Change ringt (ring timeout) styles to be consistent across chan_dahdi. (closes issue #15684) Reported by: alecdavis Patches: chan_dahdi.bug15684.diff2.txt uploaded by alecdavis (license 585) Tested by: alecdavis git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@222652 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index df46654291..f360899fdd 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -1638,11 +1638,11 @@ static int my_get_callerid(void *pvt, char *namebuf, char *numbuf, enum analog_e } } - if (analog_p->ringt) { - analog_p->ringt--; - } - if (analog_p->ringt == 1) { - return -1; + if (analog_p->ringt > 0) { + if (!(--analog_p->ringt)) { + /* only return if we timeout from a ring event */ + return -1; + } } if (p->cid_signalling == CID_SIG_V23_JP) { @@ -1742,11 +1742,11 @@ static int my_distinctive_ring(struct ast_channel *chan, void *pvt, int idx, int } break; } - if (analog_p->ringt) - analog_p->ringt--; - if (analog_p->ringt == 1) { - res = -1; - break; + if (analog_p->ringt > 0) { + if (!(--analog_p->ringt)) { + res = -1; + break; + } } } } @@ -7713,12 +7713,12 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) ast_mutex_unlock(&p->lock); return &p->subs[idx].f; } - if (p->ringt == 1) { - ast_mutex_unlock(&p->lock); - return NULL; + if (p->ringt > 0) { + if (!(--p->ringt)) { + ast_mutex_unlock(&p->lock); + return NULL; + } } - else if (p->ringt > 0) - p->ringt--; #ifdef HAVE_OPENR2 if (p->mfcr2) { @@ -9291,11 +9291,11 @@ static void *analog_ss_thread(void *data) } break; } - if (p->ringt) - p->ringt--; - if (p->ringt == 1) { - res = -1; - break; + if (p->ringt > 0) { + if (!(--p->ringt)) { + res = -1; + break; + } } } } @@ -9448,12 +9448,11 @@ static void *analog_ss_thread(void *data) } break; } - if (p->ringt) { - p->ringt--; - } - if (p->ringt == 1) { - res = -1; - break; + if (p->ringt > 0) { + if (!(--p->ringt)) { + res = -1; + break; + } } samples += res; res = callerid_feed(cs, buf, res, AST_LAW(p)); @@ -9510,11 +9509,11 @@ static void *analog_ss_thread(void *data) } break; } - if (p->ringt) - p->ringt--; - if (p->ringt == 1) { - res = -1; - break; + if (p->ringt > 0) { + if (!(--p->ringt)) { + res = -1; + break; + } } } }