From 7987fa5cfdfeb5825aa1b4116a7c0dbf166fdfc3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Feb 2009 14:13:32 +0000 Subject: [PATCH] add some stuff to esl git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12086 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/esl/perl/ESL.pm | 2 + libs/esl/perl/esl_wrap.cpp | 106 ++++++++++++++++-- libs/esl/src/esl.c | 5 +- libs/esl/src/esl_oop.cpp | 16 +++ libs/esl/src/include/esl.h | 2 + libs/esl/src/include/esl_oop.h | 4 +- libs/speex/config.h.in | 12 +- .../mod_event_socket/mod_event_socket.c | 9 +- 8 files changed, 133 insertions(+), 23 deletions(-) diff --git a/libs/esl/perl/ESL.pm b/libs/esl/perl/ESL.pm index a2ace0c513..396df23cc6 100644 --- a/libs/esl/perl/ESL.pm +++ b/libs/esl/perl/ESL.pm @@ -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); diff --git a/libs/esl/perl/esl_wrap.cpp b/libs/esl/perl/esl_wrap.cpp index c660c3b499..cbf2091622 100644 --- a/libs/esl/perl/esl_wrap.cpp +++ b/libs/esl/perl/esl_wrap.cpp @@ -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} }; /* ----------------------------------------------------------------------------- diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index e7f2ff75e2..1cb717c799 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -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); } diff --git a/libs/esl/src/esl_oop.cpp b/libs/esl/src/esl_oop.cpp index d2d3b6b4bb..02dd9a8b58 100644 --- a/libs/esl/src/esl_oop.cpp +++ b/libs/esl/src/esl_oop.cpp @@ -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); diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index 0e9465d314..40ecdc2265 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -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 { diff --git a/libs/esl/src/include/esl_oop.h b/libs/esl/src/include/esl_oop.h index 154bfcef38..e6ad2b065f 100644 --- a/libs/esl/src/include/esl_oop.h +++ b/libs/esl/src/include/esl_oop.h @@ -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); }; diff --git a/libs/speex/config.h.in b/libs/speex/config.h.in index 959340983f..8aec7e0ace 100644 --- a/libs/speex/config.h.in +++ b/libs/speex/config.h.in @@ -96,13 +96,13 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of `int', as computed by sizeof. */ +/* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The size of `long', as computed by sizeof. */ +/* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of `short', as computed by sizeof. */ +/* The size of a `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* Version extra */ @@ -129,12 +129,6 @@ /* 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 diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index a57001ec0f..15fb9e0e8e 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -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 {