]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add some stuff to esl
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 17 Feb 2009 14:13:32 +0000 (14:13 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 17 Feb 2009 14:13:32 +0000 (14:13 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12086 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/perl/ESL.pm
libs/esl/perl/esl_wrap.cpp
libs/esl/src/esl.c
libs/esl/src/esl_oop.cpp
libs/esl/src/include/esl.h
libs/esl/src/include/esl_oop.h
libs/speex/config.h.in
src/mod/event_handlers/mod_event_socket/mod_event_socket.c

index a2ace0c513f37876525ad12212b29bec6da90548..396df23cc64c6eb17d1d99f1e8735604dd97bc9d 100644 (file)
@@ -135,6 +135,8 @@ sub DESTROY {
 *filter = *ESLc::eslConnection_filter;
 *events = *ESLc::eslConnection_events;
 *execute = *ESLc::eslConnection_execute;
+*setBlockingExecute = *ESLc::eslConnection_setBlockingExecute;
+*setEventLock = *ESLc::eslConnection_setEventLock;
 sub DISOWN {
     my $self = shift;
     my $ptr = tied(%$self);
index c660c3b4991dbd010b09260ff4c52a45640cc6a7..cbf20916222379d06c0d9a30c18a5945f3f9f6f1 100644 (file)
@@ -2981,8 +2981,8 @@ XS(_wrap_eslConnection_execute) {
   {
     eslConnection *arg1 = (eslConnection *) 0 ;
     char *arg2 = (char *) 0 ;
-    char *arg3 = (char *) 0 ;
-    char *arg4 = (char *) 0 ;
+    char *arg3 = (char *) NULL ;
+    char *arg4 = (char *) NULL ;
     esl_status_t result;
     void *argp1 = 0 ;
     int res1 = 0 ;
@@ -2998,7 +2998,7 @@ XS(_wrap_eslConnection_execute) {
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 4) || (items > 4)) {
+    if ((items < 2) || (items > 4)) {
       SWIG_croak("Usage: eslConnection_execute(self,app,arg,uuid);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_eslConnection, 0 |  0 );
@@ -3011,16 +3011,20 @@ XS(_wrap_eslConnection_execute) {
       SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "eslConnection_execute" "', argument " "2"" of type '" "char const *""'");
     }
     arg2 = reinterpret_cast< char * >(buf2);
-    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "eslConnection_execute" "', argument " "3"" of type '" "char const *""'");
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "eslConnection_execute" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
     }
-    arg3 = reinterpret_cast< char * >(buf3);
-    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "eslConnection_execute" "', argument " "4"" of type '" "char const *""'");
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "eslConnection_execute" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
     }
-    arg4 = reinterpret_cast< char * >(buf4);
     result = (arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
     ST(argvi) = SWIG_NewPointerObj((new esl_status_t(static_cast< const esl_status_t& >(result))), SWIGTYPE_p_esl_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
     
@@ -3038,6 +3042,84 @@ XS(_wrap_eslConnection_execute) {
 }
 
 
+XS(_wrap_eslConnection_setBlockingExecute) {
+  {
+    eslConnection *arg1 = (eslConnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: eslConnection_setBlockingExecute(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_eslConnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "eslConnection_setBlockingExecute" "', argument " "1"" of type '" "eslConnection *""'"); 
+    }
+    arg1 = reinterpret_cast< eslConnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "eslConnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->setBlockingExecute((char const *)arg2);
+    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_eslConnection_setEventLock) {
+  {
+    eslConnection *arg1 = (eslConnection *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: eslConnection_setEventLock(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_eslConnection, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "eslConnection_setEventLock" "', argument " "1"" of type '" "eslConnection *""'"); 
+    }
+    arg1 = reinterpret_cast< eslConnection * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "eslConnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->setEventLock((char const *)arg2);
+    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();
+  }
+}
+
+
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
@@ -3114,6 +3196,8 @@ static swig_command_info swig_commands[] = {
 {"ESLc::eslConnection_filter", _wrap_eslConnection_filter},
 {"ESLc::eslConnection_events", _wrap_eslConnection_events},
 {"ESLc::eslConnection_execute", _wrap_eslConnection_execute},
+{"ESLc::eslConnection_setBlockingExecute", _wrap_eslConnection_setBlockingExecute},
+{"ESLc::eslConnection_setEventLock", _wrap_eslConnection_setEventLock},
 {0,0}
 };
 /* -----------------------------------------------------------------------------
index e7f2ff75e248e0aa86c9c9ec05a3ea0729e3708c..1cb717c799c695ef11e9414e417d09379e65eea3 100644 (file)
@@ -450,6 +450,8 @@ ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, con
        char cmd_buf[128] = "sendmsg";
        char app_buf[512] = "";
        char arg_buf[512] = "";
+       const char *el_buf = "event-lock: true\n";
+       const char *bl_buf = "blocking: true\n";
        char send_buf[1292] = "";
        
        if (!handle->connected) {
@@ -468,7 +470,8 @@ ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, con
                snprintf(arg_buf, sizeof(arg_buf), "execute-app-arg: %s\n", arg);
        }
 
-       snprintf(send_buf, sizeof(send_buf), "%s\ncall-command: execute\n%s%s\n", cmd_buf, app_buf, arg_buf);
+       snprintf(send_buf, sizeof(send_buf), "%s\ncall-command: execute\n%s%s%s%s\n", 
+                        cmd_buf, app_buf, arg_buf, handle->event_lock ? el_buf : NULL, handle->blocking_execute ? bl_buf : NULL);
 
        return esl_send_recv(handle, send_buf);
 }
index d2d3b6b4bba5d475fd2d541ca70bda34059ab3d3..02dd9a8b587dafda531c6661574c2bb2dd30bdf1 100644 (file)
@@ -60,6 +60,22 @@ eslEvent *eslConnection::getInfo()
        return NULL;
 }
 
+int eslConnection::setBlockingExecute(const char *val)
+{
+       if (val) {
+               handle.blocking_execute = esl_true(val);
+       }
+       return handle.blocking_execute;
+}
+
+int eslConnection::setEventLock(const char *val)
+{
+       if (val) {
+               handle.event_lock = esl_true(val);
+       }
+       return handle.event_lock;
+}
+
 esl_status_t eslConnection::execute(const char *app, const char *arg, const char *uuid)
 {
        return esl_execute(&handle, app, arg, uuid);
index 0e9465d314e99201cffcf3a44e5930929bed2869..40ecdc22651d60e1f90f2007cbcd0bb58f295a8f 100644 (file)
@@ -270,6 +270,8 @@ typedef struct {
        int connected;
        struct sockaddr_in addr;
        esl_mutex_t *mutex;
+       int blocking_execute;
+       int event_lock;
 } esl_handle_t;
 
 typedef enum {
index 154bfcef38face8ba810ae2029cedfcc6576752c..e6ad2b065f1e536fbcae65aeea9eae95e4f19243 100644 (file)
@@ -83,7 +83,9 @@ class eslConnection {
        eslEvent *recvEventTimed(int ms);
        esl_status_t filter(const char *header, const char *value);
        esl_status_t events(const char *etype, const char *value);
-       esl_status_t execute(const char *app, const char *arg, const char *uuid);
+       esl_status_t execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
+       int setBlockingExecute(const char *val);
+       int setEventLock(const char *val);
 };
 
 
index 959340983f8fe45d020ba3ea05cdf511b78bd802..8aec7e0ace1cc993cbb7c104108033a2b125310e 100644 (file)
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* The size of `int', as computed by sizeof. */
+/* The size of `int', as computed by sizeof. */
 #undef SIZEOF_INT
 
-/* The size of `long', as computed by sizeof. */
+/* The size of `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
-/* The size of `short', as computed by sizeof. */
+/* The size of `short', as computed by sizeof. */
 #undef SIZEOF_SHORT
 
 /* Version extra */
 /* Make use of alloca */
 #undef USE_ALLOCA
 
-/* Use FFTW3 for FFT */
-#undef USE_GPL_FFTW3
-
-/* Use Intel Math Kernel Library for FFT */
-#undef USE_INTEL_MKL
-
 /* Use KISS Fast Fourier Transform */
 #undef USE_KISS_FFT
 
index a57001ec0ff3ac76600e509299409ba3a992b8d5..15fb9e0e8e9cf24c46472b73f14a5d53e415fe78 100644 (file)
@@ -1470,7 +1470,14 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                }
 
                if (switch_strlen_zero(uuid) && listener->session) {
-                       if (switch_test_flag(listener, LFLAG_ASYNC)) {
+                       const char *blocking = switch_event_get_header(*event, "blocking");
+                       int async = switch_test_flag(listener, LFLAG_ASYNC);
+                       
+                       if (blocking && switch_true(blocking)) {
+                               async = 0;
+                       }
+
+                       if (async) {
                                if ((status = switch_core_session_queue_private_event(listener->session, event)) == SWITCH_STATUS_SUCCESS) {
                                        switch_snprintf(reply, reply_len, "+OK");
                                } else {