add callbacks to park

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4300 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-02-16 21:32:49 +00:00
parent 9626393ef8
commit a03f962174
3 changed files with 16 additions and 5 deletions

View File

@ -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_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. \brief Wait for DTMF digits calling a pluggable callback function when digits are collected.

View File

@ -34,7 +34,7 @@ static const char modname[] = "mod_park";
static void park_function(switch_core_session_t *session, char *data) static void park_function(switch_core_session_t *session, char *data)
{ {
switch_ivr_park(session); switch_ivr_park(session, NULL);
} }

View File

@ -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_status_t status = SWITCH_STATUS_SUCCESS;
switch_channel_t *channel; switch_channel_t *channel;
@ -177,13 +177,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session)
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
char dtmf[128]; char dtmf[128];
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf)); 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) { if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
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_channel_event_set_data(channel, event);
switch_event_fire(&event); switch_event_fire(&event);
} }
} }
}
} }
switch_channel_clear_flag(channel, CF_CONTROLLED); switch_channel_clear_flag(channel, CF_CONTROLLED);