diff --git a/libs/esl/lua/esl_wrap.cpp b/libs/esl/lua/esl_wrap.cpp index fbd0423c51..7aa2a82d0d 100644 --- a/libs/esl/lua/esl_wrap.cpp +++ b/libs/esl/lua/esl_wrap.cpp @@ -2632,22 +2632,60 @@ fail: } -static int _wrap_ESLconnection_setBlockingExecute(lua_State* L) { +static int _wrap_ESLconnection_executeAsync(lua_State* L) { + int SWIG_arg = -1; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + int result; + + SWIG_check_num_args("executeAsync",2,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeAsync",1,"ESLconnection *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("executeAsync",2,"char const *"); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("executeAsync",3,"char const *"); + if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("executeAsync",4,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){ + SWIG_fail_ptr("ESLconnection_executeAsync",1,SWIGTYPE_p_ESLconnection); + } + + arg2 = (char *)lua_tostring(L, 2); + if(lua_gettop(L)>=3){ + arg3 = (char *)lua_tostring(L, 3); + } + if(lua_gettop(L)>=4){ + arg4 = (char *)lua_tostring(L, 4); + } + result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4); + 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_ESLconnection_setAsyncExecute(lua_State* L) { int SWIG_arg = -1; ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; int result; - SWIG_check_num_args("setBlockingExecute",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setBlockingExecute",1,"ESLconnection *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("setBlockingExecute",2,"char const *"); + SWIG_check_num_args("setAsyncExecute",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setAsyncExecute",1,"ESLconnection *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("setAsyncExecute",2,"char const *"); if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLconnection,0))){ - SWIG_fail_ptr("ESLconnection_setBlockingExecute",1,SWIGTYPE_p_ESLconnection); + SWIG_fail_ptr("ESLconnection_setAsyncExecute",1,SWIGTYPE_p_ESLconnection); } arg2 = (char *)lua_tostring(L, 2); - result = (int)(arg1)->setBlockingExecute((char const *)arg2); + result = (int)(arg1)->setAsyncExecute((char const *)arg2); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; @@ -2730,7 +2768,8 @@ static swig_lua_method swig_ESLconnection_methods[] = { {"filter", _wrap_ESLconnection_filter}, {"events", _wrap_ESLconnection_events}, {"execute", _wrap_ESLconnection_execute}, - {"setBlockingExecute", _wrap_ESLconnection_setBlockingExecute}, + {"executeAsync", _wrap_ESLconnection_executeAsync}, + {"setAsyncExecute", _wrap_ESLconnection_setAsyncExecute}, {"setEventLock", _wrap_ESLconnection_setEventLock}, {"disconnect", _wrap_ESLconnection_disconnect}, {0,0} diff --git a/libs/esl/perl/ESL.pm b/libs/esl/perl/ESL.pm index 1de505c619..9da5768fbd 100644 --- a/libs/esl/perl/ESL.pm +++ b/libs/esl/perl/ESL.pm @@ -140,7 +140,8 @@ sub DESTROY { *filter = *ESLc::ESLconnection_filter; *events = *ESLc::ESLconnection_events; *execute = *ESLc::ESLconnection_execute; -*setBlockingExecute = *ESLc::ESLconnection_setBlockingExecute; +*executeAsync = *ESLc::ESLconnection_executeAsync; +*setAsyncExecute = *ESLc::ESLconnection_setAsyncExecute; *setEventLock = *ESLc::ESLconnection_setEventLock; *disconnect = *ESLc::ESLconnection_disconnect; sub DISOWN { diff --git a/libs/esl/perl/ESL/IVR.pm b/libs/esl/perl/ESL/IVR.pm new file mode 100644 index 0000000000..f2da4330bd --- /dev/null +++ b/libs/esl/perl/ESL/IVR.pm @@ -0,0 +1,88 @@ +package ESL::IVR; +use ESL; +use Data::Dumper; + +sub new($$) { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = {}; + + $self->{_esl} = new ESL::ESLconnection(fileno(STDIN)); + $self->{_info} = $self->{_esl}->getInfo(); + $self->{_uuid} = $self->{_info}->getHeader("unique-id"); + + return bless($self, $class); + +} + +sub getHeader($;) { + my $self = shift; + + return $self->{_info} ? $self->{_info}->getHeader(shift) : undef; +} + +sub execute($;) { + my $self = shift; + return $self->{_esl}->execute(@_); +} + +sub api($;) { + my $self = shift; + return $self->{_esl}->api(@_); +} + +sub disconnect($;) { + my $self = shift; + return $self->{_esl}->disconnect(@_); +} + +sub getVar($;) { + my $self = shift; + my ($var) = @_; + my $e = $self->api("uuid_getvar", "$self->{_uuid} $var"); + my $input; + + if ($e) { + $input = $e->getBody() . "\n"; + if ($input eq "_undef_") { + $input = undef; + } + } + + chomp $input; + + return $input; + +} + +sub playAndGetDigits($;) { + my $self = shift; + my ($min, $max, $tries, $to, $term, $file, $invalid_file, $var) = @_; + + $self->execute("play_and_get_digits", "$min $max $tries $to $term $file $invalid_file $var"); + + return $self->getVar($var); + +} + +sub read($;) { + my $self = shift; + my ($min, $max, $file, $var, $to, $term) = @_; + + $self->execute("read", "$min $max $file $var $to $term"); + + return $self->getVar($var); + +} + +sub playback($;) { + my $self = shift; + my ($file) = @_; + + $self->execute("playback", $file); + return $self->getVar("playback_terminators_used"); + +} + + +1; diff --git a/libs/esl/perl/esl_wrap.cpp b/libs/esl/perl/esl_wrap.cpp index ee6e3d7d5e..ff0c736341 100644 --- a/libs/esl/perl/esl_wrap.cpp +++ b/libs/esl/perl/esl_wrap.cpp @@ -3252,7 +3252,72 @@ XS(_wrap_ESLconnection_execute) { } -XS(_wrap_ESLconnection_setBlockingExecute) { +XS(_wrap_ESLconnection_executeAsync) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 4)) { + SWIG_croak("Usage: ESLconnection_executeAsync(self,app,arg,uuid);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', 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_executeAsync" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (items > 2) { + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (items > 3) { + res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_setAsyncExecute) { { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; @@ -3266,19 +3331,19 @@ XS(_wrap_ESLconnection_setBlockingExecute) { dXSARGS; if ((items < 2) || (items > 2)) { - SWIG_croak("Usage: ESLconnection_setBlockingExecute(self,val);"); + SWIG_croak("Usage: ESLconnection_setAsyncExecute(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 *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', 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 *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); - result = (int)(arg1)->setBlockingExecute((char const *)arg2); + result = (int)(arg1)->setAsyncExecute((char const *)arg2); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; if (alloc2 == SWIG_NEWOBJ) delete[] buf2; @@ -3461,7 +3526,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_executeAsync", _wrap_ESLconnection_executeAsync}, +{"ESLc::ESLconnection_setAsyncExecute", _wrap_ESLconnection_setAsyncExecute}, {"ESLc::ESLconnection_setEventLock", _wrap_ESLconnection_setEventLock}, {"ESLc::ESLconnection_disconnect", _wrap_ESLconnection_disconnect}, {"ESLc::eslSetLogLevel", _wrap_eslSetLogLevel}, diff --git a/libs/esl/php/ESL.php b/libs/esl/php/ESL.php index 1f9d11f234..12afaeb718 100644 --- a/libs/esl/php/ESL.php +++ b/libs/esl/php/ESL.php @@ -187,8 +187,17 @@ class ESLconnection { return $r; } - function setBlockingExecute($val) { - return ESLconnection_setBlockingExecute($this->_cPtr,$val); + function executeAsync($app,$arg=null,$uuid=null) { + switch (func_num_args()) { + case 1: $r=ESLconnection_executeAsync($this->_cPtr,$app); break; + case 2: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg); break; + default: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg,$uuid); + } + return $r; + } + + function setAsyncExecute($val) { + return ESLconnection_setAsyncExecute($this->_cPtr,$val); } function setEventLock($val) { diff --git a/libs/esl/php/esl_wrap.cpp b/libs/esl/php/esl_wrap.cpp index 7d4df3b363..6ef33ae932 100644 --- a/libs/esl/php/esl_wrap.cpp +++ b/libs/esl/php/esl_wrap.cpp @@ -2247,7 +2247,58 @@ fail: } -ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setBlockingExecute) { +ZEND_NAMED_FUNCTION(_wrap_ESLconnection_executeAsync) { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + int result; + zval **args[4]; + int arg_count; + + SWIG_ResetError(); + arg_count = ZEND_NUM_ARGS(); + if(arg_count<2 || arg_count>4 || + zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) + WRONG_PARAM_COUNT; + + { + if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_executeAsync. Expected SWIGTYPE_p_ESLconnection"); + } + } + if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); + + /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/ + convert_to_string_ex(args[1]); + arg2 = (char *) Z_STRVAL_PP(args[1]); + /*@SWIG@*/; + + if(arg_count > 2) { + /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/ + convert_to_string_ex(args[2]); + arg3 = (char *) Z_STRVAL_PP(args[2]); + /*@SWIG@*/; + + } + if(arg_count > 3) { + /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/ + convert_to_string_ex(args[3]); + arg4 = (char *) Z_STRVAL_PP(args[3]); + /*@SWIG@*/; + + } + result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4); + { + ZVAL_LONG(return_value,result); + } + return; +fail: + zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg()); +} + + +ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setAsyncExecute) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; int result; @@ -2260,7 +2311,7 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setBlockingExecute) { { if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLconnection, 0) < 0) { - SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setBlockingExecute. Expected SWIGTYPE_p_ESLconnection"); + SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLconnection_setAsyncExecute. Expected SWIGTYPE_p_ESLconnection"); } } if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL"); @@ -2270,7 +2321,7 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setBlockingExecute) { arg2 = (char *) Z_STRVAL_PP(args[1]); /*@SWIG@*/; - result = (int)(arg1)->setBlockingExecute((char const *)arg2); + result = (int)(arg1)->setAsyncExecute((char const *)arg2); { ZVAL_LONG(return_value,result); } @@ -2415,7 +2466,8 @@ static zend_function_entry ESL_functions[] = { SWIG_ZEND_NAMED_FE(eslconnection_filter,_wrap_ESLconnection_filter,NULL) SWIG_ZEND_NAMED_FE(eslconnection_events,_wrap_ESLconnection_events,NULL) SWIG_ZEND_NAMED_FE(eslconnection_execute,_wrap_ESLconnection_execute,NULL) - SWIG_ZEND_NAMED_FE(eslconnection_setblockingexecute,_wrap_ESLconnection_setBlockingExecute,NULL) + SWIG_ZEND_NAMED_FE(eslconnection_executeasync,_wrap_ESLconnection_executeAsync,NULL) + SWIG_ZEND_NAMED_FE(eslconnection_setasyncexecute,_wrap_ESLconnection_setAsyncExecute,NULL) SWIG_ZEND_NAMED_FE(eslconnection_seteventlock,_wrap_ESLconnection_setEventLock,NULL) SWIG_ZEND_NAMED_FE(eslconnection_disconnect,_wrap_ESLconnection_disconnect,NULL) SWIG_ZEND_NAMED_FE(eslsetloglevel,_wrap_eslSetLogLevel,NULL) diff --git a/libs/esl/php/php_ESL.h b/libs/esl/php/php_ESL.h index 2b47252819..3f0109619f 100644 --- a/libs/esl/php/php_ESL.h +++ b/libs/esl/php/php_ESL.h @@ -62,7 +62,8 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_recvEventTimed); ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter); ZEND_NAMED_FUNCTION(_wrap_ESLconnection_events); ZEND_NAMED_FUNCTION(_wrap_ESLconnection_execute); -ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setBlockingExecute); +ZEND_NAMED_FUNCTION(_wrap_ESLconnection_executeAsync); +ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setAsyncExecute); ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setEventLock); ZEND_NAMED_FUNCTION(_wrap_ESLconnection_disconnect); ZEND_NAMED_FUNCTION(_wrap_eslSetLogLevel); diff --git a/libs/esl/python/ESL.py b/libs/esl/python/ESL.py index 0da26865ef..ad81ff2b7d 100644 --- a/libs/esl/python/ESL.py +++ b/libs/esl/python/ESL.py @@ -89,7 +89,8 @@ class ESLconnection: def filter(*args): return apply(_ESL.ESLconnection_filter, args) def events(*args): return apply(_ESL.ESLconnection_events, args) def execute(*args): return apply(_ESL.ESLconnection_execute, args) - def setBlockingExecute(*args): return apply(_ESL.ESLconnection_setBlockingExecute, args) + def executeAsync(*args): return apply(_ESL.ESLconnection_executeAsync, args) + def setAsyncExecute(*args): return apply(_ESL.ESLconnection_setAsyncExecute, args) def setEventLock(*args): return apply(_ESL.ESLconnection_setEventLock, args) def disconnect(*args): return apply(_ESL.ESLconnection_disconnect, args) ESLconnection_swigregister = _ESL.ESLconnection_swigregister diff --git a/libs/esl/python/esl_wrap.cpp b/libs/esl/python/esl_wrap.cpp index a4a89fe136..cd2a658c55 100644 --- a/libs/esl/python/esl_wrap.cpp +++ b/libs/esl/python/esl_wrap.cpp @@ -4105,7 +4105,69 @@ fail: } -SWIGINTERN PyObject *_wrap_ESLconnection_setBlockingExecute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_ESLconnection_executeAsync(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO|OO:ESLconnection_executeAsync",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (obj2) { + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (obj3) { + res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ESLconnection_setAsyncExecute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; @@ -4118,18 +4180,18 @@ SWIGINTERN PyObject *_wrap_ESLconnection_setBlockingExecute(PyObject *SWIGUNUSED PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_setBlockingExecute",&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OO:ESLconnection_setAsyncExecute",&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &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 *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', argument " "1"" of type '" "ESLconnection *""'"); } arg1 = reinterpret_cast< ESLconnection * >(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'"); } arg2 = reinterpret_cast< char * >(buf2); - result = (int)(arg1)->setBlockingExecute((char const *)arg2); + result = (int)(arg1)->setAsyncExecute((char const *)arg2); resultobj = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return resultobj; @@ -4257,7 +4319,8 @@ static PyMethodDef SwigMethods[] = { { (char *)"ESLconnection_filter", _wrap_ESLconnection_filter, METH_VARARGS, NULL}, { (char *)"ESLconnection_events", _wrap_ESLconnection_events, METH_VARARGS, NULL}, { (char *)"ESLconnection_execute", _wrap_ESLconnection_execute, METH_VARARGS, NULL}, - { (char *)"ESLconnection_setBlockingExecute", _wrap_ESLconnection_setBlockingExecute, METH_VARARGS, NULL}, + { (char *)"ESLconnection_executeAsync", _wrap_ESLconnection_executeAsync, METH_VARARGS, NULL}, + { (char *)"ESLconnection_setAsyncExecute", _wrap_ESLconnection_setAsyncExecute, METH_VARARGS, NULL}, { (char *)"ESLconnection_setEventLock", _wrap_ESLconnection_setEventLock, METH_VARARGS, NULL}, { (char *)"ESLconnection_disconnect", _wrap_ESLconnection_disconnect, METH_VARARGS, NULL}, { (char *)"ESLconnection_swigregister", ESLconnection_swigregister, METH_VARARGS, NULL}, diff --git a/libs/esl/ruby/esl_wrap.cpp b/libs/esl/ruby/esl_wrap.cpp index b1a2ea06d4..84a655912e 100644 --- a/libs/esl/ruby/esl_wrap.cpp +++ b/libs/esl/ruby/esl_wrap.cpp @@ -3236,7 +3236,68 @@ fail: SWIGINTERN VALUE -_wrap_ESLconnection_setBlockingExecute(int argc, VALUE *argv, VALUE self) { +_wrap_ESLconnection_executeAsync(int argc, VALUE *argv, VALUE self) { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + VALUE vresult = Qnil; + + if ((argc < 1) || (argc > 3)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","executeAsync", 1, self )); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","executeAsync", 2, argv[0] )); + } + arg2 = reinterpret_cast< char * >(buf2); + if (argc > 1) { + res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","executeAsync", 3, argv[1] )); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (argc > 2) { + res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","executeAsync", 4, argv[2] )); + } + arg4 = reinterpret_cast< char * >(buf4); + } + result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4); + vresult = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return vresult; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_ESLconnection_setAsyncExecute(int argc, VALUE *argv, VALUE self) { ESLconnection *arg1 = (ESLconnection *) 0 ; char *arg2 = (char *) 0 ; int result; @@ -3252,15 +3313,15 @@ _wrap_ESLconnection_setBlockingExecute(int argc, VALUE *argv, VALUE self) { } res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","setBlockingExecute", 1, self )); + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLconnection *","setAsyncExecute", 1, self )); } arg1 = reinterpret_cast< ESLconnection * >(argp1); res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","setBlockingExecute", 2, argv[0] )); + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","setAsyncExecute", 2, argv[0] )); } arg2 = reinterpret_cast< char * >(buf2); - result = (int)(arg1)->setBlockingExecute((char const *)arg2); + result = (int)(arg1)->setAsyncExecute((char const *)arg2); vresult = SWIG_From_int(static_cast< int >(result)); if (alloc2 == SWIG_NEWOBJ) delete[] buf2; return vresult; @@ -3680,7 +3741,8 @@ SWIGEXPORT void Init_ESL(void) { rb_define_method(cESLconnection.klass, "filter", VALUEFUNC(_wrap_ESLconnection_filter), -1); rb_define_method(cESLconnection.klass, "events", VALUEFUNC(_wrap_ESLconnection_events), -1); rb_define_method(cESLconnection.klass, "execute", VALUEFUNC(_wrap_ESLconnection_execute), -1); - rb_define_method(cESLconnection.klass, "setBlockingExecute", VALUEFUNC(_wrap_ESLconnection_setBlockingExecute), -1); + rb_define_method(cESLconnection.klass, "executeAsync", VALUEFUNC(_wrap_ESLconnection_executeAsync), -1); + rb_define_method(cESLconnection.klass, "setAsyncExecute", VALUEFUNC(_wrap_ESLconnection_setAsyncExecute), -1); rb_define_method(cESLconnection.klass, "setEventLock", VALUEFUNC(_wrap_ESLconnection_setEventLock), -1); rb_define_method(cESLconnection.klass, "disconnect", VALUEFUNC(_wrap_ESLconnection_disconnect), -1); cESLconnection.mark = 0; diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index a0f360e320..54ee10acb1 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -451,7 +451,7 @@ ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, con char app_buf[512] = ""; char arg_buf[512] = ""; const char *el_buf = "event-lock: true\n"; - const char *bl_buf = "blocking: true\n"; + const char *bl_buf = "async: true\n"; char send_buf[1292] = ""; if (!handle->connected) { @@ -471,7 +471,7 @@ ESL_DECLARE(esl_status_t) esl_execute(esl_handle_t *handle, const char *app, con } 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 : "", handle->blocking_execute ? bl_buf : ""); + cmd_buf, app_buf, arg_buf, handle->event_lock ? el_buf : "", handle->async_execute ? bl_buf : ""); return esl_send_recv(handle, send_buf); } diff --git a/libs/esl/src/esl_oop.cpp b/libs/esl/src/esl_oop.cpp index e839a0a60f..e7168938ca 100644 --- a/libs/esl/src/esl_oop.cpp +++ b/libs/esl/src/esl_oop.cpp @@ -131,12 +131,12 @@ ESLevent *ESLconnection::getInfo() return NULL; } -int ESLconnection::setBlockingExecute(const char *val) +int ESLconnection::setAsyncExecute(const char *val) { if (val) { - handle.blocking_execute = esl_true(val); + handle.async_execute = esl_true(val); } - return handle.blocking_execute; + return handle.async_execute; } int ESLconnection::setEventLock(const char *val) @@ -152,6 +152,19 @@ int ESLconnection::execute(const char *app, const char *arg, const char *uuid) return esl_execute(&handle, app, arg, uuid); } + +int ESLconnection::executeAsync(const char *app, const char *arg, const char *uuid) +{ + int async = handle.async_execute; + int r; + + handle.async_execute = 1; + r = esl_execute(&handle, app, arg, uuid); + handle.async_execute = async; + + return r; +} + int ESLconnection::sendEvent(ESLevent *send_me) { return esl_sendevent(&handle, send_me->event); diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index a43ff6db22..ecca190849 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -272,7 +272,7 @@ typedef struct { int connected; struct sockaddr_in addr; esl_mutex_t *mutex; - int blocking_execute; + int async_execute; int event_lock; } esl_handle_t; diff --git a/libs/esl/src/include/esl_oop.h b/libs/esl/src/include/esl_oop.h index e9eff6f315..840b0ef99e 100644 --- a/libs/esl/src/include/esl_oop.h +++ b/libs/esl/src/include/esl_oop.h @@ -88,7 +88,8 @@ class ESLconnection { ESLevent *filter(const char *header, const char *value); int events(const char *etype, const char *value); int execute(const char *app, const char *arg = NULL, const char *uuid = NULL); - int setBlockingExecute(const char *val); + int executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL); + int setAsyncExecute(const char *val); int setEventLock(const char *val); int disconnect(void); };