[Freeswitch-svn] [commit] r12760 - in freeswitch/trunk/libs/esl: lua perl perl/ESL php python ruby src src/include
FreeSWITCH SVN
anthm at freeswitch.org
Tue Mar 24 11:03:26 PDT 2009
Author: anthm
Date: Tue Mar 24 13:03:26 2009
New Revision: 12760
Log:
match ESL to last commit and check in ESL::IVR perl mod
Added:
freeswitch/trunk/libs/esl/perl/ESL/
freeswitch/trunk/libs/esl/perl/ESL/IVR.pm
Modified:
freeswitch/trunk/libs/esl/lua/esl_wrap.cpp
freeswitch/trunk/libs/esl/perl/ESL.pm
freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
freeswitch/trunk/libs/esl/php/ESL.php
freeswitch/trunk/libs/esl/php/esl_wrap.cpp
freeswitch/trunk/libs/esl/php/php_ESL.h
freeswitch/trunk/libs/esl/python/ESL.py
freeswitch/trunk/libs/esl/python/esl_wrap.cpp
freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp
freeswitch/trunk/libs/esl/src/esl.c
freeswitch/trunk/libs/esl/src/esl_oop.cpp
freeswitch/trunk/libs/esl/src/include/esl.h
freeswitch/trunk/libs/esl/src/include/esl_oop.h
Modified: freeswitch/trunk/libs/esl/lua/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/lua/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/lua/esl_wrap.cpp Tue Mar 24 13:03:26 2009
@@ -2632,22 +2632,60 @@
}
-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("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("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_setBlockingExecute",1,SWIGTYPE_p_ESLconnection);
+ SWIG_fail_ptr("ESLconnection_executeAsync",1,SWIGTYPE_p_ESLconnection);
}
arg2 = (char *)lua_tostring(L, 2);
- result = (int)(arg1)->setBlockingExecute((char const *)arg2);
+ 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("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_setAsyncExecute",1,SWIGTYPE_p_ESLconnection);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ 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 @@
{"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}
Modified: freeswitch/trunk/libs/esl/perl/ESL.pm
==============================================================================
--- freeswitch/trunk/libs/esl/perl/ESL.pm (original)
+++ freeswitch/trunk/libs/esl/perl/ESL.pm Tue Mar 24 13:03:26 2009
@@ -140,7 +140,8 @@
*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 {
Added: freeswitch/trunk/libs/esl/perl/ESL/IVR.pm
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/esl/perl/ESL/IVR.pm Tue Mar 24 13:03:26 2009
@@ -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;
Modified: freeswitch/trunk/libs/esl/perl/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/perl/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/perl/esl_wrap.cpp Tue Mar 24 13:03:26 2009
@@ -3252,7 +3252,72 @@
}
-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 @@
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 @@
{"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},
Modified: freeswitch/trunk/libs/esl/php/ESL.php
==============================================================================
--- freeswitch/trunk/libs/esl/php/ESL.php (original)
+++ freeswitch/trunk/libs/esl/php/ESL.php Tue Mar 24 13:03:26 2009
@@ -187,8 +187,17 @@
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) {
Modified: freeswitch/trunk/libs/esl/php/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/php/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/php/esl_wrap.cpp Tue Mar 24 13:03:26 2009
@@ -2247,7 +2247,58 @@
}
-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 @@
{
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 @@
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 @@
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)
Modified: freeswitch/trunk/libs/esl/php/php_ESL.h
==============================================================================
--- freeswitch/trunk/libs/esl/php/php_ESL.h (original)
+++ freeswitch/trunk/libs/esl/php/php_ESL.h Tue Mar 24 13:03:26 2009
@@ -62,7 +62,8 @@
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);
Modified: freeswitch/trunk/libs/esl/python/ESL.py
==============================================================================
--- freeswitch/trunk/libs/esl/python/ESL.py (original)
+++ freeswitch/trunk/libs/esl/python/ESL.py Tue Mar 24 13:03:26 2009
@@ -89,7 +89,8 @@
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
Modified: freeswitch/trunk/libs/esl/python/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/python/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/python/esl_wrap.cpp Tue Mar 24 13:03:26 2009
@@ -4105,31 +4105,93 @@
}
-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:ESLconnection_setBlockingExecute",&obj0,&obj1)) SWIG_fail;
+ 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_setBlockingExecute" "', argument " "1"" of type '" "ESLconnection *""'");
+ 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_setBlockingExecute" "', argument " "2"" of type '" "char const *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
- result = (int)(arg1)->setBlockingExecute((char const *)arg2);
+ 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 ;
+ int result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ 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_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_setAsyncExecute" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ 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 @@
{ (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},
Modified: freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp (original)
+++ freeswitch/trunk/libs/esl/ruby/esl_wrap.cpp Tue Mar 24 13:03:26 2009
@@ -3236,7 +3236,68 @@
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 @@
}
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 @@
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;
Modified: freeswitch/trunk/libs/esl/src/esl.c
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl.c (original)
+++ freeswitch/trunk/libs/esl/src/esl.c Tue Mar 24 13:03:26 2009
@@ -451,7 +451,7 @@
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 @@
}
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);
}
Modified: freeswitch/trunk/libs/esl/src/esl_oop.cpp
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl_oop.cpp (original)
+++ freeswitch/trunk/libs/esl/src/esl_oop.cpp Tue Mar 24 13:03:26 2009
@@ -131,12 +131,12 @@
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 @@
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);
Modified: freeswitch/trunk/libs/esl/src/include/esl.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl.h (original)
+++ freeswitch/trunk/libs/esl/src/include/esl.h Tue Mar 24 13:03:26 2009
@@ -272,7 +272,7 @@
int connected;
struct sockaddr_in addr;
esl_mutex_t *mutex;
- int blocking_execute;
+ int async_execute;
int event_lock;
} esl_handle_t;
Modified: freeswitch/trunk/libs/esl/src/include/esl_oop.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl_oop.h (original)
+++ freeswitch/trunk/libs/esl/src/include/esl_oop.h Tue Mar 24 13:03:26 2009
@@ -88,7 +88,8 @@
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);
};
More information about the Freeswitch-svn
mailing list