From: Anthony Minessale Date: Fri, 16 Feb 2007 21:32:49 +0000 (+0000) Subject: add callbacks to park X-Git-Tag: v1.0-beta1~1069 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a03f9621748aa60685aa2b2a1d9183c07842f856;p=thirdparty%2Ffreeswitch.git add callbacks to park git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4300 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 1266eb5706..10cf6dd74a 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -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. diff --git a/src/mod/applications/mod_park/mod_park.c b/src/mod/applications/mod_park/mod_park.c index 4903fefd27..4aadd7ed4d 100644 --- a/src/mod/applications/mod_park/mod_park.c +++ b/src/mod/applications/mod_park/mod_park.c @@ -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); } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index e55a469a66..9bff5e0894 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -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); + } } }