change api to return event on filter command
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12488 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
734b2d3b82
commit
f3acb35505
|
@ -2537,7 +2537,7 @@ static int _wrap_ESLconnection_filter(lua_State* L) {
|
||||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
char *arg3 = (char *) 0 ;
|
char *arg3 = (char *) 0 ;
|
||||||
int result;
|
ESLevent *result = 0 ;
|
||||||
|
|
||||||
SWIG_check_num_args("filter",3,3)
|
SWIG_check_num_args("filter",3,3)
|
||||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("filter",1,"ESLconnection *");
|
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("filter",1,"ESLconnection *");
|
||||||
|
@ -2550,9 +2550,9 @@ static int _wrap_ESLconnection_filter(lua_State* L) {
|
||||||
|
|
||||||
arg2 = (char *)lua_tostring(L, 2);
|
arg2 = (char *)lua_tostring(L, 2);
|
||||||
arg3 = (char *)lua_tostring(L, 3);
|
arg3 = (char *)lua_tostring(L, 3);
|
||||||
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
||||||
SWIG_arg=0;
|
SWIG_arg=0;
|
||||||
lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
|
SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,0); SWIG_arg++;
|
||||||
return SWIG_arg;
|
return SWIG_arg;
|
||||||
|
|
||||||
if(0) SWIG_fail;
|
if(0) SWIG_fail;
|
||||||
|
|
|
@ -3092,7 +3092,7 @@ XS(_wrap_ESLconnection_filter) {
|
||||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
char *arg3 = (char *) 0 ;
|
char *arg3 = (char *) 0 ;
|
||||||
int result;
|
ESLevent *result = 0 ;
|
||||||
void *argp1 = 0 ;
|
void *argp1 = 0 ;
|
||||||
int res1 = 0 ;
|
int res1 = 0 ;
|
||||||
int res2 ;
|
int res2 ;
|
||||||
|
@ -3122,8 +3122,8 @@ XS(_wrap_ESLconnection_filter) {
|
||||||
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
|
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
|
||||||
}
|
}
|
||||||
arg3 = reinterpret_cast< char * >(buf3);
|
arg3 = reinterpret_cast< char * >(buf3);
|
||||||
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
||||||
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
|
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ;
|
||||||
|
|
||||||
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
|
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
|
||||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||||
|
|
|
@ -26,7 +26,17 @@ for(;;) {
|
||||||
|
|
||||||
printf "Connected call %s, from %s\n", $uuid, $info->getHeader("caller-caller-id-number");
|
printf "Connected call %s, from %s\n", $uuid, $info->getHeader("caller-caller-id-number");
|
||||||
|
|
||||||
$con->sendRecv("myevents");
|
$e = $con->filter("unique-id", $uuid);
|
||||||
|
if ($e) {
|
||||||
|
print $e->serialize();
|
||||||
|
} else {
|
||||||
|
printf("WTF?\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$con->events("plain", "all");
|
||||||
|
|
||||||
|
|
||||||
|
#$con->sendRecv("myevents");
|
||||||
$con->execute("answer");
|
$con->execute("answer");
|
||||||
$con->execute("playback", "/ram/swimp.raw");
|
$con->execute("playback", "/ram/swimp.raw");
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,8 @@ class ESLconnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
function filter($header,$value) {
|
function filter($header,$value) {
|
||||||
return ESLconnection_filter($this->_cPtr,$header,$value);
|
$r=ESLconnection_filter($this->_cPtr,$header,$value);
|
||||||
|
return is_resource($r) ? new ESLevent($r) : $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
function events($etype,$value) {
|
function events($etype,$value) {
|
||||||
|
|
|
@ -2120,7 +2120,7 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter) {
|
||||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
char *arg3 = (char *) 0 ;
|
char *arg3 = (char *) 0 ;
|
||||||
int result;
|
ESLevent *result = 0 ;
|
||||||
zval **args[3];
|
zval **args[3];
|
||||||
|
|
||||||
SWIG_ResetError();
|
SWIG_ResetError();
|
||||||
|
@ -2146,9 +2146,9 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_filter) {
|
||||||
arg3 = (char *) Z_STRVAL_PP(args[2]);
|
arg3 = (char *) Z_STRVAL_PP(args[2]);
|
||||||
/*@SWIG@*/;
|
/*@SWIG@*/;
|
||||||
|
|
||||||
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
||||||
{
|
{
|
||||||
ZVAL_LONG(return_value,result);
|
SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -3956,7 +3956,7 @@ SWIGINTERN PyObject *_wrap_ESLconnection_filter(PyObject *SWIGUNUSEDPARM(self),
|
||||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
char *arg3 = (char *) 0 ;
|
char *arg3 = (char *) 0 ;
|
||||||
int result;
|
ESLevent *result = 0 ;
|
||||||
void *argp1 = 0 ;
|
void *argp1 = 0 ;
|
||||||
int res1 = 0 ;
|
int res1 = 0 ;
|
||||||
int res2 ;
|
int res2 ;
|
||||||
|
@ -3985,8 +3985,8 @@ SWIGINTERN PyObject *_wrap_ESLconnection_filter(PyObject *SWIGUNUSEDPARM(self),
|
||||||
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
|
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
|
||||||
}
|
}
|
||||||
arg3 = reinterpret_cast< char * >(buf3);
|
arg3 = reinterpret_cast< char * >(buf3);
|
||||||
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
||||||
resultobj = SWIG_From_int(static_cast< int >(result));
|
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
|
||||||
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
|
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
|
||||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||||
return resultobj;
|
return resultobj;
|
||||||
|
|
|
@ -3087,7 +3087,7 @@ _wrap_ESLconnection_filter(int argc, VALUE *argv, VALUE self) {
|
||||||
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
ESLconnection *arg1 = (ESLconnection *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
char *arg3 = (char *) 0 ;
|
char *arg3 = (char *) 0 ;
|
||||||
int result;
|
ESLevent *result = 0 ;
|
||||||
void *argp1 = 0 ;
|
void *argp1 = 0 ;
|
||||||
int res1 = 0 ;
|
int res1 = 0 ;
|
||||||
int res2 ;
|
int res2 ;
|
||||||
|
@ -3116,8 +3116,8 @@ _wrap_ESLconnection_filter(int argc, VALUE *argv, VALUE self) {
|
||||||
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","filter", 3, argv[1] ));
|
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","filter", 3, argv[1] ));
|
||||||
}
|
}
|
||||||
arg3 = reinterpret_cast< char * >(buf3);
|
arg3 = reinterpret_cast< char * >(buf3);
|
||||||
result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
|
||||||
vresult = SWIG_From_int(static_cast< int >(result));
|
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | 0 );
|
||||||
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
|
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
|
||||||
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
|
||||||
return vresult;
|
return vresult;
|
||||||
|
|
|
@ -189,9 +189,18 @@ ESLevent *ESLconnection::recvEventTimed(int ms)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ESLconnection::filter(const char *header, const char *value)
|
ESLevent *ESLconnection::filter(const char *header, const char *value)
|
||||||
{
|
{
|
||||||
return esl_filter(&handle, header, value);
|
esl_status_t status = esl_filter(&handle, header, value);
|
||||||
|
|
||||||
|
if (status == ESL_SUCCESS && handle.last_sr_event) {
|
||||||
|
esl_event_t *event;
|
||||||
|
esl_event_dup(&event, handle.last_sr_event);
|
||||||
|
return new ESLevent(event, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ESLconnection::events(const char *etype, const char *value)
|
int ESLconnection::events(const char *etype, const char *value)
|
||||||
|
|
|
@ -86,7 +86,7 @@ class ESLconnection {
|
||||||
int sendEvent(ESLevent *send_me);
|
int sendEvent(ESLevent *send_me);
|
||||||
ESLevent *recvEvent();
|
ESLevent *recvEvent();
|
||||||
ESLevent *recvEventTimed(int ms);
|
ESLevent *recvEventTimed(int ms);
|
||||||
int filter(const char *header, const char *value);
|
ESLevent *filter(const char *header, const char *value);
|
||||||
int events(const char *etype, 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 execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
|
||||||
int setBlockingExecute(const char *val);
|
int setBlockingExecute(const char *val);
|
||||||
|
|
Loading…
Reference in New Issue