提交 ec9fddac authored 作者: Anthony Minessale's avatar Anthony Minessale

add some more dmachine code for args parsing

上级 20d17baa
...@@ -232,7 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, ...@@ -232,7 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/ */
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
if (!args->input_callback && !args->buf) { if (!args->input_callback && !args->buf && !args->dmachine) {
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
break; break;
} }
...@@ -271,6 +271,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, ...@@ -271,6 +271,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
break; break;
} }
if (args && args->dmachine) {
if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) {
break;
}
}
if (sval && write_frame.datalen) { if (sval && write_frame.datalen) {
switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval); switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval);
switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
...@@ -923,12 +929,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s ...@@ -923,12 +929,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
if (!args->input_callback && !args->buf) { if (!args->input_callback && !args->buf && !args->dmachine) {
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
break; break;
} }
switch_channel_dequeue_dtmf(channel, &dtmf); switch_channel_dequeue_dtmf(channel, &dtmf);
status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
if (args->dmachine) {
char ds[2] = {dtmf.digit, '\0'};
if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) {
break;
}
} else if (args->input_callback) {
status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
}
if (digit_timeout) { if (digit_timeout) {
digit_started = switch_micro_time_now(); digit_started = switch_micro_time_now();
} }
......
...@@ -842,7 +842,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi ...@@ -842,7 +842,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/ */
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
if (!args->input_callback && !args->buf) { if (!args->input_callback && !args->buf && !args->dmachine) {
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
done = 1; done = 1;
break; break;
...@@ -1253,7 +1253,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1253,7 +1253,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/ */
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
if (!args->input_callback && !args->buf) { if (!args->input_callback && !args->buf && !args->dmachine) {
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
done = 1; done = 1;
break; break;
...@@ -1959,7 +1959,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session ...@@ -1959,7 +1959,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
* if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/ */
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
if (!args->input_callback && !args->buf) { if (!args->input_callback && !args->buf && !args->dmachine) {
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
done = 1; done = 1;
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论