mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 20:51:58 +00:00
add new chatplan concept and mod_sms. Apps for chat messages: copy new base freeswitch.xml and chatplan dir if you are upgrading on existing config base
This commit is contained in:
@@ -430,6 +430,24 @@ SWITCH_STANDARD_API(luarun_api_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_CHAT_APP(lua_chat_function)
|
||||
{
|
||||
lua_State *L = lua_init();
|
||||
char *dup = NULL;
|
||||
|
||||
if (data) {
|
||||
dup = strdup(data);
|
||||
}
|
||||
|
||||
mod_lua_conjure_event(L, message, "message", 1);
|
||||
lua_parse_and_execute(L, (char *)dup);
|
||||
lua_uninit(L);
|
||||
|
||||
switch_safe_free(dup);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(lua_api_function)
|
||||
{
|
||||
@@ -591,6 +609,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
|
||||
switch_api_interface_t *api_interface;
|
||||
switch_application_interface_t *app_interface;
|
||||
switch_dialplan_interface_t *dp_interface;
|
||||
switch_chat_application_interface_t *chat_app_interface;
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
@@ -600,6 +619,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
|
||||
SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||
SWITCH_ADD_DIALPLAN(dp_interface, "LUA", lua_dialplan_hunt);
|
||||
|
||||
SWITCH_ADD_CHAT_APP(chat_app_interface, "lua", "execute a lua script", "execute a lua script", lua_chat_function, "<script>", SCAF_NONE);
|
||||
|
||||
|
||||
globals.pool = pool;
|
||||
|
||||
@@ -2890,6 +2890,69 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
static int _wrap_Event_chat_execute(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
Event *arg1 = (Event *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
char *arg3 = (char *) NULL ;
|
||||
int result;
|
||||
|
||||
SWIG_check_num_args("chat_execute",2,3)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("chat_execute",1,"Event *");
|
||||
if(!lua_isstring(L,2)) SWIG_fail_arg("chat_execute",2,"char const *");
|
||||
if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("chat_execute",3,"char const *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
|
||||
SWIG_fail_ptr("Event_chat_execute",1,SWIGTYPE_p_Event);
|
||||
}
|
||||
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
if(lua_gettop(L)>=3){
|
||||
arg3 = (char *)lua_tostring(L, 3);
|
||||
}
|
||||
result = (int)(arg1)->chat_execute((char const *)arg2,(char const *)arg3);
|
||||
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_Event_chat_send(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
Event *arg1 = (Event *) 0 ;
|
||||
char *arg2 = (char *) NULL ;
|
||||
int result;
|
||||
|
||||
SWIG_check_num_args("chat_send",1,2)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("chat_send",1,"Event *");
|
||||
if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("chat_send",2,"char const *");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
|
||||
SWIG_fail_ptr("Event_chat_send",1,SWIGTYPE_p_Event);
|
||||
}
|
||||
|
||||
if(lua_gettop(L)>=2){
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
}
|
||||
result = (int)(arg1)->chat_send((char const *)arg2);
|
||||
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_Event_serialize(lua_State* L) {
|
||||
int SWIG_arg = -1;
|
||||
Event *arg1 = (Event *) 0 ;
|
||||
@@ -3149,6 +3212,8 @@ Event *arg1 = (Event *) obj;
|
||||
delete arg1;
|
||||
}
|
||||
static swig_lua_method swig_Event_methods[] = {
|
||||
{"chat_execute", _wrap_Event_chat_execute},
|
||||
{"chat_send", _wrap_Event_chat_send},
|
||||
{"serialize", _wrap_Event_serialize},
|
||||
{"setPriority", _wrap_Event_setPriority},
|
||||
{"getHeader", _wrap_Event_getHeader},
|
||||
|
||||
Reference in New Issue
Block a user