mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-07 21:44:51 +00:00
add some stuff to esl
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12086 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
36c59d1237
commit
7987fa5cfd
@ -135,6 +135,8 @@ sub DESTROY {
|
|||||||
*filter = *ESLc::eslConnection_filter;
|
*filter = *ESLc::eslConnection_filter;
|
||||||
*events = *ESLc::eslConnection_events;
|
*events = *ESLc::eslConnection_events;
|
||||||
*execute = *ESLc::eslConnection_execute;
|
*execute = *ESLc::eslConnection_execute;
|
||||||
|
*setBlockingExecute = *ESLc::eslConnection_setBlockingExecute;
|
||||||
|
*setEventLock = *ESLc::eslConnection_setEventLock;
|
||||||
sub DISOWN {
|
sub DISOWN {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $ptr = tied(%$self);
|
my $ptr = tied(%$self);
|
||||||
|
@ -2981,8 +2981,8 @@ XS(_wrap_eslConnection_execute) {
|
|||||||
{
|
{
|
||||||
eslConnection *arg1 = (eslConnection *) 0 ;
|
eslConnection *arg1 = (eslConnection *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
char *arg3 = (char *) 0 ;
|
char *arg3 = (char *) NULL ;
|
||||||
char *arg4 = (char *) 0 ;
|
char *arg4 = (char *) NULL ;
|
||||||
esl_status_t result;
|
esl_status_t result;
|
||||||
void *argp1 = 0 ;
|
void *argp1 = 0 ;
|
||||||
int res1 = 0 ;
|
int res1 = 0 ;
|
||||||
@ -2998,7 +2998,7 @@ XS(_wrap_eslConnection_execute) {
|
|||||||
int argvi = 0;
|
int argvi = 0;
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
|
|
||||||
if ((items < 4) || (items > 4)) {
|
if ((items < 2) || (items > 4)) {
|
||||||
SWIG_croak("Usage: eslConnection_execute(self,app,arg,uuid);");
|
SWIG_croak("Usage: eslConnection_execute(self,app,arg,uuid);");
|
||||||
}
|
}
|
||||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_eslConnection, 0 | 0 );
|
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 *""'");
|
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "eslConnection_execute" "', argument " "2"" of type '" "char const *""'");
|
||||||
}
|
}
|
||||||
arg2 = reinterpret_cast< char * >(buf2);
|
arg2 = reinterpret_cast< char * >(buf2);
|
||||||
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
|
if (items > 2) {
|
||||||
if (!SWIG_IsOK(res3)) {
|
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
|
||||||
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "eslConnection_execute" "', argument " "3"" of type '" "char const *""'");
|
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);
|
if (items > 3) {
|
||||||
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
|
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
|
||||||
if (!SWIG_IsOK(res4)) {
|
if (!SWIG_IsOK(res4)) {
|
||||||
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "eslConnection_execute" "', argument " "4"" of type '" "char const *""'");
|
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);
|
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++ ;
|
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) -------- */
|
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
|
||||||
|
|
||||||
@ -3114,6 +3196,8 @@ static swig_command_info swig_commands[] = {
|
|||||||
{"ESLc::eslConnection_filter", _wrap_eslConnection_filter},
|
{"ESLc::eslConnection_filter", _wrap_eslConnection_filter},
|
||||||
{"ESLc::eslConnection_events", _wrap_eslConnection_events},
|
{"ESLc::eslConnection_events", _wrap_eslConnection_events},
|
||||||
{"ESLc::eslConnection_execute", _wrap_eslConnection_execute},
|
{"ESLc::eslConnection_execute", _wrap_eslConnection_execute},
|
||||||
|
{"ESLc::eslConnection_setBlockingExecute", _wrap_eslConnection_setBlockingExecute},
|
||||||
|
{"ESLc::eslConnection_setEventLock", _wrap_eslConnection_setEventLock},
|
||||||
{0,0}
|
{0,0}
|
||||||
};
|
};
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
@ -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 cmd_buf[128] = "sendmsg";
|
||||||
char app_buf[512] = "";
|
char app_buf[512] = "";
|
||||||
char arg_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] = "";
|
char send_buf[1292] = "";
|
||||||
|
|
||||||
if (!handle->connected) {
|
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(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);
|
return esl_send_recv(handle, send_buf);
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,22 @@ eslEvent *eslConnection::getInfo()
|
|||||||
return NULL;
|
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)
|
esl_status_t eslConnection::execute(const char *app, const char *arg, const char *uuid)
|
||||||
{
|
{
|
||||||
return esl_execute(&handle, app, arg, uuid);
|
return esl_execute(&handle, app, arg, uuid);
|
||||||
|
@ -270,6 +270,8 @@ typedef struct {
|
|||||||
int connected;
|
int connected;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
esl_mutex_t *mutex;
|
esl_mutex_t *mutex;
|
||||||
|
int blocking_execute;
|
||||||
|
int event_lock;
|
||||||
} esl_handle_t;
|
} esl_handle_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -83,7 +83,9 @@ class eslConnection {
|
|||||||
eslEvent *recvEventTimed(int ms);
|
eslEvent *recvEventTimed(int ms);
|
||||||
esl_status_t filter(const char *header, const char *value);
|
esl_status_t filter(const char *header, const char *value);
|
||||||
esl_status_t events(const char *etype, 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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,13 +96,13 @@
|
|||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#undef PACKAGE_VERSION
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
/* The size of `int', as computed by sizeof. */
|
/* The size of a `int', as computed by sizeof. */
|
||||||
#undef SIZEOF_INT
|
#undef SIZEOF_INT
|
||||||
|
|
||||||
/* The size of `long', as computed by sizeof. */
|
/* The size of a `long', as computed by sizeof. */
|
||||||
#undef SIZEOF_LONG
|
#undef SIZEOF_LONG
|
||||||
|
|
||||||
/* The size of `short', as computed by sizeof. */
|
/* The size of a `short', as computed by sizeof. */
|
||||||
#undef SIZEOF_SHORT
|
#undef SIZEOF_SHORT
|
||||||
|
|
||||||
/* Version extra */
|
/* Version extra */
|
||||||
@ -129,12 +129,6 @@
|
|||||||
/* Make use of alloca */
|
/* Make use of alloca */
|
||||||
#undef USE_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 */
|
/* Use KISS Fast Fourier Transform */
|
||||||
#undef USE_KISS_FFT
|
#undef USE_KISS_FFT
|
||||||
|
|
||||||
|
@ -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_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) {
|
if ((status = switch_core_session_queue_private_event(listener->session, event)) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_snprintf(reply, reply_len, "+OK");
|
switch_snprintf(reply, reply_len, "+OK");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user