mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 20:51:58 +00:00
fix callback arg and CoreSession::sleep to not require a file
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9004 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -51,6 +51,8 @@ bool Session::end_allow_threads()
|
||||
void Session::setLUA(lua_State * state)
|
||||
{
|
||||
L = state;
|
||||
lua_setglobal(L, uuid);
|
||||
lua_getfield(L, LUA_GLOBALSINDEX, uuid);
|
||||
}
|
||||
|
||||
lua_State *Session::getLUA()
|
||||
@@ -180,9 +182,11 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
{
|
||||
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
|
||||
char str[2] = "";
|
||||
int arg_count = 2;
|
||||
int arg_count = 3;
|
||||
|
||||
lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
|
||||
lua_getfield(L, LUA_GLOBALSINDEX, uuid);
|
||||
|
||||
lua_pushstring(L, "dtmf");
|
||||
|
||||
lua_newtable(L);
|
||||
@@ -210,9 +214,11 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
case SWITCH_INPUT_TYPE_EVENT:
|
||||
{
|
||||
switch_event_t *event = (switch_event_t *) input;
|
||||
int arg_count = 2;
|
||||
int arg_count = 3;
|
||||
|
||||
|
||||
lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
|
||||
lua_getfield(L, LUA_GLOBALSINDEX, uuid);
|
||||
lua_pushstring(L, "event");
|
||||
mod_lua_conjure_event(L, event, "__Input_Event__", 1);
|
||||
lua_getfield(L, LUA_GLOBALSINDEX, "__Input_Event__");
|
||||
@@ -222,8 +228,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
arg_count++;
|
||||
}
|
||||
|
||||
lua_call(L, 2, 1);
|
||||
|
||||
lua_call(L, arg_count, 1);
|
||||
ret = lua_tostring(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class Session : public CoreSession {
|
||||
virtual void check_hangup_hook();
|
||||
|
||||
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
|
||||
void setInputCallback(char *cbfunc, char *funcargs);
|
||||
void setInputCallback(char *cbfunc, char *funcargs = NULL);
|
||||
void setHangupHook(char *func, char *arg = NULL);
|
||||
bool ready();
|
||||
|
||||
|
||||
@@ -5729,22 +5729,19 @@ static int _wrap_CoreSession_streamFile(lua_State* L) {
|
||||
static int _wrap_CoreSession_sleep(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
int arg3 ;
|
||||
int arg2 ;
|
||||
int result;
|
||||
|
||||
SWIG_check_num_args("sleep",3,3)
|
||||
SWIG_check_num_args("sleep",2,2)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sleep",1,"CoreSession *");
|
||||
if(!lua_isstring(L,2)) SWIG_fail_arg("sleep",2,"char *");
|
||||
if(!lua_isnumber(L,3)) SWIG_fail_arg("sleep",3,"int");
|
||||
if(!lua_isnumber(L,2)) SWIG_fail_arg("sleep",2,"int");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
|
||||
SWIG_fail_ptr("CoreSession_sleep",1,SWIGTYPE_p_CoreSession);
|
||||
}
|
||||
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
arg3 = (int)lua_tonumber(L, 3);
|
||||
result = (int)(arg1)->sleep(arg2,arg3);
|
||||
arg2 = (int)lua_tonumber(L, 2);
|
||||
result = (int)(arg1)->sleep(arg2);
|
||||
SWIG_arg=0;
|
||||
lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
@@ -6786,7 +6783,7 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Session_setInputCallback(lua_State* L) {
|
||||
static int _wrap_Session_setInputCallback__SWIG_0(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
LUA::Session *arg1 = (LUA::Session *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
@@ -6816,6 +6813,89 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Session_setInputCallback__SWIG_1(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
LUA::Session *arg1 = (LUA::Session *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
|
||||
SWIG_check_num_args("setInputCallback",2,2)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *");
|
||||
if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
|
||||
SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session);
|
||||
}
|
||||
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
(arg1)->setInputCallback(arg2);
|
||||
SWIG_arg=0;
|
||||
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
||||
fail:
|
||||
lua_error(L);
|
||||
return SWIG_arg;
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Session_setInputCallback(lua_State* L) {
|
||||
int argc;
|
||||
int argv[4]={
|
||||
1,2,3,4
|
||||
};
|
||||
|
||||
argc = lua_gettop(L);
|
||||
if (argc == 2) {
|
||||
int _v;
|
||||
{
|
||||
void *ptr;
|
||||
if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
|
||||
_v = 0;
|
||||
} else {
|
||||
_v = 1;
|
||||
}
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[1]);
|
||||
}
|
||||
if (_v) {
|
||||
return _wrap_Session_setInputCallback__SWIG_1(L);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc == 3) {
|
||||
int _v;
|
||||
{
|
||||
void *ptr;
|
||||
if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
|
||||
_v = 0;
|
||||
} else {
|
||||
_v = 1;
|
||||
}
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[1]);
|
||||
}
|
||||
if (_v) {
|
||||
{
|
||||
_v = lua_isstring(L,argv[2]);
|
||||
}
|
||||
if (_v) {
|
||||
return _wrap_Session_setInputCallback__SWIG_0(L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushstring(L,"No matching function for overloaded 'Session_setInputCallback'");
|
||||
lua_error(L);return 0;
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Session_setHangupHook__SWIG_0(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
LUA::Session *arg1 = (LUA::Session *) 0 ;
|
||||
|
||||
Reference in New Issue
Block a user