diff --git a/apps/app_dial.c b/apps/app_dial.c index 1ab5d46..7523d51 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1021,6 +1021,17 @@ static void do_forward(struct chanlist *o, struct cause_args *num, } } +void generateRinging(struct ast_channel *chan) { + struct ast_tone_zone_sound *ts = NULL; + ts = ast_get_indication_tone(chan->zone, "ring"); + + if (ts) { + ast_playtones_start(chan, 0, ts->data, 1); + ast_verb(3, "generating ringing on channel %s\n", chan->name); + ts = ast_tone_zone_sound_unref(ts); + } +} + /* argument used for some functions. */ struct privacy_args { int sentringing; @@ -1055,6 +1066,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, int is_cc_recall; int cc_frame_received = 0; int num_ringing = 0; + int progressIndicated = 0; ast_party_connected_line_init(&connected_caller); if (single) { @@ -1335,8 +1347,15 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, ast_channel_early_bridge(in, c); } if (!(pa->sentringing) && !ast_test_flag64(outgoing, OPT_MUSICBACK) && ast_strlen_zero(opt_args[OPT_ARG_RINGBACK])) { + int currentlySingle = (1 == numlines - (num.busy + num.congestion + num.nochan)); + + ast_verb(3, "indicating %d, %d\n", progressIndicated, !currentlySingle); ast_indicate(in, AST_CONTROL_RINGING); pa->sentringing++; + + if (progressIndicated && !currentlySingle) { + generateRinging(in); + } } } break; @@ -1349,7 +1368,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } if (!ast_test_flag64(outgoing, OPT_RINGBACK)) { if (single || (!single && !pa->sentringing)) { + ast_verb(3, "indicating progress from %s\n", c->name); ast_indicate(in, AST_CONTROL_PROGRESS); + progressIndicated = 1; } } if (!ast_strlen_zero(dtmf_progress)) { @@ -1468,9 +1489,12 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } /* Fall through */ case AST_FRAME_TEXT: - if (single && ast_write(in, f)) { - ast_log(LOG_WARNING, "Unable to write frametype: %d\n", - f->frametype); + { + int currentlySingle = (1 == numlines - (num.busy + num.congestion + num.nochan)); + if (currentlySingle && ast_write(in, f)) { + ast_log(LOG_WARNING, "Unable to write frametype: %d\n", + f->frametype); + } } break; case AST_FRAME_HTML: