mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-30 21:02:46 +00:00
add chat app to python
This commit is contained in:
parent
90a6e78d15
commit
0891702118
@ -403,10 +403,20 @@ SWITCH_STANDARD_API(launch_python)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_STANDARD_CHAT_APP(python_chat_function)
|
||||||
|
{
|
||||||
|
eval_some_python("chat", (char *) data, NULL, NULL, message, NULL, NULL);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_python_load)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_python_load)
|
||||||
{
|
{
|
||||||
switch_api_interface_t *api_interface;
|
switch_api_interface_t *api_interface;
|
||||||
switch_application_interface_t *app_interface;
|
switch_application_interface_t *app_interface;
|
||||||
|
switch_chat_application_interface_t *chat_app_interface;
|
||||||
|
|
||||||
char *pp = getenv("PYTHONPATH");
|
char *pp = getenv("PYTHONPATH");
|
||||||
|
|
||||||
if (pp) {
|
if (pp) {
|
||||||
@ -417,6 +427,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python_load)
|
|||||||
setenv("PYTHONPATH", SWITCH_GLOBAL_dirs.script_dir, 1);
|
setenv("PYTHONPATH", SWITCH_GLOBAL_dirs.script_dir, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_ADD_CHAT_APP(chat_app_interface, "python", "execute a python script", "execute a python script", python_chat_function, "<script>", SCAF_NONE);
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
|
||||||
|
|
||||||
globals.pool = pool;
|
globals.pool = pool;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user