]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add callbacks to park
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 16 Feb 2007 21:32:49 +0000 (21:32 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 16 Feb 2007 21:32:49 +0000 (21:32 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4300 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_ivr.h
src/mod/applications/mod_park/mod_park.c
src/switch_ivr.c

index 1266eb57069a216f845724f1cb7abfb1a896c424..10cf6dd74a499da100f6fed5bd6de90286baf0c5 100644 (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_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.
index 4903fefd2719137505554b52e21198b783445e06..4aadd7ed4d6e2012efa95959cd877f237f162264 100644 (file)
@@ -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);
        
 }
 
index e55a469a66d3fdef131fcfc5175138f227ead0a5..9bff5e08943e49acce3201e0e3c34784b3ff95ba 100644 (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_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);
+                               }
             }
         }