This update was supplied in 10154; to allow announcemnts if the 'r' option (ringing) is provided.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76220 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2007-07-21 00:57:00 +00:00
parent b928d1a0f3
commit 5c6d509591

View File

@@ -1366,7 +1366,7 @@ static int valid_exit(struct queue_ent *qe, char digit)
return 0; return 0;
} }
static int say_position(struct queue_ent *qe) static int say_position(struct queue_ent *qe, int ringing)
{ {
int res = 0, avgholdmins, avgholdsecs; int res = 0, avgholdmins, avgholdsecs;
time_t now; time_t now;
@@ -1380,7 +1380,11 @@ static int say_position(struct queue_ent *qe)
if ((qe->last_pos_said == qe->pos) && ((now - qe->last_pos) < qe->parent->announcefrequency)) if ((qe->last_pos_said == qe->pos) && ((now - qe->last_pos) < qe->parent->announcefrequency))
return 0; return 0;
if (ringing) {
ast_indicate(qe->chan,-1);
} else {
ast_moh_stop(qe->chan); ast_moh_stop(qe->chan);
}
/* Say we're next, if we are */ /* Say we're next, if we are */
if (qe->pos == 1) { if (qe->pos == 1) {
res = play_file(qe->chan, qe->parent->sound_next); res = play_file(qe->chan, qe->parent->sound_next);
@@ -1467,9 +1471,12 @@ playout:
qe->last_pos_said = qe->pos; qe->last_pos_said = qe->pos;
/* Don't restart music on hold if we're about to exit the caller from the queue */ /* Don't restart music on hold if we're about to exit the caller from the queue */
if (!res) if (!res) {
if (ringing)
ast_indicate(qe->chan, AST_CONTROL_RINGING);
else
ast_moh_start(qe->chan, qe->moh, NULL); ast_moh_start(qe->chan, qe->moh, NULL);
}
return res; return res;
} }
@@ -1856,7 +1863,7 @@ static int store_next(struct queue_ent *qe, struct callattempt *outgoing)
return 0; return 0;
} }
static int say_periodic_announcement(struct queue_ent *qe) static int say_periodic_announcement(struct queue_ent *qe, int ringing)
{ {
int res = 0; int res = 0;
time_t now; time_t now;
@@ -1869,6 +1876,9 @@ static int say_periodic_announcement(struct queue_ent *qe)
return 0; return 0;
/* Stop the music on hold so we can play our own file */ /* Stop the music on hold so we can play our own file */
if (ringing)
ast_indicate(qe->chan,-1);
else
ast_moh_stop(qe->chan); ast_moh_stop(qe->chan);
if (option_verbose > 2) if (option_verbose > 2)
@@ -1886,8 +1896,12 @@ static int say_periodic_announcement(struct queue_ent *qe)
res = 0; res = 0;
/* Resume Music on Hold if the caller is going to stay in the queue */ /* Resume Music on Hold if the caller is going to stay in the queue */
if (!res) if (!res) {
if (ringing)
ast_indicate(qe->chan, AST_CONTROL_RINGING);
else
ast_moh_start(qe->chan, qe->moh, NULL); ast_moh_start(qe->chan, qe->moh, NULL);
}
/* update last_periodic_announce_time */ /* update last_periodic_announce_time */
qe->last_periodic_announce_time = now; qe->last_periodic_announce_time = now;
@@ -2274,13 +2288,13 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
} }
/* Make a position announcement, if enabled */ /* Make a position announcement, if enabled */
if (qe->parent->announcefrequency && !ringing && if (qe->parent->announcefrequency &&
(res = say_position(qe))) (res = say_position(qe,ringing)))
break; break;
/* Make a periodic announcement, if enabled */ /* Make a periodic announcement, if enabled */
if (qe->parent->periodicannouncefrequency && !ringing && if (qe->parent->periodicannouncefrequency &&
(res = say_periodic_announcement(qe))) (res = say_periodic_announcement(qe,ringing)))
break; break;
/* Wait a second before checking again */ /* Wait a second before checking again */
@@ -2403,7 +2417,7 @@ static void send_agent_complete(const struct queue_ent *qe, const char *queuenam
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : ""); qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : "");
} }
static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *go_on, const char *agi, const char *macro, const char *gosub) static int try_calling(struct queue_ent *qe, const char *options, char *announceoverride, const char *url, int *go_on, const char *agi, const char *macro, const char *gosub, int ringing)
{ {
struct member *cur; struct member *cur;
struct callattempt *outgoing = NULL; /* the list of calls we are building */ struct callattempt *outgoing = NULL; /* the list of calls we are building */
@@ -2617,6 +2631,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
} }
} }
/* Stop music on hold */ /* Stop music on hold */
if (ringing)
ast_indicate(qe->chan,-1);
else
ast_moh_stop(qe->chan); ast_moh_stop(qe->chan);
/* If appropriate, log that we have a destination channel */ /* If appropriate, log that we have a destination channel */
if (qe->chan->cdr) if (qe->chan->cdr)
@@ -3551,20 +3568,19 @@ check_turns:
if (makeannouncement) { if (makeannouncement) {
/* Make a position announcement, if enabled */ /* Make a position announcement, if enabled */
if (qe.parent->announcefrequency)
if (qe.parent->announcefrequency && !ringing) if ((res = say_position(&qe,ringing)))
if ((res = say_position(&qe)))
goto stop; goto stop;
} }
makeannouncement = 1; makeannouncement = 1;
/* Make a periodic announcement, if enabled */ /* Make a periodic announcement, if enabled */
if (qe.parent->periodicannouncefrequency && !ringing) if (qe.parent->periodicannouncefrequency)
if ((res = say_periodic_announcement(&qe))) if ((res = say_periodic_announcement(&qe,ringing)))
goto stop; goto stop;
/* Try calling all queue members for 'timeout' seconds */ /* Try calling all queue members for 'timeout' seconds */
res = try_calling(&qe, args.options, args.announceoverride, args.url, &go_on, args.agi, args.macro, args.gosub); res = try_calling(&qe, args.options, args.announceoverride, args.url, &go_on, args.agi, args.macro, args.gosub, ringing);
if (res) if (res)
goto stop; goto stop;