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

add callbacks to park

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4300 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 9626393e
......@@ -77,7 +77,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, uint32_t ms);
SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_input_args_t *args);
/*!
\brief Wait for DTMF digits calling a pluggable callback function when digits are collected.
......
......@@ -34,7 +34,7 @@ static const char modname[] = "mod_park";
static void park_function(switch_core_session_t *session, char *data)
{
switch_ivr_park(session);
switch_ivr_park(session, NULL);
}
......
......@@ -143,7 +143,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
}
SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session)
SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_input_args_t *args)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_channel_t *channel;
......@@ -177,11 +177,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session)
if (switch_channel_has_dtmf(channel)) {
char dtmf[128];
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
if (args && args->input_callback) {
if ((status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) {
break;
}
}
}
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
if (args && args->input_callback) {
if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) {
break;
}
} else {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论