Modified: freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/luaexec.c (17061 => 17062)
--- freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/luaexec.c 2010-03-20 17:37:34 UTC (rev 17061)
+++ freeswitch/trunk/contrib/nazim/xmlcdrd/plugins/luaexec/luaexec.c 2010-03-21 22:02:10 UTC (rev 17062)
@@ -62,6 +62,8 @@
/*that's what lua script would call to get variable*/
#define LUAEXEC_VAR_GET_FUNC "xcdr_varget"
+#define LUAEXEC_DBG_PRN_FUNCT "xcdr_prn_debug"
+
/*Names of standard function which script must provide*/
#define LUAEXEC_FUNC_INIT "luaexec_init"
#define LUAEXEC_FUNC_FREE "luaexec_free"
@@ -119,6 +121,20 @@
}
+
+
+static int l_debug_prn (lua_State *L)
+{
+ const char* str = luaL_checkstring(L, 1);
+
+ fprintf (stderr, "%s\n", str);
+ syslog (LOG_DEBUG, "xmlcdr '%s' [%d]: %s\n", vars->luascript, getpid(), str);
+
+ return 0;
+}
+
+
+
/**/
int plugin_init (const char* filename, const char *options, XCDR_PLUGSTATE *state)
{
@@ -167,6 +183,9 @@
lua_pushcfunction(vars->L, l_varget);
lua_setglobal(vars->L, LUAEXEC_VAR_GET_FUNC);
+ lua_pushcfunction(vars->L, l_debug_prn);
+ lua_setglobal(vars->L, LUAEXEC_DBG_PRN_FUNCT);
+
if (luaL_loadfile(vars->L, vars->luascript) )
fprintf(stderr, "can't load file: %s, %s\n", vars->luascript,