]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add args to sleep
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 8 Jul 2008 17:27:02 +0000 (17:27 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 8 Jul 2008 17:27:02 +0000 (17:27 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8930 d0543943-73ff-0310-b7d9-9358b9ac24b2

18 files changed:
src/include/switch_cpp.h
src/include/switch_ivr.h
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_fifo/mod_fifo.c
src/mod/applications/mod_voicemail/mod_voicemail.c
src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
src/mod/languages/mod_java/switch_swig_wrap.cpp
src/mod/languages/mod_lua/mod_lua_wrap.cpp
src/mod/languages/mod_perl/freeswitch.pm
src/mod/languages/mod_perl/mod_perl_wrap.cpp
src/mod/languages/mod_python/freeswitch.py
src/mod/languages/mod_python/mod_python_wrap.cpp
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
src/switch_cpp.cpp
src/switch_ivr.c
src/switch_ivr_menu.c
src/switch_ivr_originate.c

index d96ee2d4ffe181f10f5c476ec881d5723f168ab1..40ecd37607f465e3b2014ebfb08e3cfd17821504 100644 (file)
@@ -276,6 +276,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
         *
         */
                 SWITCH_DECLARE(int) streamFile(char *file, int starting_sample_count = 0);
+                SWITCH_DECLARE(int) sleep(char *file, int ms);
 
        /** \brief flush any pending events
         */
index 323e84c9b1334a0a2197160717a9365205207ac1..aaa0a5eeb994aa39eb6f0b374024750de00f1091 100644 (file)
@@ -107,9 +107,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_event(switch_core_session_
   \brief Wait for time to pass for a specified number of milliseconds
   \param session the session to wait for.
   \param ms the number of milliseconds
+  \param args arguements to pass for callbacks etc
   \return SWITCH_STATUS_SUCCESS if the channel is still up
 */
-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_input_args_t *args);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_input_args_t *args);
 
index bf1846bbd1cf53c1e04a46620c20a3737ae0b166..792d626e8747ed7771712a3255f2fda9f9188cc6 100644 (file)
@@ -586,16 +586,6 @@ SWITCH_STANDARD_APP(sched_broadcast_function)
        }
 }
 
-SWITCH_STANDARD_APP(sleep_function)
-{
-       if (switch_strlen_zero(data)) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No timeout specified.\n");
-       } else {
-               uint32_t ms = atoi(data);
-               switch_ivr_sleep(session, ms);
-       }
-}
-
 SWITCH_STANDARD_APP(delay_function)
 {
        uint32_t len = 0;
@@ -1323,6 +1313,26 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
        return SWITCH_STATUS_SUCCESS;
 }
 
+
+SWITCH_STANDARD_APP(sleep_function)
+{      
+       if (switch_strlen_zero(data)) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No timeout specified.\n");
+       } else {
+               uint32_t ms = atoi(data);
+               char buf[10];
+               switch_input_args_t args = { 0 };
+
+               args.input_callback = on_dtmf;
+               args.buf = buf;
+               args.buflen = sizeof(buf);
+               
+               switch_ivr_sleep(session, ms, &args);
+       }
+}
+
+
+
 SWITCH_STANDARD_APP(clear_speech_cache_function)
 {
        switch_ivr_clear_speech_cache(session);
index 8ac15ceeeef9fdc448b64d42c0f2bd8768e5cfce..17e02a82782d831cec84fb48d5e13e367beed7eb 100644 (file)
@@ -855,7 +855,7 @@ SWITCH_STANDARD_APP(fifo_function)
                                if (announce) {
                                        switch_ivr_play_file(session, NULL, announce, NULL);
                                } else {
-                                       switch_ivr_sleep(session, 500);
+                                       switch_ivr_sleep(session, 500, NULL);
                                }
 
 
index e840a606a7c418e320c926c3aa6feb80b0fb0653..9f95c4a833729fbd1596507315aba016c5fd431f 100644 (file)
@@ -1314,7 +1314,7 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
        status = switch_ivr_phrase_macro(session, VM_HELLO_MACRO, NULL, NULL, &args);
 
        while (switch_channel_ready(channel)) {
-               switch_ivr_sleep(session, 100);
+               switch_ivr_sleep(session, 100, NULL);
 
                switch (vm_check_state) {
                case VM_CHECK_START:
index 5dc4233866df9f03a513f882b05277ca4f5e27d5..4eb473276b9e8bad2f84c3add13368bc43ea155d 100644 (file)
@@ -209,6 +209,10 @@ public class CoreSession {
     return freeswitchJNI.CoreSession_streamFile__SWIG_1(swigCPtr, this, file);
   }
 
+  public int sleep(String file, int ms) {
+    return freeswitchJNI.CoreSession_sleep(swigCPtr, this, file, ms);
+  }
+
   public int flushEvents() {
     return freeswitchJNI.CoreSession_flushEvents(swigCPtr, this);
   }
index c6ffd5ec29f47fad09bc6cffaa135509f6bc0dba..3ad0f37e33a4035b762f07e7a2a128c1121c464f 100644 (file)
@@ -120,6 +120,7 @@ class freeswitchJNI {
   public final static native String CoreSession_playAndGetDigits(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, int jarg4, int jarg5, String jarg6, String jarg7, String jarg8, String jarg9);
   public final static native int CoreSession_streamFile__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, int jarg3);
   public final static native int CoreSession_streamFile__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2);
+  public final static native int CoreSession_sleep(long jarg1, CoreSession jarg1_, String jarg2, int jarg3);
   public final static native int CoreSession_flushEvents(long jarg1, CoreSession jarg1_);
   public final static native int CoreSession_flushDigits(long jarg1, CoreSession jarg1_);
   public final static native int CoreSession_setAutoHangup(long jarg1, CoreSession jarg1_, boolean jarg2);
index c4af8353b54aefc28253916784cefc7d6d8d9dbd..bbc4247a94a530b6c8156e42fe1c560bc25f8bc7 100644 (file)
@@ -2376,6 +2376,30 @@ SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1stre
 }
 
 
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sleep(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) {
+  jint jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = (int)jarg3; 
+  result = (int)(arg1)->sleep(arg2,arg3);
+  jresult = (jint)result; 
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
 SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1flushEvents(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   jint jresult = 0 ;
   CoreSession *arg1 = (CoreSession *) 0 ;
index 212f907d21b1dd408ca679ff4e06383f6e2339eb..48854f51260af6f4931da93c95d30fce66ff30e5 100644 (file)
@@ -5476,6 +5476,37 @@ static int _wrap_CoreSession_streamFile(lua_State* L) {
 }
 
 
+static int _wrap_CoreSession_sleep(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  
+  SWIG_check_num_args("sleep",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sleep",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("sleep",2,"char *");
+  if(!lua_isnumber(L,3)) SWIG_fail_arg("sleep",3,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_sleep",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (int)lua_tonumber(L, 3);
+  result = (int)(arg1)->sleep(arg2,arg3);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
 static int _wrap_CoreSession_flushEvents(lua_State* L) {
   int SWIG_arg = -1;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -6081,6 +6112,7 @@ static swig_lua_method swig_CoreSession_methods[] = {
     {"read", _wrap_CoreSession_read}, 
     {"playAndGetDigits", _wrap_CoreSession_playAndGetDigits}, 
     {"streamFile", _wrap_CoreSession_streamFile}, 
+    {"sleep", _wrap_CoreSession_sleep}, 
     {"flushEvents", _wrap_CoreSession_flushEvents}, 
     {"flushDigits", _wrap_CoreSession_flushDigits}, 
     {"setAutoHangup", _wrap_CoreSession_setAutoHangup}, 
index 097cfa7937131fa012e81e7b27f4ef21a2a7e376..5eb1ecc82b9ded832fc80bd841366ec6cc31b00b 100644 (file)
@@ -372,6 +372,7 @@ sub DESTROY {
 *read = *freeswitchc::CoreSession_read;
 *playAndGetDigits = *freeswitchc::CoreSession_playAndGetDigits;
 *streamFile = *freeswitchc::CoreSession_streamFile;
+*sleep = *freeswitchc::CoreSession_sleep;
 *flushEvents = *freeswitchc::CoreSession_flushEvents;
 *flushDigits = *freeswitchc::CoreSession_flushDigits;
 *setAutoHangup = *freeswitchc::CoreSession_setAutoHangup;
index 326c65e2d8b4a59d6a1fbdb5ec26fe205b6b2c30..5d7497e7a7dc41ebaf96b8e831030d82634335be 100644 (file)
@@ -7312,6 +7312,55 @@ XS(_wrap_CoreSession_streamFile) {
 }
 
 
+XS(_wrap_CoreSession_sleep) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_sleep(self,file,ms);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sleep" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sleep" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_sleep" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    result = (int)(arg1)->sleep(arg2,arg3);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_CoreSession_flushEvents) {
   {
     CoreSession *arg1 = (CoreSession *) 0 ;
@@ -9331,6 +9380,7 @@ static swig_command_info swig_commands[] = {
 {"freeswitchc::CoreSession_read", _wrap_CoreSession_read},
 {"freeswitchc::CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
 {"freeswitchc::CoreSession_streamFile", _wrap_CoreSession_streamFile},
+{"freeswitchc::CoreSession_sleep", _wrap_CoreSession_sleep},
 {"freeswitchc::CoreSession_flushEvents", _wrap_CoreSession_flushEvents},
 {"freeswitchc::CoreSession_flushDigits", _wrap_CoreSession_flushDigits},
 {"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
index 495aa59237573c23b1007321ffad9cdaa06f694c..a299a79f0420f2f2085ef1aae0942f00ad16a858 100644 (file)
@@ -247,6 +247,7 @@ class CoreSession(_object):
     def read(*args): return _freeswitch.CoreSession_read(*args)
     def playAndGetDigits(*args): return _freeswitch.CoreSession_playAndGetDigits(*args)
     def streamFile(*args): return _freeswitch.CoreSession_streamFile(*args)
+    def sleep(*args): return _freeswitch.CoreSession_sleep(*args)
     def flushEvents(*args): return _freeswitch.CoreSession_flushEvents(*args)
     def flushDigits(*args): return _freeswitch.CoreSession_flushDigits(*args)
     def setAutoHangup(*args): return _freeswitch.CoreSession_setAutoHangup(*args)
index 7dfcdb65a584eb46f07d9217f0e3b9056c364c9d..bec852d61074cd4b3e6f911469b095e58dd35736 100644 (file)
@@ -7354,6 +7354,49 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_CoreSession_sleep(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_sleep",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sleep" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sleep" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_sleep" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  result = (int)(arg1)->sleep(arg2,arg3);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -8540,6 +8583,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL},
         { (char *)"CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
         { (char *)"CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL},
+        { (char *)"CoreSession_sleep", _wrap_CoreSession_sleep, METH_VARARGS, NULL},
         { (char *)"CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL},
         { (char *)"CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL},
         { (char *)"CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
index dbdad5d0669dcf4fedfdceb0b0fc713bf6df7e1c..8251ad3c598cd937c551ac12ca719b2192905969 100644 (file)
@@ -1689,6 +1689,64 @@ static JSBool session_streamfile(JSContext * cx, JSObject * obj, uintN argc, jsv
        return JS_TRUE;
 }
 
+
+
+static JSBool session_sleep(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+       struct js_session *jss = JS_GetPrivate(cx, obj);
+       switch_channel_t *channel;
+       void *bp = NULL;
+       int len = 0;
+       switch_input_callback_function_t dtmf_func = NULL;
+       struct input_callback_state cb_state = { 0 };
+       JSFunction *function;
+       switch_input_args_t args = { 0 };
+       int32 ms;
+
+       METHOD_SANITY_CHECK();
+       channel = switch_core_session_get_channel(jss->session);
+       CHANNEL_SANITY_CHECK();
+       CHANNEL_MEDIA_SANITY_CHECK();
+
+       if (argc > 0) {
+               JS_ValueToInt32(cx, argv[0], &ms);
+               if (ms <= 0) {
+                       return JS_FALSE;
+               }
+       }
+
+       if (argc > 1) {
+               if ((function = JS_ValueToFunction(cx, argv[1]))) {
+                       memset(&cb_state, 0, sizeof(cb_state));
+                       cb_state.function = function;
+
+                       if (argc > 2) {
+                               cb_state.arg = argv[2];
+                       }
+
+                       cb_state.session_state = jss;
+                       cb_state.cx = cx;
+                       cb_state.obj = obj;
+                       dtmf_func = js_stream_input_callback;
+                       bp = &cb_state;
+                       len = sizeof(cb_state);
+               }
+       }
+
+       cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
+       cb_state.saveDepth = JS_SuspendRequest(cx);
+       args.input_callback = dtmf_func;
+       args.buf = bp;
+       args.buflen = len;
+       check_hangup_hook(jss);
+       switch_ivr_sleep(jss->session, ms, &args);
+       check_hangup_hook(jss);
+       JS_ResumeRequest(cx, cb_state.saveDepth);
+       *rval = cb_state.ret;
+
+       return JS_TRUE;
+}
+
 static JSBool session_set_variable(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
        struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -2488,6 +2546,7 @@ static JSFunctionSpec session_methods[] = {
        {"sendEvent", session_send_event, 0},
        {"hangup", session_hangup, 0},
        {"execute", session_execute, 0},
+       {"sleep", session_sleep, 1},
        {0}
 };
 
index 7a2bd01eb69ddbf967acc8a0a46a6b938236b6a1..e7170c1bde79b8293df9bc7f8dc3d76e4984c522 100644 (file)
@@ -804,6 +804,21 @@ SWITCH_DECLARE(int) CoreSession::streamFile(char *file, int starting_sample_coun
 
 }
 
+SWITCH_DECLARE(int) CoreSession::sleep(char *file, int ms) {
+
+    switch_status_t status;
+
+       this_check(-1);
+    sanity_check(-1);
+       
+    begin_allow_threads();
+    status = switch_ivr_sleep(session, ms, ap);
+    end_allow_threads();
+
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+
+}
+
 SWITCH_DECLARE(bool) CoreSession::ready() {
 
        this_check(false);
index 8cc6952923b459532d79862562898d239a61f02e..6aff95885d246af8719b1c60c4cc7601bb47682f 100644 (file)
@@ -38,7 +38,7 @@
 #include <switch_ivr.h>
 #include "stfu.h"
 
-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_input_args_t *args)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -59,6 +59,41 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
                if (now > done || left <= 0) {
                        break;
                }
+               
+               if (args && (args->input_callback || args->buf || args->buflen)) {
+                       switch_dtmf_t dtmf;
+                       
+                       /*
+                          dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+                          if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+                        */
+                       if (switch_channel_has_dtmf(channel)) {
+                               if (!args->input_callback && !args->buf) {
+                                       status = SWITCH_STATUS_BREAK;
+                                       break;
+                               }
+                               switch_channel_dequeue_dtmf(channel, &dtmf);
+                               if (args->input_callback) {
+                                       status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+                               } else {
+                                       switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen);
+                                       status = SWITCH_STATUS_BREAK;
+                               }
+                       }
+
+                       if (args->input_callback) {
+                               switch_event_t *event = NULL;
+
+                               if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+                                       status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
+                                       switch_event_destroy(&event);
+                               }
+                       }
+
+                       if (status != SWITCH_STATUS_SUCCESS) {
+                               break;
+                       }
+               }
 
                if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
                        switch_yield(1000);
index 1c36e26078253c4c13076fe959dde06b1fd939c5..721168744840b84fded6e64374880f7b262d6835 100644 (file)
@@ -501,7 +501,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
                        }
                        errs++;
                        if (status == SWITCH_STATUS_SUCCESS) {
-                               status = switch_ivr_sleep(session, 1000);
+                               status = switch_ivr_sleep(session, 1000, NULL);
                        }
                        /* breaks are ok too */
                        if (SWITCH_STATUS_IS_BREAK(status)) {
index 13f5910547bb983130b6e07ee92ce8973a482c40..da4ec7a36855957b612c033cd38a7cea975dba2f 100644 (file)
@@ -40,7 +40,7 @@ static switch_status_t originate_on_consume_media_transmit(switch_core_session_t
 
        if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
                while (switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
-                       switch_ivr_sleep(session, 10);
+                       switch_ivr_sleep(session, 10, NULL);
                }
        }