app_queue: Refactor odd placement of if's around say_position

Change-Id: Icba97905e331812f129e5966e91a59b104c7a748
17.3
Walter Doekes 5 years ago
parent fd31ef67b9
commit b455d57f7d

@ -4020,45 +4020,27 @@ static int say_position(struct queue_ent *qe, int ringing)
/* 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);
if (res) { if (!res) {
goto playout;
}
goto posout; goto posout;
} else {
if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){
/* More than Case*/
res = play_file(qe->chan, qe->parent->queue_quantity1);
if (res) {
goto playout;
} }
res = ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */ /* Say there are more than N callers */
if (res) { } else if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit) {
goto playout; res = (
play_file(qe->chan, qe->parent->queue_quantity1) ||
ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY,
ast_channel_language(qe->chan), NULL) || /* Needs gender */
play_file(qe->chan, qe->parent->queue_quantity2));
/* Say there are currently N callers waiting */
} else {
res = (
play_file(qe->chan, qe->parent->sound_thereare) ||
ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY,
ast_channel_language(qe->chan), NULL) || /* Needs gender */
play_file(qe->chan, qe->parent->sound_calls));
} }
} else {
/* Normal Case */
res = play_file(qe->chan, qe->parent->sound_thereare);
if (res) { if (res) {
goto playout; goto playout;
} }
res = ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */
if (res) {
goto playout;
}
}
if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){
/* More than Case*/
res = play_file(qe->chan, qe->parent->queue_quantity2);
if (res) {
goto playout;
}
} else {
res = play_file(qe->chan, qe->parent->sound_calls);
if (res) {
goto playout;
}
}
}
} }
/* Round hold time to nearest minute */ /* Round hold time to nearest minute */
avgholdmins = labs(((qe->parent->holdtime + 30) - (now - qe->start)) / 60); avgholdmins = labs(((qe->parent->holdtime + 30) - (now - qe->start)) / 60);

Loading…
Cancel
Save