diff -Naur asterisk-cvs-pristine/apps/app_queue.c asterisk-cvs/apps/app_queue.c --- asterisk-cvs-pristine/apps/app_queue.c Mon Mar 21 12:28:06 2005 +++ asterisk-cvs/apps/app_queue.c Mon Mar 21 12:33:56 2005 @@ -538,14 +538,10 @@ res = ast_streamfile(chan, filename, chan->language); if (!res) - res = ast_waitstream(chan, ""); + res = ast_waitstream(chan, AST_DIGIT_ANY); else res = 0; - if (res) { - ast_log(LOG_WARNING, "ast_streamfile failed on %s \n", chan->name); - res = 0; - } ast_stopstream(chan); return res; @@ -559,21 +555,30 @@ /* Check to see if this is ludicrous -- if we just announced position, don't do it again*/ time(&now); if ( (now - qe->last_pos) < 15 ) - return -1; + return 0; /* If either our position has changed, or we are over the freq timer, say position */ if ( (qe->last_pos_said == qe->pos) && ((now - qe->last_pos) < qe->parent->announcefrequency) ) - return -1; + return 0; ast_moh_stop(qe->chan); /* Say we're next, if we are */ if (qe->pos == 1) { - res += play_file(qe->chan, qe->parent->sound_next); - goto posout; + res = play_file(qe->chan, qe->parent->sound_next); + if (res) + goto playout; + else + goto posout; } else { - res += play_file(qe->chan, qe->parent->sound_thereare); - res += ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, qe->chan->language, (char *) NULL); /* Needs gender */ - res += play_file(qe->chan, qe->parent->sound_calls); + res = play_file(qe->chan, qe->parent->sound_thereare); + if (res) + goto playout; + res = ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, qe->chan->language, (char *) NULL); /* Needs gender */ + if (res) + goto playout; + res = play_file(qe->chan, qe->parent->sound_calls); + if (res) + goto playout; } /* Round hold time to nearest minute */ avgholdmins = abs(( (qe->parent->holdtime + 30) - (now - qe->start) ) / 60); @@ -592,33 +597,50 @@ /* If the hold time is >1 min, if it's enabled, and if it's not supposed to be only once and we have already said it, say it */ if ((avgholdmins+avgholdsecs) > 0 && (qe->parent->announceholdtime) && (!(qe->parent->announceholdtime==1 && qe->last_pos)) ) { - res += play_file(qe->chan, qe->parent->sound_holdtime); + res = play_file(qe->chan, qe->parent->sound_holdtime); + if (res) + goto playout; if(avgholdmins>0) { if (avgholdmins < 2) { - res += play_file(qe->chan, qe->parent->sound_lessthan); - res += ast_say_number(qe->chan, 2, AST_DIGIT_ANY, qe->chan->language, (char *)NULL); + res = play_file(qe->chan, qe->parent->sound_lessthan); + if (res) + goto playout; + res = ast_say_number(qe->chan, 2, AST_DIGIT_ANY, qe->chan->language, (char *)NULL); + if (res) + goto playout; } else - res += ast_say_number(qe->chan, avgholdmins, AST_DIGIT_ANY, qe->chan->language, (char*) NULL); - res += play_file(qe->chan, qe->parent->sound_minutes); + res = ast_say_number(qe->chan, avgholdmins, AST_DIGIT_ANY, qe->chan->language, (char*) NULL); + if (res) + goto playout; + res = play_file(qe->chan, qe->parent->sound_minutes); + if (res) + goto playout; } if(avgholdsecs>0) { - res += ast_say_number(qe->chan, avgholdsecs, AST_DIGIT_ANY, qe->chan->language, (char*) NULL); - res += play_file(qe->chan, qe->parent->sound_seconds); + res = ast_say_number(qe->chan, avgholdsecs, AST_DIGIT_ANY, qe->chan->language, (char*) NULL); + if (res) + goto playout; + res = play_file(qe->chan, qe->parent->sound_seconds); + if (res) + goto playout; } } posout: + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n", qe->chan->name, qe->parent->name, qe->pos); + res = play_file(qe->chan, qe->parent->sound_thanks); + if (res) + goto playout; + playout: /* Set our last_pos indicators */ qe->last_pos = now; qe->last_pos_said = qe->pos; - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n", qe->chan->name, qe->parent->name, qe->pos); - res += play_file(qe->chan, qe->parent->sound_thanks); ast_moh_start(qe->chan, qe->moh); - return (res>0); + return (res); } static void record_abandoned(struct queue_ent *qe) @@ -1290,7 +1312,9 @@ /* Make a position announcement, if enabled */ if (qe->parent->announcefrequency && !ringing) - say_position(qe); + res = say_position(qe); + if (res) + break; /* Wait a second before checking again */ res = ast_waitfordigit(qe->chan, RECHECK * 1000); @@ -2347,7 +2371,12 @@ if (makeannouncement) { /* Make a position announcement, if enabled */ if (qe.parent->announcefrequency && !ringing) - say_position(&qe); + res = say_position(&qe); + if (res && valid_exit(&qe, res)) { + ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos); + break; + } + } makeannouncement = 1;