diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_chanspy.c | 27 | ||||
-rw-r--r-- | apps/app_mixmonitor.c | 24 | ||||
-rw-r--r-- | apps/app_queue.c | 8 |
3 files changed, 18 insertions, 41 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 90a8574dd..fe71bbef1 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -131,7 +131,7 @@ static struct ast_channel *local_get_channel_begin_name(char *name) ast_mutex_lock(&modlock); chan = local_channel_walk(NULL); while (chan) { - if (!strncmp(chan->name, name, strlen(name))) { + if (!strncmp(chan->name, name, strlen(name)) && strncmp(chan->name, "Zap/pseudo", 10)) { ret = chan; break; } @@ -207,21 +207,6 @@ static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, s return res; } -static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy) -{ - /* If our status has changed to DONE, then the channel we're spying on is gone.... - DON'T TOUCH IT!!! RUN AWAY!!! */ - if (spy->status == CHANSPY_DONE) - return; - - if (!chan) - return; - - ast_mutex_lock(&chan->lock); - ast_channel_spy_remove(chan, spy); - ast_mutex_unlock(&chan->lock); -}; - /* Map 'volume' levels from -4 through +4 into decibel (dB) settings for channel drivers */ @@ -338,7 +323,13 @@ static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int } } ast_deactivate_generator(chan); - stop_spying(spyee, &csth.spy); + + if (csth.spy.chan) { + csth.spy.status = CHANSPY_DONE; + ast_mutex_lock(&csth.spy.chan->lock); + ast_channel_spy_remove(csth.spy.chan, &csth.spy); + ast_mutex_unlock(&csth.spy.chan->lock); + } if (option_verbose >= 2) { ast_verbose(VERBOSE_PREFIX_2 "Done Spying on channel %s\n", name); @@ -347,7 +338,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int running = 0; } - ast_mutex_destroy(&csth.spy.lock); + ast_channel_spy_free(&csth.spy); return running; } diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index fa4716df0..caff40181 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -109,23 +109,6 @@ AST_APP_OPTIONS(mixmonitor_opts, { AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME), }); -static void stopmon(struct ast_channel_spy *spy) -{ - struct ast_channel *chan = spy->chan; - - /* If our status has changed to DONE, then the channel we're spying on is gone.... - DON'T TOUCH IT!!! RUN AWAY!!! */ - if (spy->status == CHANSPY_DONE) - return; - - if (!chan) - return; - - ast_mutex_lock(&chan->lock); - ast_channel_spy_remove(chan, spy); - ast_mutex_unlock(&chan->lock); -} - static int startmon(struct ast_channel *chan, struct ast_channel_spy *spy) { struct ast_channel *peer; @@ -164,9 +147,8 @@ static void *mixmonitor_thread(void *obj) ast_channel_spy_trigger_wait(&mixmonitor->spy); - if (!mixmonitor->spy.chan || mixmonitor->spy.status != CHANSPY_RUNNING) { + if (!mixmonitor->spy.chan || mixmonitor->spy.status != CHANSPY_RUNNING) break; - } while (1) { if (!(f = ast_channel_spy_read_frame(&mixmonitor->spy, SAMPLES_PER_FRAME))) @@ -189,7 +171,7 @@ static void *mixmonitor_thread(void *obj) ast_mutex_unlock(&mixmonitor->spy.lock); - stopmon(&mixmonitor->spy); + ast_channel_spy_free(&mixmonitor->spy); if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_2 "End MixMonitor Recording %s\n", mixmonitor->name); @@ -199,8 +181,6 @@ static void *mixmonitor_thread(void *obj) ast_verbose(VERBOSE_PREFIX_2 "Executing [%s]\n", mixmonitor->post_process); ast_safe_system(mixmonitor->post_process); } - - ast_mutex_destroy(&mixmonitor->spy.lock); ast_closestream(mixmonitor->fs); diff --git a/apps/app_queue.c b/apps/app_queue.c index 84fb751b1..d3071a819 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -777,7 +777,7 @@ static void queue_set_param(struct call_queue *q, const char *param, const char q->periodicannouncefrequency = atoi(val); } else if (!strcasecmp(param, "retry")) { q->retry = atoi(val); - if (q->retry < 0) + if (q->retry <= 0) q->retry = DEFAULT_RETRY; } else if (!strcasecmp(param, "wrapuptime")) { q->wrapuptime = atoi(val); @@ -1518,6 +1518,11 @@ static int ring_entry(struct queue_ent *qe, struct localuser *tmp, int *busies) ast_cdr_busy(qe->chan->cdr); tmp->stillgoing = 0; update_dial_status(qe->parent, tmp->member, status); + + ast_mutex_lock(&qe->parent->lock); + qe->parent->rrpos++; + ast_mutex_unlock(&qe->parent->lock); + (*busies)++; return 0; } else if (status != tmp->oldstatus) @@ -1824,6 +1829,7 @@ static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser o->stillgoing = 0; numnochan++; } else { + ast_channel_inherit_variables(in, o->chan); if (o->chan->cid.cid_num) free(o->chan->cid.cid_num); o->chan->cid.cid_num = NULL; |