mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-30 23:24:18 +00:00
FS-9924: Removed extra space in source files
This commit is contained in:
1 parent
60d4e87487
commit
df1ab07ca4
455 files changed
+9699
-9698
No files matched your search
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
*
|
||||
@@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_basic_shutdown);
|
||||
SWITCH_MODULE_RUNTIME_FUNCTION(mod_basic_runtime);
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_basic_load);
|
||||
|
||||
/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
|
||||
/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
|
||||
* Defines a switch_loadable_module_function_table_t and a static const char[] modname
|
||||
*/
|
||||
SWITCH_MODULE_DEFINITION(mod_basic, mod_basic_load, mod_basic_shutdown, NULL);
|
||||
@@ -58,7 +58,7 @@ static switch_status_t do_config(switch_bool_t reload)
|
||||
static void _on_error(mb_interpreter_t* s, mb_error_e e, char* m, int p, unsigned short row, unsigned short col, int abort_code) {
|
||||
mb_unrefvar(s);
|
||||
if(SE_NO_ERR != e) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"Error:\n [POS] %d, [ROW] %d, [COL] %d,\n [CODE] %d, [MESSAGE] %s, [ABORT CODE] %d\n", p, row, col, e, m, abort_code);
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ typedef struct fs_data {
|
||||
} fs_data_t;
|
||||
|
||||
|
||||
static int fun_execute(mb_interpreter_t* s, void** l)
|
||||
static int fun_execute(mb_interpreter_t* s, void** l)
|
||||
{
|
||||
int result = MB_FUNC_OK;
|
||||
fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
|
||||
@@ -104,10 +104,10 @@ static int fun_execute(mb_interpreter_t* s, void** l)
|
||||
end:
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int fun_setvar(mb_interpreter_t* s, void** l)
|
||||
static int fun_setvar(mb_interpreter_t* s, void** l)
|
||||
{
|
||||
int result = MB_FUNC_OK;
|
||||
fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
|
||||
@@ -139,9 +139,9 @@ static int fun_setvar(mb_interpreter_t* s, void** l)
|
||||
end:
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
static int fun_getarg(mb_interpreter_t* s, void** l)
|
||||
static int fun_getarg(mb_interpreter_t* s, void** l)
|
||||
{
|
||||
int result = MB_FUNC_OK;
|
||||
fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
|
||||
@@ -171,7 +171,7 @@ static int fun_getarg(mb_interpreter_t* s, void** l)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int fun_getvar(mb_interpreter_t* s, void** l)
|
||||
static int fun_getvar(mb_interpreter_t* s, void** l)
|
||||
{
|
||||
int result = MB_FUNC_OK;
|
||||
fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
|
||||
@@ -188,7 +188,7 @@ static int fun_getvar(mb_interpreter_t* s, void** l)
|
||||
if (var.type == MB_DT_STRING && fsdata->session) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(fsdata->session);
|
||||
const char *value = switch_channel_get_variable(channel, var.value.string);
|
||||
|
||||
|
||||
mb_push_string(s, l, strdup(value));
|
||||
|
||||
} else {
|
||||
@@ -201,9 +201,9 @@ static int fun_getvar(mb_interpreter_t* s, void** l)
|
||||
end:
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
static int fun_api(mb_interpreter_t* s, void** l)
|
||||
static int fun_api(mb_interpreter_t* s, void** l)
|
||||
{
|
||||
int result = MB_FUNC_OK;
|
||||
fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
|
||||
@@ -238,10 +238,10 @@ static int fun_api(mb_interpreter_t* s, void** l)
|
||||
end:
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int fun_log(mb_interpreter_t* s, void** l)
|
||||
static int fun_log(mb_interpreter_t* s, void** l)
|
||||
{
|
||||
int result = MB_FUNC_OK;
|
||||
fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s);
|
||||
@@ -262,7 +262,7 @@ static int fun_log(mb_interpreter_t* s, void** l)
|
||||
|
||||
if (level.type == MB_DT_STRING && data.type == MB_DT_STRING) {
|
||||
switch_log_level_t fslevel = SWITCH_LOG_DEBUG;
|
||||
|
||||
|
||||
fslevel = switch_log_str2level(level.value.string);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fsdata->session), fslevel, "%s\n", data.value.string);
|
||||
} else {
|
||||
@@ -274,25 +274,25 @@ static int fun_log(mb_interpreter_t* s, void** l)
|
||||
end:
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int bprint(const char *fmt, ...)
|
||||
static int bprint(const char *fmt, ...)
|
||||
{
|
||||
char *data = NULL;
|
||||
va_list ap;
|
||||
int ret = 0;
|
||||
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = switch_vasprintf(&data, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
|
||||
if (data) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "%s\n", data);
|
||||
}
|
||||
|
||||
switch_safe_free(data);
|
||||
|
||||
switch_safe_free(data);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
@@ -329,7 +329,7 @@ SWITCH_STANDARD_APP(basic_function)
|
||||
}
|
||||
|
||||
mb_open(&bi);
|
||||
mb_set_error_handler(bi, _on_error);
|
||||
mb_set_error_handler(bi, _on_error);
|
||||
mb_set_printer(bi, bprint);
|
||||
fsdata.session = session;
|
||||
mb_set_user_data(bi, (void *) &fsdata);
|
||||
@@ -340,7 +340,7 @@ SWITCH_STANDARD_APP(basic_function)
|
||||
mb_register_func(bi, "FS_SETVAR", fun_setvar);
|
||||
mb_register_func(bi, "FS_API", fun_api);
|
||||
mb_register_func(bi, "FS_LOG", fun_log);
|
||||
|
||||
|
||||
if (mb_load_file(bi, file) == MB_FUNC_OK) {
|
||||
mb_run(bi);
|
||||
} else {
|
||||
@@ -358,7 +358,7 @@ SWITCH_STANDARD_API(basic_api_function)
|
||||
{
|
||||
|
||||
basic_function(session, cmd);
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ MBAPI int mb_gets(char* buf, int s);
|
||||
|
||||
MBAPI void mb_set_user_data(mb_interpreter_t* s, void *ptr);
|
||||
MBAPI void *mb_get_user_data(mb_interpreter_t* s);
|
||||
|
||||
|
||||
#ifdef MB_COMPACT_MODE
|
||||
# pragma pack()
|
||||
#endif /* MB_COMPACT_MODE */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2007, Damjan Jovanovic <d a m j a n d o t j o v a t g m a i l d o t c o m>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Damjan Jovanovic <d a m j a n d o t j o v a t g m a i l d o t c o m>
|
||||
*
|
||||
*
|
||||
@@ -299,7 +299,7 @@ static switch_status_t create_java_vm(JavaVMOption *options, int optionCount, vm
|
||||
char *derr = NULL;
|
||||
|
||||
pJNI_CreateJavaVM = (jint (*)(JavaVM **, void **, void *))switch_dso_func_sym(javaVMHandle, "JNI_CreateJavaVM", &derr);
|
||||
|
||||
|
||||
if (!derr)
|
||||
{
|
||||
JNIEnv *env;
|
||||
|
||||
@@ -29,7 +29,7 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup);
|
||||
|
||||
void Session::destroy(const char *err)
|
||||
{
|
||||
|
||||
|
||||
if (!allocated) {
|
||||
return;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ void Session::do_hangup_hook()
|
||||
docall(L, arg_count, 1, 1, 0);
|
||||
|
||||
const char *err = lua_tostring(L, -1);
|
||||
|
||||
|
||||
switch_channel_set_variable(channel, "lua_hangup_hook_return_val", err);
|
||||
|
||||
if (!zstr(err)) {
|
||||
@@ -200,7 +200,7 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
|
||||
coresession = (Session *) vs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!(coresession && coresession->hook_state)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -356,15 +356,15 @@ Dbh::Dbh(char *dsn, char *user, char *pass)
|
||||
dbh = NULL;
|
||||
err = NULL;
|
||||
char *tmp = NULL;
|
||||
|
||||
|
||||
if (!zstr(user) || !zstr(pass)) {
|
||||
tmp = switch_mprintf("%s%s%s%s%s", dsn,
|
||||
tmp = switch_mprintf("%s%s%s%s%s", dsn,
|
||||
zstr(user) ? "" : ":",
|
||||
zstr(user) ? "" : user,
|
||||
zstr(pass) ? "" : ":",
|
||||
zstr(pass) ? "" : pass
|
||||
);
|
||||
|
||||
|
||||
dsn = tmp;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ Dbh::Dbh(char *dsn, char *user, char *pass)
|
||||
}
|
||||
|
||||
switch_safe_free(tmp);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Dbh::~Dbh()
|
||||
@@ -449,11 +449,11 @@ int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv)
|
||||
|
||||
ret = lua_tonumber(lua_fun->L, -1);
|
||||
lua_pop(lua_fun->L, 1);
|
||||
|
||||
|
||||
if (ret != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0; /* 0 to continue with next row */
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,7 +1053,7 @@ static lu_mem singlestep (lua_State *L) {
|
||||
g->gcstate = GCSatomic; /* finish mark phase */
|
||||
g->GCestimate = g->GCmemtrav; /* save what was counted */;
|
||||
work = atomic(L); /* add what was traversed by 'atomic' */
|
||||
g->GCestimate += work; /* estimate of total memory traversed */
|
||||
g->GCestimate += work; /* estimate of total memory traversed */
|
||||
sw = entersweep(L);
|
||||
return work + sw * GCSWEEPCOST;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* mod_lua.c -- Lua
|
||||
@@ -102,7 +102,7 @@ int docall(lua_State * L, int narg, int nresults, int perror, int fatal)
|
||||
if (!zstr(err)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
|
||||
}
|
||||
|
||||
|
||||
// pass error up to top
|
||||
if (fatal) {
|
||||
lua_error(L);
|
||||
@@ -143,7 +143,7 @@ static int lua_parse_and_execute(lua_State * L, char *input_code, switch_core_se
|
||||
}
|
||||
|
||||
while(input_code && (*input_code == ' ' || *input_code == '\n' || *input_code == '\r')) input_code++;
|
||||
|
||||
|
||||
if (*input_code == '~') {
|
||||
char *buff = input_code + 1;
|
||||
error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0, 1); //lua_pcall(L, 0, 0, 0);
|
||||
@@ -274,12 +274,12 @@ static switch_xml_t lua_fetch(const char *section,
|
||||
|
||||
lua_getglobal(L, "XML_STRING");
|
||||
str = lua_tostring(L, -1);
|
||||
|
||||
|
||||
if (str) {
|
||||
if (zstr(str)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
|
||||
} else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) {
|
||||
/* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str
|
||||
} else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) {
|
||||
/* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str
|
||||
and saves this duplcate as root->m which is freed when switch_xml_free is issued
|
||||
*/
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
|
||||
@@ -308,7 +308,7 @@ static switch_status_t do_config(void)
|
||||
switch_xml_t cfg, xml, settings, param, hook;
|
||||
switch_stream_handle_t path_stream = {0};
|
||||
switch_stream_handle_t cpath_stream = {0};
|
||||
|
||||
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
@@ -423,7 +423,7 @@ static switch_status_t do_config(void)
|
||||
}
|
||||
|
||||
switch_safe_free(path_stream.data);
|
||||
|
||||
|
||||
switch_xml_free(xml);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -689,7 +689,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
|
||||
|
||||
SWITCH_ADD_API(api_interface, "luarun", "run a script", luarun_api_function, "<script>");
|
||||
SWITCH_ADD_API(api_interface, "lua", "run a script as an api function", lua_api_function, "<script>");
|
||||
SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>",
|
||||
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 | SAF_ZOMBIE_EXEC | SAF_SUPPORT_TEXT_ONLY);
|
||||
SWITCH_ADD_DIALPLAN(dp_interface, "LUA", lua_dialplan_hunt);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
|
||||
* Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
|
||||
*
|
||||
@@ -22,13 +22,13 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Michael Giagnocavo <mgg@packetrino.com>
|
||||
* Jeff Lenk <jlenk@frontiernet.net> - Modified class to support Dotnet
|
||||
*
|
||||
*
|
||||
* freeswitch_managed.cpp -- Managed CoreSession subclasses
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <switch_cpp.h>
|
||||
@@ -38,35 +38,35 @@
|
||||
#pragma unmanaged
|
||||
#endif
|
||||
|
||||
ManagedSession::ManagedSession():CoreSession()
|
||||
ManagedSession::ManagedSession():CoreSession()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ManagedSession::ManagedSession(char *uuid):CoreSession(uuid)
|
||||
ManagedSession::ManagedSession(char *uuid):CoreSession(uuid)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ManagedSession::ManagedSession(switch_core_session_t *session):CoreSession(session)
|
||||
ManagedSession::ManagedSession(switch_core_session_t *session):CoreSession(session)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool ManagedSession::begin_allow_threads()
|
||||
bool ManagedSession::begin_allow_threads()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ManagedSession::end_allow_threads()
|
||||
bool ManagedSession::end_allow_threads()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ManagedSession::~ManagedSession()
|
||||
ManagedSession::~ManagedSession()
|
||||
{
|
||||
ATTACH_THREADS
|
||||
// Do auto-hangup ourselves because CoreSession can't call check_hangup_hook
|
||||
// Do auto-hangup ourselves because CoreSession can't call check_hangup_hook
|
||||
// after ManagedSession destruction (cause at point it's pure virtual)
|
||||
if (session) {
|
||||
if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
|
||||
@@ -78,7 +78,7 @@ ManagedSession::~ManagedSession()
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedSession::check_hangup_hook()
|
||||
void ManagedSession::check_hangup_hook()
|
||||
{
|
||||
ATTACH_THREADS
|
||||
if (!hangupDelegate) {
|
||||
@@ -88,7 +88,7 @@ void ManagedSession::check_hangup_hook()
|
||||
hangupDelegate();
|
||||
}
|
||||
|
||||
switch_status_t ManagedSession::run_dtmf_callback(void *input, switch_input_type_t itype)
|
||||
switch_status_t ManagedSession::run_dtmf_callback(void *input, switch_input_type_t itype)
|
||||
{
|
||||
ATTACH_THREADS
|
||||
if (!dtmfDelegate) {
|
||||
@@ -98,7 +98,7 @@ switch_status_t ManagedSession::run_dtmf_callback(void *input, switch_input_type
|
||||
char *result = dtmfDelegate(input, itype);
|
||||
switch_status_t status = process_callback_result(result);
|
||||
|
||||
RESULT_FREE(result);
|
||||
RESULT_FREE(result);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
|
||||
* Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Michael Giagnocavo <mgg@packetrino.com>
|
||||
* Jeff Lenk <jlenk@frontiernet.net> - Modified class to support Dotnet
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - mod_managed
|
||||
* Copyright (C) 2008, Michael Giagnocavo <mgg@packetrino.com>
|
||||
*
|
||||
@@ -22,21 +22,21 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Michael Giagnocavo <mgg@giagnocavo.net>
|
||||
* David Brazier <David.Brazier@360crm.co.uk>
|
||||
* Jeff Lenk <jlenk@frontiernet.net>
|
||||
* Jeff Lenk <jlenk@frontiernet.net>
|
||||
* Artur Kraev <ravenox@gmail.com>
|
||||
*
|
||||
* mod_mono.cpp -- FreeSWITCH mod_mono main class
|
||||
*
|
||||
* Most of mod_mono is implmented in the mod_mono_managed Loader class.
|
||||
* Most of mod_mono is implmented in the mod_mono_managed Loader class.
|
||||
* The native code just handles getting the Mono runtime up and down
|
||||
* and passing pointers into managed code.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include "freeswitch_managed.h"
|
||||
#include "freeswitch_managed.h"
|
||||
|
||||
#ifdef _MANAGED
|
||||
#include <mscoree.h>
|
||||
@@ -47,7 +47,7 @@ using namespace System::Runtime::InteropServices;
|
||||
#define MOD_MANAGED_VERSION "Mono Version"
|
||||
#endif
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load);
|
||||
SWITCH_MODULE_DEFINITION_EX(mod_managed, mod_managed_load, NULL, NULL, SMODF_GLOBAL_SYMBOLS);
|
||||
@@ -94,7 +94,7 @@ SWITCH_MOD_DECLARE_NONSTD(void) InitManagedDelegates(runFunction run, executeFun
|
||||
// Sets up delegates (and anything else needed) on the ManagedSession object
|
||||
// Called from ManagedSession.Initialize Managed -> this is Unmanaged code so all pointers are marshalled and prevented from GC
|
||||
// Exported method.
|
||||
SWITCH_MOD_DECLARE_NONSTD(void) InitManagedSession(ManagedSession *session, inputFunction dtmfDelegate, hangupFunction hangupDelegate)
|
||||
SWITCH_MOD_DECLARE_NONSTD(void) InitManagedSession(ManagedSession *session, inputFunction dtmfDelegate, hangupFunction hangupDelegate)
|
||||
{
|
||||
switch_assert(session);
|
||||
if (!session) {
|
||||
@@ -106,15 +106,15 @@ SWITCH_MOD_DECLARE_NONSTD(void) InitManagedSession(ManagedSession *session, inpu
|
||||
session->hangupDelegate = hangupDelegate;
|
||||
}
|
||||
|
||||
#ifndef _MANAGED
|
||||
#ifndef _MANAGED
|
||||
|
||||
#ifdef WIN32
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch_status_t setMonoDirs()
|
||||
switch_status_t setMonoDirs()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32
|
||||
// Win32 Mono installs can't figure out their own path
|
||||
// Guys in #mono say we should just deploy all the libs we need
|
||||
// We'll first check for Program Files\Mono to allow people to use the symlink dir for a specific version.
|
||||
@@ -171,7 +171,7 @@ switch_status_t setMonoDirs()
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
/* Got it */
|
||||
/* Got it */
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
|
||||
mono_set_dirs(libPath, etcPath);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -180,19 +180,19 @@ switch_status_t setMonoDirs()
|
||||
// On other platforms, it should just work if it hasn't been relocated
|
||||
mono_set_dirs(NULL, NULL);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
switch_status_t loadRuntime()
|
||||
switch_status_t loadRuntime()
|
||||
{
|
||||
/* Find and load mod_mono_managed.exe */
|
||||
/* Find and load mod_mono_managed.exe */
|
||||
char filename[256];
|
||||
|
||||
if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef WIN32
|
||||
// So linux can find the .so
|
||||
char xmlConfig[300];
|
||||
switch_snprintf(xmlConfig, 300, "<configuration><dllmap dll=\"mod_managed\" target=\"%s%smod_managed.so\"/></configuration>", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR);
|
||||
@@ -218,7 +218,7 @@ switch_status_t loadRuntime()
|
||||
MonoAssemblyName *name = mono_assembly_name_new (MOD_MANAGED_ASM_NAME);
|
||||
//Note also that it can't be allocated on the stack anymore and you'll need to create and destroy it with the following API:
|
||||
//mono_assembly_name_free (name);
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_assembly_loaded.\n");
|
||||
|
||||
if (!(managed_globals.mod_mono_asm = mono_assembly_loaded(name))) {
|
||||
@@ -234,7 +234,7 @@ switch_status_t loadRuntime()
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
MonoMethod * getMethod(const char *name, MonoClass * klass)
|
||||
MonoMethod * getMethod(const char *name, MonoClass * klass)
|
||||
{
|
||||
MonoMethodDesc * desc;
|
||||
MonoMethod * method;
|
||||
@@ -250,9 +250,9 @@ MonoMethod * getMethod(const char *name, MonoClass * klass)
|
||||
return method;
|
||||
}
|
||||
|
||||
switch_status_t findLoader()
|
||||
switch_status_t findLoader()
|
||||
{
|
||||
/* Find loader class and methods */
|
||||
/* Find loader class and methods */
|
||||
MonoClass * loaderClass;
|
||||
MonoImage * img = mono_assembly_get_image(managed_globals.mod_mono_asm);
|
||||
|
||||
@@ -276,9 +276,9 @@ switch_status_t findLoader()
|
||||
|
||||
#ifdef _MANAGED
|
||||
|
||||
switch_status_t loadRuntime()
|
||||
switch_status_t loadRuntime()
|
||||
{
|
||||
/* Find and load mod_dotnet_managed.dll */
|
||||
/* Find and load mod_dotnet_managed.dll */
|
||||
char filename[256];
|
||||
switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MANAGED_DLL);
|
||||
|
||||
@@ -295,7 +295,7 @@ switch_status_t loadRuntime()
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
switch_status_t findLoader()
|
||||
switch_status_t findLoader()
|
||||
{
|
||||
try {
|
||||
FreeSwitchManaged::loadMethod = FreeSwitchManaged::mod_dotnet_managed->GetType(MOD_MANAGED_IMAGE_NAME "." MOD_MANAGED_CLASS_NAME)->GetMethod("Load");
|
||||
@@ -310,20 +310,20 @@ switch_status_t findLoader()
|
||||
}
|
||||
#endif
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
|
||||
{
|
||||
int success;
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loading mod_managed (Common Language Infrastructure), " MOD_MANAGED_VERSION "\n");
|
||||
|
||||
managed_globals.pool = pool;
|
||||
|
||||
if (loadRuntime() != SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (loadRuntime() != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (findLoader() != SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (findLoader() != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
#ifdef _MANAGED
|
||||
@@ -342,7 +342,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
|
||||
/* Not sure if this is necesary on the loading thread */
|
||||
mono_thread_attach(managed_globals.domain);
|
||||
|
||||
/* Run loader */
|
||||
/* Run loader */
|
||||
MonoObject * exception = NULL;
|
||||
MonoObject * objResult = mono_runtime_invoke(managed_globals.loadMethod, NULL, NULL, &exception);
|
||||
if (exception) {
|
||||
@@ -354,12 +354,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
|
||||
#endif
|
||||
if (success) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
|
||||
} else {
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
/* We're good to register */
|
||||
|
||||
/* We're good to register */
|
||||
switch_api_interface_t *api_interface;
|
||||
switch_application_interface_t *app_interface;
|
||||
|
||||
@@ -374,10 +374,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
|
||||
#ifdef _MANAGED
|
||||
#pragma unmanaged
|
||||
#endif
|
||||
SWITCH_STANDARD_API(managedrun_api_function)
|
||||
SWITCH_STANDARD_API(managedrun_api_function)
|
||||
{
|
||||
if (zstr(cmd)) {
|
||||
stream->write_function(stream, "-ERR no args specified!\n");
|
||||
stream->write_function(stream, "-ERR no args specified!\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
#ifndef _MANAGED
|
||||
@@ -385,7 +385,7 @@ SWITCH_STANDARD_API(managedrun_api_function)
|
||||
#endif
|
||||
if (executeBackgroundDelegate(cmd)) {
|
||||
stream->write_function(stream, "+OK\n");
|
||||
} else {
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module or exception?).\n");
|
||||
}
|
||||
#ifndef _MANAGED
|
||||
@@ -394,17 +394,17 @@ SWITCH_STANDARD_API(managedrun_api_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(managed_api_function)
|
||||
SWITCH_STANDARD_API(managed_api_function)
|
||||
{
|
||||
if (zstr(cmd)) {
|
||||
stream->write_function(stream, "-ERR no args specified!\n");
|
||||
stream->write_function(stream, "-ERR no args specified!\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
#ifndef _MANAGED
|
||||
mono_thread_attach(managed_globals.domain);
|
||||
#endif
|
||||
if (!(executeDelegate(cmd, stream, stream->param_event))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd);
|
||||
}
|
||||
#ifndef _MANAGED
|
||||
mono_thread_detach(mono_thread_current());
|
||||
@@ -412,7 +412,7 @@ SWITCH_STANDARD_API(managed_api_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(managed_app_function)
|
||||
SWITCH_STANDARD_APP(managed_app_function)
|
||||
{
|
||||
if (zstr(data)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
|
||||
@@ -429,17 +429,17 @@ SWITCH_STANDARD_APP(managed_app_function)
|
||||
#endif
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(managedreload_api_function)
|
||||
SWITCH_STANDARD_API(managedreload_api_function)
|
||||
{
|
||||
if (zstr(cmd)) {
|
||||
stream->write_function(stream, "-ERR no args specified!\n");
|
||||
stream->write_function(stream, "-ERR no args specified!\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
#ifndef _MANAGED
|
||||
mono_thread_attach(managed_globals.domain);
|
||||
#endif
|
||||
if (!(reloadDelegate(cmd))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module or exception).\n", cmd);
|
||||
}
|
||||
#ifndef _MANAGED
|
||||
mono_thread_detach(mono_thread_current());
|
||||
|
||||
@@ -47,7 +47,7 @@ static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
|
||||
|
||||
void Session::destroy(void)
|
||||
{
|
||||
|
||||
|
||||
if (!allocated) {
|
||||
return;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void Session::destroy(void)
|
||||
switch_safe_free(cb_function);
|
||||
switch_safe_free(cb_arg);
|
||||
switch_safe_free(hangup_func_str);
|
||||
switch_safe_free(hangup_func_arg);
|
||||
switch_safe_free(hangup_func_arg);
|
||||
|
||||
CoreSession::destroy();
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void Session::unsetInputCallback(void)
|
||||
switch_channel_set_private(channel, "CoreSession", NULL);
|
||||
args.input_callback = NULL;
|
||||
ap = NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Session::setInputCallback(char *cbfunc, char *funcargs)
|
||||
@@ -229,7 +229,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
HV *hash;
|
||||
SV *this_sv;
|
||||
char *code;
|
||||
|
||||
|
||||
if (!(hash = get_hv("__dtmf", TRUE))) {
|
||||
abort();
|
||||
}
|
||||
@@ -243,7 +243,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
this_sv = newSV(strlen(str) + 1);
|
||||
sv_setpv(this_sv, str);
|
||||
hv_store(hash, "duration", 8, this_sv, 0);
|
||||
|
||||
|
||||
code = switch_mprintf("eval { $__RV = &%s($%s, 'dtmf', \\%%__dtmf, %s);};", cb_function, suuid, switch_str_nil(cb_arg));
|
||||
Perl_eval_pv(my_perl, code, FALSE);
|
||||
free(code);
|
||||
@@ -272,7 +272,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
}
|
||||
|
||||
mod_perl_conjure_event(my_perl, event, var_name);
|
||||
code = switch_mprintf("eval {$__RV = &%s($%s, 'event', $%s, '%s');};$%s = undef;",
|
||||
code = switch_mprintf("eval {$__RV = &%s($%s, 'event', $%s, '%s');};$%s = undef;",
|
||||
cb_function, suuid, var_name, switch_str_nil(cb_arg), var_name);
|
||||
Perl_eval_pv(my_perl, code, FALSE);
|
||||
free(code);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
*
|
||||
|
||||
@@ -23,7 +23,7 @@ static switch_status_t python_hanguphook(switch_core_session_t *session_hungup);
|
||||
|
||||
void Session::destroy(void)
|
||||
{
|
||||
|
||||
|
||||
if (!allocated) {
|
||||
return;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void Session::destroy(void)
|
||||
Py_DECREF(hangup_func);
|
||||
hangup_func = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (hangup_func_arg) {
|
||||
Py_DECREF(hangup_func_arg);
|
||||
hangup_func_arg = NULL;
|
||||
@@ -124,7 +124,7 @@ bool Session::ready()
|
||||
|
||||
/*! this is called every time ready is called as a workaround to
|
||||
make it threadsafe. it sets a flag, and all the places where it
|
||||
comes in and out of threadswap, check it. so the end result is
|
||||
comes in and out of threadswap, check it. so the end result is
|
||||
you still get the hangup hook executed pretty soon after you
|
||||
hangup. */
|
||||
do_hangup_hook();
|
||||
@@ -148,7 +148,7 @@ void Session::do_hangup_hook()
|
||||
mark++;
|
||||
|
||||
if (hangup_func) {
|
||||
|
||||
|
||||
if (!PyCallable_Check(hangup_func)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
|
||||
return;
|
||||
@@ -157,7 +157,7 @@ void Session::do_hangup_hook()
|
||||
if (!Self) {
|
||||
mod_python_conjure_session(NULL, session);
|
||||
}
|
||||
|
||||
|
||||
if (hangup_func_arg) {
|
||||
arglist = Py_BuildValue("(OsO)", Self, what, hangup_func_arg);
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ void Session::do_hangup_hook()
|
||||
if (!(result = PyEval_CallObject(hangup_func, arglist))) {
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
|
||||
Py_XDECREF(arglist);
|
||||
Py_XDECREF(hangup_func_arg);
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void Session::setHangupHook(PyObject *pyfunc, PyObject *arg)
|
||||
Py_XDECREF(hangup_func_arg);
|
||||
hangup_func_arg = NULL;
|
||||
}
|
||||
|
||||
|
||||
hangup_func = pyfunc;
|
||||
hangup_func_arg = arg;
|
||||
|
||||
@@ -239,10 +239,10 @@ void Session::unsetInputCallback(void)
|
||||
Py_XDECREF(cb_arg);
|
||||
cb_arg = NULL;
|
||||
}
|
||||
|
||||
|
||||
args.input_callback = NULL;
|
||||
ap = NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Session::setInputCallback(PyObject *cbfunc, PyObject *funcargs)
|
||||
@@ -295,7 +295,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (itype == SWITCH_INPUT_TYPE_DTMF) {
|
||||
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
|
||||
io = mod_python_conjure_DTMF(dtmf->digit, dtmf->duration);
|
||||
@@ -311,7 +311,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
|
||||
if (!Self) {
|
||||
mod_python_conjure_session(NULL, session);
|
||||
}
|
||||
|
||||
|
||||
if (cb_arg) {
|
||||
arglist = Py_BuildValue("(OsOO)", Self, what, io, cb_arg);
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Brian Fertig <brian.fertig@convergencetek.com>
|
||||
* Johny Kadarisman <jkr888@gmail.com>
|
||||
* Traun Leyden <tleyden@branchcut.com>
|
||||
@@ -77,7 +77,7 @@ static switch_mutex_t *THREAD_POOL_LOCK = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* This function is similiar to PyErr_Print. It uses the freeswitch print/log mechanism instead of the python sys.stderr
|
||||
* This function is similiar to PyErr_Print. It uses the freeswitch print/log mechanism instead of the python sys.stderr
|
||||
*/
|
||||
static void print_python_error(const char * script)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ static void print_python_error(const char * script)
|
||||
if (buffer == NULL ) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough Memory to create the error buffer");
|
||||
}
|
||||
|
||||
|
||||
/* just for security that we will always have a string terminater */
|
||||
memset(buffer, 0, 20 * 1024 * sizeof(char) );
|
||||
|
||||
@@ -113,7 +113,7 @@ static void print_python_error(const char * script)
|
||||
|
||||
/*Print error message*/
|
||||
if (pyValue != NULL && (pyString=PyObject_Str(pyValue))!=NULL && (PyString_Check(pyString))) {
|
||||
strcat(buffer, "\nMessage: ");
|
||||
strcat(buffer, "\nMessage: ");
|
||||
strcat(buffer, PyString_AsString(pyString));
|
||||
} else {
|
||||
strcat(buffer, "\nMessage: <unknown exception date> ");
|
||||
@@ -279,7 +279,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
|
||||
arg = Py_BuildValue("(s)", switch_str_nil(argv[1]));
|
||||
}
|
||||
|
||||
// invoke the handler
|
||||
// invoke the handler
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n");
|
||||
result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
|
||||
Py_DECREF(function);
|
||||
@@ -291,7 +291,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
|
||||
*str = strdup((char *) PyString_AsString(result));
|
||||
}
|
||||
} else if (!PyErr_ExceptionMatches(PyExc_SystemExit)) {
|
||||
// Print error, but ignore SystemExit
|
||||
// Print error, but ignore SystemExit
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
|
||||
print_python_error(script);
|
||||
PyErr_Clear();
|
||||
@@ -602,7 +602,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown)
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt);
|
||||
|
||||
/* Give threads a few seconds to terminate.
|
||||
/* Give threads a few seconds to terminate.
|
||||
Not using switch_thread_join() since if threads refuse to die
|
||||
then freeswitch will hang */
|
||||
for (i = 0; i < 10 && thread_pool_head; i++) {
|
||||
|
||||
@@ -559,7 +559,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
|
||||
/* Add xml handler global variables */
|
||||
|
||||
Handle<Array> XML_REQUEST = Array::New(isolate, 4);
|
||||
|
||||
|
||||
XML_REQUEST->Set(String::NewFromUtf8(isolate, "key_name"), String::NewFromUtf8(isolate, js_safe_str(xml_handler->key_name)));
|
||||
XML_REQUEST->Set(String::NewFromUtf8(isolate, "key_value"), String::NewFromUtf8(isolate, js_safe_str(xml_handler->key_value)));
|
||||
XML_REQUEST->Set(String::NewFromUtf8(isolate, "section"), String::NewFromUtf8(isolate, js_safe_str(xml_handler->section)));
|
||||
@@ -661,7 +661,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
|
||||
}
|
||||
|
||||
if (xml_handler)
|
||||
{
|
||||
{
|
||||
Local<Value> value = context->Global()->Get(String::NewFromUtf8(isolate, "XML_STRING"));
|
||||
String::Utf8Value str(value);
|
||||
if (strcmp(js_safe_str(*str), "undefined"))
|
||||
@@ -698,7 +698,7 @@ static int v8_parse_and_execute(switch_core_session_t *session, const char *inpu
|
||||
#endif
|
||||
}
|
||||
//isolate->Exit();
|
||||
|
||||
|
||||
if (res.length() == 0) {
|
||||
result = -1;
|
||||
} else {
|
||||
@@ -741,16 +741,16 @@ static switch_xml_t v8_fetch(const char *section,
|
||||
if (zstr(xml_handler.XML_STRING)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
|
||||
}
|
||||
else if (!(xml = switch_xml_parse_str_dynamic(xml_handler.XML_STRING, SWITCH_TRUE))) {
|
||||
else if (!(xml = switch_xml_parse_str_dynamic(xml_handler.XML_STRING, SWITCH_TRUE))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Don't forget to free XML_STRING
|
||||
switch_safe_free(xml_handler.XML_STRING);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
return xml;
|
||||
@@ -919,7 +919,7 @@ SWITCH_STANDARD_JSON_API(json_function)
|
||||
switch_stream_handle_t stream = { 0 };
|
||||
|
||||
if ((data = cJSON_GetObjectItem(json, "data"))) {
|
||||
path = cJSON_GetObjectItem(data, "path");
|
||||
path = cJSON_GetObjectItem(data, "path");
|
||||
}
|
||||
|
||||
if (!(path && data)) {
|
||||
@@ -934,7 +934,7 @@ SWITCH_STANDARD_JSON_API(json_function)
|
||||
switch_safe_free(json_text);
|
||||
|
||||
v8_parse_and_execute(session, (char *) path->valuestring, &stream, NULL, NULL);
|
||||
|
||||
|
||||
*json_reply = cJSON_Parse((char *)stream.data);
|
||||
|
||||
end:
|
||||
@@ -946,7 +946,7 @@ SWITCH_STANDARD_JSON_API(json_function)
|
||||
|
||||
switch_event_destroy(&stream.param_event);
|
||||
switch_safe_free(stream.data);
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ JS_COREDB_FUNCTION_IMPL(Exec)
|
||||
}
|
||||
|
||||
/* Evaluate a prepared statement
|
||||
stepSuccessCode expected success code from switch_core_db_step()
|
||||
stepSuccessCode expected success code from switch_core_db_step()
|
||||
return true if step return expected success code, false otherwise
|
||||
*/
|
||||
void FSCoreDB::StepEx(const v8::FunctionCallbackInfo<Value>& info, int stepSuccessCode)
|
||||
@@ -214,7 +214,7 @@ void FSCoreDB::StepEx(const v8::FunctionCallbackInfo<Value>& info, int stepSucce
|
||||
}
|
||||
}
|
||||
|
||||
/* Evaluate a prepared statement, to be used with statements that return data
|
||||
/* Evaluate a prepared statement, to be used with statements that return data
|
||||
return true while data is available, false when done or error
|
||||
*/
|
||||
JS_COREDB_FUNCTION_IMPL(Next)
|
||||
@@ -223,8 +223,8 @@ JS_COREDB_FUNCTION_IMPL(Next)
|
||||
StepEx(info, SWITCH_CORE_DB_ROW);
|
||||
}
|
||||
|
||||
/* Evaluate a prepared statement, to be used with statements that return no data
|
||||
return true if statement has finished executing successfully, false otherwise
|
||||
/* Evaluate a prepared statement, to be used with statements that return no data
|
||||
return true if statement has finished executing successfully, false otherwise
|
||||
*/
|
||||
JS_COREDB_FUNCTION_IMPL(Step)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||
|
||||
HandleScope handle_scope(obj->GetIsolate());
|
||||
Handle<Function> func;
|
||||
|
||||
|
||||
if (!obj->_function.IsEmpty()) {
|
||||
func = Local<Function>::New(obj->GetIsolate(), obj->_function);
|
||||
}
|
||||
|
||||
@@ -227,10 +227,10 @@ JS_DBH_FUNCTION_IMPL(query)
|
||||
|
||||
void *arg = NULL;
|
||||
switch_core_db_callback_func_t cb_func = NULL;
|
||||
|
||||
|
||||
Handle<Function> func = Handle<Function>();
|
||||
|
||||
if (info.Length() > 1)
|
||||
if (info.Length() > 1)
|
||||
func = JSBase::GetFunctionFromArg(info.GetIsolate(), info[1]);
|
||||
|
||||
if (!func.IsEmpty()) {
|
||||
@@ -238,7 +238,7 @@ JS_DBH_FUNCTION_IMPL(query)
|
||||
cb_func = FSDBH::Callback;
|
||||
arg = this;
|
||||
}
|
||||
|
||||
|
||||
if (dbh) {
|
||||
if (!func.IsEmpty()) {
|
||||
if (switch_cache_db_execute_sql_callback(dbh, sql, cb_func, arg, &err) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
@@ -62,7 +62,7 @@ Handle<Object> FSDTMF::New(switch_dtmf_t *dtmf, const char *name, JSMain *js)
|
||||
delete obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Handle<Object>();
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ void FSEventHandler::DoSubscribe(const v8::FunctionCallbackInfo<v8::Value>& info
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
info.GetReturnValue().Set(ret);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ JS_EVENTHANDLER_FUNCTION_IMPL(UnSubscribe)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
info.GetReturnValue().Set(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(Include)
|
||||
}
|
||||
switch_safe_free(path);
|
||||
}
|
||||
|
||||
|
||||
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Failed to include javascript file"));
|
||||
}
|
||||
}
|
||||
@@ -582,7 +582,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(Email)
|
||||
JS_CHECK_SCRIPT_STATE();
|
||||
HandleScope handle_scope(info.GetIsolate());
|
||||
string to, from, headers, body, file, convert_cmd, convert_ext;
|
||||
|
||||
|
||||
if (info.Length() > 0) {
|
||||
String::Utf8Value str(info[0]);
|
||||
to = js_safe_str(*str);
|
||||
@@ -642,7 +642,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(Bridge)
|
||||
if (info.Length() > 1) {
|
||||
if (info[0]->IsObject()) {
|
||||
obj_a = Handle<Object>::Cast(info[0]);
|
||||
|
||||
|
||||
if (!(jss_a = JSBase::GetInstance<FSSession>(obj_a))) {
|
||||
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Cannot find session A"));
|
||||
return;
|
||||
|
||||
@@ -316,7 +316,7 @@ JS_ODBC_FUNCTION_IMPL(GetData)
|
||||
SQLCHAR name[1024] = "";
|
||||
SQLCHAR *data = _colbuf;
|
||||
SQLLEN pcbValue;
|
||||
|
||||
|
||||
SQLDescribeCol(_stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
|
||||
SQLGetData(_stmt, x, SQL_C_CHAR, _colbuf, _cblen, &pcbValue);
|
||||
|
||||
|
||||
@@ -1778,7 +1778,7 @@ JS_SESSION_FUNCTION_IMPL(Bridge)
|
||||
if (info.Length() > 0) {
|
||||
if (info[0]->IsObject()) {
|
||||
obj_b = Handle<Object>::Cast(info[0]);
|
||||
|
||||
|
||||
if (!(jss_b = JSBase::GetInstance<FSSession>(obj_b))) {
|
||||
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Cannot find session B"));
|
||||
return;
|
||||
|
||||
@@ -39,12 +39,12 @@ FSXML::~FSXML(void)
|
||||
{
|
||||
if (!_rootObject) {
|
||||
/* This is the root object */
|
||||
|
||||
|
||||
/* Free the xml struct if it still exists */
|
||||
if (_xml) {
|
||||
switch_xml_free(_xml);
|
||||
}
|
||||
|
||||
|
||||
/* Free all sub-objects in the hash and destroy the hash */
|
||||
DestroyHash();
|
||||
} else if (_rootObject && _xml && _rootObject->_obj_hash) {
|
||||
@@ -118,7 +118,7 @@ Handle<Value> FSXML::GetJSObjFromXMLObj(const switch_xml_t xml, const v8::Functi
|
||||
} else {
|
||||
rootObj = _rootObject;
|
||||
}
|
||||
|
||||
|
||||
if (!rootObj) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find XML root node\n");
|
||||
return Handle<Value>();
|
||||
@@ -140,9 +140,9 @@ Handle<Value> FSXML::GetJSObjFromXMLObj(const switch_xml_t xml, const v8::Functi
|
||||
newObj->RegisterInstance(info.GetIsolate(), "", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (newObj) {
|
||||
return newObj->GetJavaScriptObject();
|
||||
return newObj->GetJavaScriptObject();
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new object - memory error?\n");
|
||||
@@ -345,7 +345,7 @@ JS_XML_IMPL_STATIC(Remove)
|
||||
JS_CHECK_SCRIPT_STATE();
|
||||
|
||||
FSXML *obj = JSBase::GetInstance<FSXML>(info);
|
||||
|
||||
|
||||
if (obj) {
|
||||
switch_xml_remove(obj->_xml);
|
||||
if (!obj->_rootObject) {
|
||||
|
||||
@@ -98,7 +98,7 @@ const string JSMain::LoadFileToString(const string& filename)
|
||||
JSMain::JSMain(void)
|
||||
{
|
||||
isolate = Isolate::New();
|
||||
|
||||
|
||||
extenderClasses = new vector<const js_class_definition_t *>();
|
||||
extenderFunctions = new vector<js_function_t *>();
|
||||
extenderInstances = new vector<registered_instance_t*>();
|
||||
@@ -178,7 +178,7 @@ const string JSMain::GetExceptionInfo(Isolate* isolate, TryCatch* try_catch)
|
||||
ostringstream ss;
|
||||
|
||||
ss << filename_string << ":" << linenum << ": " << exception_string << "\r\n";
|
||||
|
||||
|
||||
// Print line of source code.
|
||||
String::Utf8Value sourceline(message->GetSourceLine());
|
||||
const char *sourceline_string = js_safe_str(*sourceline);
|
||||
@@ -223,7 +223,7 @@ void JSMain::Include(const v8::FunctionCallbackInfo<Value>& args)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
args.GetReturnValue().Set(Undefined(args.GetIsolate()));
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void JSMain::Log(const v8::FunctionCallbackInfo<Value>& args)
|
||||
String::Utf8Value str(args[0]);
|
||||
|
||||
printf("%s\r\n", js_safe_str(*str));
|
||||
|
||||
|
||||
args.GetReturnValue().Set(Undefined(args.GetIsolate()));
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ const string JSMain::ExecuteString(const string& scriptData, const string& fileN
|
||||
#endif
|
||||
}
|
||||
//isolate->Exit();
|
||||
|
||||
|
||||
if (resultIsError) {
|
||||
*resultIsError = isError;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user