[asterisk-commits] rmudgett: branch 1.8 r369043 - /branches/1.8/main/features.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 18 13:07:40 CDT 2012
Author: rmudgett
Date: Mon Jun 18 13:07:35 2012
New Revision: 369043
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369043
Log:
Fix monitoring calls put in a parking lot.
* Fix a regression that was introduced by -r366167 which effectively
disabled monitoring parked calls.
(closes issue ASTERISK-20012)
Reported by: sdolloff
Tested by: rmudgett
Modified:
branches/1.8/main/features.c
Modified: branches/1.8/main/features.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/features.c?view=diff&rev=369043&r1=369042&r2=369043
==============================================================================
--- branches/1.8/main/features.c (original)
+++ branches/1.8/main/features.c Mon Jun 18 13:07:35 2012
@@ -4604,7 +4604,6 @@
struct ast_channel *chan = pu->chan; /* shorthand */
int tms; /* timeout for this item */
int x; /* fd index in channel */
- int parking_complete = 0;
tms = ast_tvdiff_ms(ast_tvnow(), pu->start);
if (tms > pu->parkingtime) {
@@ -4719,104 +4718,103 @@
}
/* And take them out of the parking lot */
- parking_complete = 1;
- } else { /* still within parking time, process descriptors */
- x = 0;
- if (pfds) {
- for (; x < AST_MAX_FDS; x++) {
- struct ast_frame *f;
- int y;
-
- if (chan->fds[x] == -1) {
- continue; /* nothing on this descriptor */
+ return 1;
+ }
+
+ /* still within parking time, process descriptors */
+ if (pfds) {
+ for (x = 0; x < AST_MAX_FDS; x++) {
+ struct ast_frame *f;
+ int y;
+
+ if (chan->fds[x] == -1) {
+ continue; /* nothing on this descriptor */
+ }
+
+ for (y = 0; y < nfds; y++) {
+ if (pfds[y].fd == chan->fds[x]) {
+ /* Found poll record! */
+ break;
}
-
- for (y = 0; y < nfds; y++) {
- if (pfds[y].fd == chan->fds[x]) {
- /* Found poll record! */
- break;
- }
+ }
+ if (y == nfds) {
+ /* Not found */
+ continue;
+ }
+
+ if (!(pfds[y].revents & (POLLIN | POLLERR | POLLPRI))) {
+ /* Next x */
+ continue;
+ }
+
+ if (pfds[y].revents & POLLPRI) {
+ ast_set_flag(chan, AST_FLAG_EXCEPTION);
+ } else {
+ ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ }
+ chan->fdno = x;
+
+ /* See if they need servicing */
+ f = ast_read(pu->chan);
+ /* Hangup? */
+ if (!f || (f->frametype == AST_FRAME_CONTROL
+ && f->subclass.integer == AST_CONTROL_HANGUP)) {
+ if (f) {
+ ast_frfree(f);
}
- if (y == nfds) {
- /* Not found */
- continue;
+ post_manager_event("ParkedCallGiveUp", pu);
+ ast_cel_report_event(pu->chan, AST_CEL_PARK_END, NULL, "ParkedCallGiveUp",
+ NULL);
+
+ /* There's a problem, hang them up */
+ ast_verb(2, "%s got tired of being parked\n", chan->name);
+ ast_hangup(chan);
+
+ /* And take them out of the parking lot */
+ return 1;
+ } else {
+ /* XXX Maybe we could do something with packets, like dial "0" for operator or something XXX */
+ ast_frfree(f);
+ if (pu->hold_method == AST_CONTROL_HOLD
+ && pu->moh_trys < 3
+ && !chan->generatordata) {
+ ast_debug(1,
+ "MOH on parked call stopped by outside source. Restarting on channel %s.\n",
+ chan->name);
+ ast_indicate_data(chan, AST_CONTROL_HOLD,
+ S_OR(pu->parkinglot->cfg.mohclass, NULL),
+ (!ast_strlen_zero(pu->parkinglot->cfg.mohclass)
+ ? strlen(pu->parkinglot->cfg.mohclass) + 1 : 0));
+ pu->moh_trys++;
}
-
- if (!(pfds[y].revents & (POLLIN | POLLERR | POLLPRI))) {
- /* Next x */
- continue;
- }
-
- if (pfds[y].revents & POLLPRI) {
- ast_set_flag(chan, AST_FLAG_EXCEPTION);
- } else {
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
- }
- chan->fdno = x;
-
- /* See if they need servicing */
- f = ast_read(pu->chan);
- /* Hangup? */
- if (!f || (f->frametype == AST_FRAME_CONTROL
- && f->subclass.integer == AST_CONTROL_HANGUP)) {
- if (f) {
- ast_frfree(f);
- }
- post_manager_event("ParkedCallGiveUp", pu);
- ast_cel_report_event(pu->chan, AST_CEL_PARK_END, NULL, "ParkedCallGiveUp",
- NULL);
-
- /* There's a problem, hang them up */
- ast_verb(2, "%s got tired of being parked\n", chan->name);
- ast_hangup(chan);
-
- /* And take them out of the parking lot */
- parking_complete = 1;
- break;
- } else {
- /* XXX Maybe we could do something with packets, like dial "0" for operator or something XXX */
- ast_frfree(f);
- if (pu->hold_method == AST_CONTROL_HOLD
- && pu->moh_trys < 3
- && !chan->generatordata) {
- ast_debug(1,
- "MOH on parked call stopped by outside source. Restarting on channel %s.\n",
- chan->name);
- ast_indicate_data(chan, AST_CONTROL_HOLD,
- S_OR(pu->parkinglot->cfg.mohclass, NULL),
- (!ast_strlen_zero(pu->parkinglot->cfg.mohclass)
- ? strlen(pu->parkinglot->cfg.mohclass) + 1 : 0));
- pu->moh_trys++;
- }
- goto std; /* XXX Ick: jumping into an else statement??? XXX */
- }
- } /* End for */
- }
- if (x >= AST_MAX_FDS) {
-std:
- for (x = 0; x < AST_MAX_FDS; x++) { /* mark fds for next round */
- if (chan->fds[x] > -1) {
- void *tmp = ast_realloc(*new_pfds,
- (*new_nfds + 1) * sizeof(struct pollfd));
-
- if (!tmp) {
- continue;
- }
- *new_pfds = tmp;
- (*new_pfds)[*new_nfds].fd = chan->fds[x];
- (*new_pfds)[*new_nfds].events = POLLIN | POLLERR | POLLPRI;
- (*new_pfds)[*new_nfds].revents = 0;
- (*new_nfds)++;
- }
- }
- /* Keep track of our shortest wait */
- if (tms < *ms || *ms < 0) {
- *ms = tms;
- }
- }
- }
-
- return parking_complete;
+ break;
+ }
+ } /* End for */
+ }
+
+ /* mark fds for next round */
+ for (x = 0; x < AST_MAX_FDS; x++) {
+ if (chan->fds[x] > -1) {
+ void *tmp = ast_realloc(*new_pfds,
+ (*new_nfds + 1) * sizeof(struct pollfd));
+
+ if (!tmp) {
+ continue;
+ }
+ *new_pfds = tmp;
+ (*new_pfds)[*new_nfds].fd = chan->fds[x];
+ (*new_pfds)[*new_nfds].events = POLLIN | POLLERR | POLLPRI;
+ (*new_pfds)[*new_nfds].revents = 0;
+ (*new_nfds)++;
+ }
+ }
+ /* Keep track of our shortest wait */
+ if (tms < *ms || *ms < 0) {
+ *ms = tms;
+ }
+
+ /* Stay in the parking lot. */
+ return 0;
}
/*! \brief Run management on parkinglots, called once per parkinglot */
More information about the asterisk-commits
mailing list