FS-3760 --resolve fix that works in all situations

This commit is contained in:
Anthony Minessale 2012-01-19 15:13:48 -06:00
parent f9e7e4d320
commit 78a43b4005
1 changed files with 21 additions and 14 deletions

View File

@ -488,6 +488,7 @@ struct fifo_chime_data {
char *orbit_exten; char *orbit_exten;
char *orbit_dialplan; char *orbit_dialplan;
char *orbit_context; char *orbit_context;
char *exit_key;
}; };
typedef struct fifo_chime_data fifo_chime_data_t; typedef struct fifo_chime_data fifo_chime_data_t;
@ -521,22 +522,25 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
if (cd->list[cd->index]) { if (cd->list[cd->index]) {
switch_input_args_t args = { 0 }; switch_input_args_t args = { 0 };
char buf[25] = ""; char buf[25] = "";
switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status;
const char *caller_exit_key = switch_channel_get_variable(channel, "fifo_caller_exit_key");
args.input_callback = moh_on_dtmf; args.input_callback = moh_on_dtmf;
args.buf = buf; args.buf = buf;
args.buflen = sizeof(buf); args.buflen = sizeof(buf);
args.read_frame_callback = chime_read_frame_callback; args.read_frame_callback = chime_read_frame_callback;
args.user_data = user_data; args.user_data = user_data;
if (switch_ivr_play_file(session, NULL, cd->list[cd->index], &args) != SWITCH_STATUS_SUCCESS) { status = switch_ivr_play_file(session, NULL, cd->list[cd->index], &args);
return SWITCH_STATUS_BREAK;
}
if (match_key(caller_exit_key, *buf)) { if (match_key(cd->exit_key, *buf)) {
cd->abort = 1; cd->abort = 1;
return SWITCH_STATUS_BREAK; return SWITCH_STATUS_BREAK;
} }
if (status != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_BREAK;
}
cd->next = switch_epoch_time_now(NULL) + cd->freq; cd->next = switch_epoch_time_now(NULL) + cd->freq;
cd->index++; cd->index++;
} }
@ -2482,6 +2486,7 @@ SWITCH_STANDARD_APP(fifo_function)
cd.total = switch_separate_string(list_dup, ',', cd.list, (sizeof(cd.list) / sizeof(cd.list[0]))); cd.total = switch_separate_string(list_dup, ',', cd.list, (sizeof(cd.list) / sizeof(cd.list[0])));
cd.freq = freq; cd.freq = freq;
cd.next = switch_epoch_time_now(NULL) + cd.freq; cd.next = switch_epoch_time_now(NULL) + cd.freq;
cd.exit_key = (char *) switch_channel_get_variable(channel, "fifo_caller_exit_key");
} }
send_presence(node); send_presence(node);
@ -2489,6 +2494,7 @@ SWITCH_STANDARD_APP(fifo_function)
while (switch_channel_ready(channel)) { while (switch_channel_ready(channel)) {
switch_input_args_t args = { 0 }; switch_input_args_t args = { 0 };
char buf[25] = ""; char buf[25] = "";
switch_status_t rstatus;
args.input_callback = moh_on_dtmf; args.input_callback = moh_on_dtmf;
args.buf = buf; args.buf = buf;
@ -2511,14 +2517,15 @@ SWITCH_STANDARD_APP(fifo_function)
switch_core_session_flush_private_events(session); switch_core_session_flush_private_events(session);
if (moh) { if (moh) {
switch_status_t status = switch_ivr_play_file(session, NULL, moh, &args); rstatus = switch_ivr_play_file(session, NULL, moh, &args);
if (!SWITCH_READ_ACCEPTABLE(status)) { } else {
rstatus = switch_ivr_collect_digits_callback(session, &args, 0, 0);
}
if (!SWITCH_READ_ACCEPTABLE(rstatus)) {
aborted = 1; aborted = 1;
goto abort; goto abort;
} }
} else {
switch_ivr_collect_digits_callback(session, &args, 0, 0);
}
if (match_key(caller_exit_key, *buf)) { if (match_key(caller_exit_key, *buf)) {
switch_channel_set_variable(channel, "fifo_caller_exit_key", (char *)buf); switch_channel_set_variable(channel, "fifo_caller_exit_key", (char *)buf);