add conjure-session code and make session available in api commands
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14739 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
33c3ad8dd8
commit
4bfa2a213d
3 changed files with 18 additions and 2 deletions
|
@ -386,8 +386,7 @@ SWITCH_STANDARD_APP(lua_function)
|
|||
return;
|
||||
}
|
||||
|
||||
snprintf(code, sizeof(code), "~session = freeswitch.Session(\"%s\");", switch_core_session_get_uuid(session));
|
||||
error = lua_parse_and_execute(L, code);
|
||||
mod_lua_conjure_session(L, session, "session", 1);
|
||||
|
||||
mycmd = strdup((char *) data);
|
||||
switch_assert(mycmd);
|
||||
|
@ -425,6 +424,11 @@ SWITCH_STANDARD_API(lua_api_function)
|
|||
|
||||
mycmd = strdup(cmd);
|
||||
switch_assert(mycmd);
|
||||
|
||||
if (session) {
|
||||
mod_lua_conjure_session(L, session, "session", 1);
|
||||
}
|
||||
|
||||
mod_lua_conjure_stream(L, stream, "stream", 1);
|
||||
|
||||
if (stream->param_event) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using namespace LUA;
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me)
|
||||
{
|
||||
Event *result = new Event(event);
|
||||
|
@ -14,5 +16,14 @@ void mod_lua_conjure_stream(lua_State * L, switch_stream_handle_t *stream, const
|
|||
}
|
||||
|
||||
|
||||
void mod_lua_conjure_session(lua_State * L, switch_core_session_t *session, const char *name, int destroy_me)
|
||||
{
|
||||
Session *result = new Session(session);
|
||||
|
||||
SWIG_NewPointerObj(L, result, SWIGTYPE_p_CoreSession, destroy_me);
|
||||
lua_setglobal(L, name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
|
|
@ -4,6 +4,7 @@ SWITCH_BEGIN_EXTERN_C
|
|||
|
||||
void mod_lua_conjure_event(lua_State *L, switch_event_t *event, const char *name, int destroy_me);
|
||||
void mod_lua_conjure_stream(lua_State *L, switch_stream_handle_t *stream, const char *name, int destroy_me);
|
||||
void mod_lua_conjure_session(lua_State * L, switch_core_session_t *session, const char *name, int destroy_me);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue