]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
anti-venom for a nasty python byte
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 May 2007 21:27:42 +0000 (21:27 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 May 2007 21:27:42 +0000 (21:27 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5098 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_python/freeswitch.py
src/mod/languages/mod_python/freeswitch_python.cpp
src/mod/languages/mod_python/freeswitch_python.h
src/mod/languages/mod_python/mod_python.c
src/mod/languages/mod_python/mod_python.i
src/mod/languages/mod_python/mod_python_wrap.cpp

index a3b40365b6845f2df3903e3fc7db447c164dd699..e9c2cfb735da470ef4783a935f05fbf9dc6185ee 100644 (file)
@@ -32,6 +32,10 @@ del types
 
 
 PythonDTMFCallback = _freeswitch.PythonDTMFCallback
+
+console_log = _freeswitch.console_log
+
+console_clean_log = _freeswitch.console_clean_log
 class SessionContainer(_object):
     __swig_setmethods__ = {}
     __setattr__ = lambda self, name, value: _swig_setattr(self, SessionContainer, name, value)
@@ -46,8 +50,6 @@ class SessionContainer(_object):
         try:
             if self.thisown: destroy(self)
         except: pass
-    def console_log(*args): return _freeswitch.SessionContainer_console_log(*args)
-    def console_clean_log(*args): return _freeswitch.SessionContainer_console_clean_log(*args)
     def answer(*args): return _freeswitch.SessionContainer_answer(*args)
     def pre_answer(*args): return _freeswitch.SessionContainer_pre_answer(*args)
     def hangup(*args): return _freeswitch.SessionContainer_hangup(*args)
@@ -68,6 +70,5 @@ class SessionContainerPtr(SessionContainer):
         if not hasattr(self,"thisown"): _swig_setattr(self, SessionContainer, 'thisown', 0)
         _swig_setattr(self, SessionContainer,self.__class__,SessionContainer)
 _freeswitch.SessionContainer_swigregister(SessionContainerPtr)
-cvar = _freeswitch.cvar
 
 
index bdaebb1d796d03cbde5809f16b638d7047efda6a..5819b0a48057dfc202e659d842515ff8cf906a8b 100644 (file)
@@ -1,6 +1,6 @@
 #include "freeswitch_python.h"
 
-void *globalDTMFCallbackFunction;
+#define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
 
 SessionContainer::SessionContainer(char *nuuid)
 {
@@ -8,35 +8,25 @@ SessionContainer::SessionContainer(char *nuuid)
     dtmfCallbackFunction = NULL;
     tts_name = NULL;
     voice_name = NULL;
-    if ((session = switch_core_session_locate(uuid))) {
-        switch_core_session_rwunlock(session);
-        channel = switch_core_session_get_channel(session);
+
+       if (session = switch_core_session_locate(uuid)) {
+               channel = switch_core_session_get_channel(session);
     }
 }
 
 SessionContainer::~SessionContainer()
 {
 
-}
-
-void SessionContainer::console_log(char *level_str, char *msg)
-{
-    switch_log_level_t level = SWITCH_LOG_DEBUG;
-    if (level_str) {
-        level = switch_log_str2level(level_str);
-    }
-    switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
-}
-
-void SessionContainer::console_clean_log(char *msg)
-{
-    switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, msg);
+       if (session) {
+               switch_core_session_rwunlock(session);
+       }
 }
 
 int SessionContainer::answer()
 {
     switch_status_t status;
-    
+
+       sanity_check(-1);
     status = switch_channel_answer(channel);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
@@ -44,30 +34,34 @@ int SessionContainer::answer()
 int SessionContainer::pre_answer()
 {
     switch_status_t status;
-
+       sanity_check(-1);
     switch_channel_pre_answer(channel);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 void SessionContainer::hangup(char *cause)
 {
+       sanity_check();
     switch_channel_hangup(channel, switch_channel_str2cause(cause));
 }
 
 void SessionContainer::set_variable(char *var, char *val)
 {
+       sanity_check();
     switch_channel_set_variable(channel, var, val);
 }
 
 void SessionContainer::get_variable(char *var, char *val)
 {
+       sanity_check();
     switch_channel_get_variable(channel, var);
 }
 
 void SessionContainer::set_state(char *state)
 {
-    switch_channel_state_t current_state = switch_channel_get_state(channel);
-
+    switch_channel_state_t current_state;
+       sanity_check();
+       current_state = switch_channel_get_state(channel);
     if ((current_state = switch_channel_name_state(state)) < CS_HANGUP) {
         switch_channel_set_state(channel, current_state);
     }
@@ -76,26 +70,26 @@ void SessionContainer::set_state(char *state)
 int SessionContainer::play_file(char *file, char *timer_name)
 {
     switch_status_t status;
-    switch_input_args_t args = { 0 };
+    switch_input_args_t args = { 0 }, *ap = NULL;
+       sanity_check(-1);
 
     if (switch_strlen_zero(timer_name)) {
         timer_name = NULL;
     }
 
-    if (!dtmfCallbackFunction) {
-        status = switch_ivr_play_file(session, NULL, file, &args);
-    } 
-    else {
-        globalDTMFCallbackFunction = dtmfCallbackFunction;
+    if (dtmfCallbackFunction) {
+               args.buf = dtmfCallbackFunction;
         args.input_callback = PythonDTMFCallback;
-        status = switch_ivr_play_file(session, NULL, file, &args);
+               ap = &args;
     }
 
+       status = switch_ivr_play_file(session, NULL, file, ap);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 void SessionContainer::set_dtmf_callback(PyObject *pyfunc)
 {
+       sanity_check();
     if (!PyCallable_Check(pyfunc)) {
         dtmfCallbackFunction = NULL;
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF function is not a python function.");
@@ -109,25 +103,24 @@ int SessionContainer::speak_text(char *text)
 {
     switch_status_t status;
     switch_codec_t *codec;
-    switch_input_args_t args = { 0 };
+    switch_input_args_t args = { 0 }, *ap = NULL;
+
+       sanity_check(-1);
 
     codec = switch_core_session_get_read_codec(session);
-    if (!dtmfCallbackFunction) {
-        status = switch_ivr_speak_text(session, tts_name, voice_name, 
-                codec->implementation->samples_per_second, text, &args);
-    }
-    else {
-        globalDTMFCallbackFunction = dtmfCallbackFunction;
+    if (dtmfCallbackFunction) {
+               args.buf = dtmfCallbackFunction;
         args.input_callback = PythonDTMFCallback;
-        status = switch_ivr_speak_text(session, tts_name, voice_name, 
-                codec->implementation->samples_per_second, text, &args);
+               ap = &args;
     }
 
+       status = switch_ivr_speak_text(session, tts_name, voice_name, codec->implementation->samples_per_second, text, ap);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 void SessionContainer::set_tts_parms(char *tts_name_p, char *voice_name_p)
 {
+       sanity_check();
     tts_name = tts_name_p;
     voice_name = voice_name_p;
 }
@@ -135,7 +128,7 @@ void SessionContainer::set_tts_parms(char *tts_name_p, char *voice_name_p)
 int SessionContainer::get_digits(char *dtmf_buf, int len, char *terminators, char *terminator, int timeout)
 {
     switch_status_t status;
-
+       sanity_check(-1);
     status = switch_ivr_collect_digits_count(session, dtmf_buf,(uint32_t) len,(uint32_t) len, terminators, terminator, (uint32_t) timeout);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
@@ -143,7 +136,7 @@ int SessionContainer::get_digits(char *dtmf_buf, int len, char *terminators, cha
 int SessionContainer::transfer(char *extension, char *dialplan, char *context)
 {
     switch_status_t status;
-
+       sanity_check(-1);
     status = switch_ivr_session_transfer(session, extension, dialplan, context);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
@@ -152,7 +145,7 @@ int SessionContainer::play_and_get_digits(int min_digits, int max_digits, int ma
                 char *audio_files, char *bad_input_audio_files, char *dtmf_buf, char *digits_regex)
 {
     switch_status_t status;
-
+       sanity_check(-1);
     status = switch_play_and_get_digits( session, (uint32_t) min_digits,(uint32_t) max_digits,
             (uint32_t) max_tries, (uint32_t) timeout, 
             terminators, audio_files, bad_input_audio_files, dtmf_buf, 128, digits_regex);
index 98282dbe57f5b1b8977285508e02bd674c0c2634..9f57238ac34eb9f9ab0a9eb518a6a7f708ec1d0b 100644 (file)
@@ -9,8 +9,9 @@ extern "C" {
 
 #include <switch.h>
 
-       extern void *globalDTMFCallbackFunction;
        extern switch_status_t PythonDTMFCallback(switch_core_session * session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
+       void console_log(char *level_str, char *msg);
+       void console_clean_log(char *msg);
 
        class SessionContainer {
          private:
@@ -23,8 +24,8 @@ extern "C" {
          public:
                     SessionContainer(char *uuid);
                    ~SessionContainer();
-               void console_log(char *level_str, char *msg);
-               void console_clean_log(char *msg);
+                       //void console_log(char *level_str, char *msg);
+                       //void console_clean_log(char *msg);
                int answer();
                int pre_answer();
                void hangup(char *cause);
index 6e00bfcf9037adf2c0e870d4654cafbe0b4de5b2..7973d25233970648c274e5fe026b0081b484c107 100644 (file)
 
 #include <switch.h>
 
+
+
 void init_freeswitch(void);
 static switch_api_interface_t python_run_interface;
 
 const char modname[] = "mod_python";
 
+static void eval_some_python(char *uuid, char *args)
+{
+       PyThreadState *tstate;
+       FILE *pythonfile = NULL;
+       char *dupargs = NULL;
+       char *argv[128] = {0};
+       int argc;
+       int lead = 0;
+       char *script = NULL;
+
+       if (args) {
+               dupargs = strdup(args);
+       } else {
+               return;
+       }
+
+       assert(dupargs != NULL);
+       
+       if (!(argc = switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No script name specified!\n");
+               goto done;
+       }
+
+       script = argv[0];
+       
+       if (uuid) {
+               argv[0] = uuid;
+       } else {
+               lead = 1;
+       }
+
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "running %s\n", script);
+
+
+       if ((pythonfile = fopen(script, "r"))) {
+               PyEval_AcquireLock();
+               tstate = Py_NewInterpreter();
+               PyEval_ReleaseLock(); 
+
+               if (!tstate) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
+                       goto done;
+               }
+
+
+               init_freeswitch();
+               PySys_SetArgv(argc - lead, &argv[lead]);
+               PyRun_SimpleFile(pythonfile, "");
+               Py_EndInterpreter(tstate);
+               
+       } else {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error running %s\n", script);
+       }
+
+
+ done:
+
+       if (pythonfile) {
+               fclose(pythonfile);
+       }
+
+       switch_safe_free(dupargs);
+}
+
 static void python_function(switch_core_session_t *session, char *data)
 {
-       char *uuid = switch_core_session_get_uuid(session);
-       char *argv[1];
-       FILE *pythonfile;
 
-       argv[0] = uuid;
-       pythonfile = fopen(data, "r");
+       eval_some_python(switch_core_session_get_uuid(session), (char *)data);
+       
+}
+
+struct switch_py_thread {
+       char *args;
+       switch_memory_pool_t *pool;
+};
+
+static void *SWITCH_THREAD_FUNC py_thread_run(switch_thread_t *thread, void *obj)
+{
+       switch_memory_pool_t *pool;
+       struct switch_py_thread *pt = (struct switch_py_thread *) obj;
+
+       eval_some_python(NULL, strdup(pt->args));
 
-       Py_Initialize();
-       PySys_SetArgv(1, argv);
-       init_freeswitch();
-       PyRun_SimpleFile(pythonfile, "");
-       Py_Finalize();
+       pool = pt->pool;
+       switch_core_destroy_memory_pool(&pool);
 
+       return NULL;
 }
 
 static switch_status_t launch_python(char *text, switch_core_session_t *session, switch_stream_handle_t *stream)
 {
-       FILE *pythonfile;
+       switch_thread_t *thread;
+    switch_threadattr_t *thd_attr = NULL;
+       switch_memory_pool_t *pool;
+       struct switch_py_thread *pt;
 
        if (switch_strlen_zero(text)) {
                stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
                return SWITCH_STATUS_SUCCESS;
        }
+       
+       switch_core_new_memory_pool(&pool);
+       assert(pool != NULL);
 
-       pythonfile = fopen(text, "r");
+       pt = switch_core_alloc(pool, sizeof(*pt));
+       assert(pt != NULL);
 
-       Py_Initialize();
-       init_freeswitch();
-       PyRun_SimpleFile(pythonfile, "");
-       Py_Finalize();
+       pt->pool = pool;
+       pt->args = switch_core_strdup(pt->pool, text);
+       
+    switch_threadattr_create(&thd_attr, pt->pool);
+    switch_threadattr_detach_set(thd_attr, 1);
+    switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+    switch_thread_create(&thread, thd_attr, py_thread_run, pt, pt->pool);
 
        stream->write_function(stream, "OK\n");
        return SWITCH_STATUS_SUCCESS;
@@ -114,32 +198,46 @@ static switch_loadable_module_interface_t python_module_interface = {
        /*.directory_interface */ NULL
 };
 
+//static PyThreadState *gtstate;
+static PyThreadState *mainThreadState;
+
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
 {
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = &python_module_interface;
-
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
+       
+       Py_Initialize();
+       PyEval_InitThreads();
+
+       mainThreadState = PyThreadState_Get();
+
+       PyEval_ReleaseLock();   
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
 
 /*
-  Called when the system shuts down
-  SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
-  {
-  return SWITCH_STATUS_SUCCESS;
-  }
-*/
+  Called when the system shuts down*/
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
+{
+
+       PyInterpreterState *mainInterpreterState;
+       PyThreadState *myThreadState;
+
+       PyEval_AcquireLock();
+       mainInterpreterState = mainThreadState->interp;
+       myThreadState = PyThreadState_New(mainInterpreterState);
+       PyThreadState_Swap(myThreadState);
+       PyEval_ReleaseLock();
+
+       Py_Finalize();
+       PyEval_ReleaseLock();
+       return SWITCH_STATUS_SUCCESS;
+}
+
 
-/*
-  If it exists, this is called in it's own thread when the module-load completes
-  SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
-  {
-  return SWITCH_STATUS_SUCCESS;
-  }
-*/
 
 
 /* Return the number of arguments of the application command line */
index 65b8db003a351e4178145c56c40630cbe0bcd40b..8b5ac29ccaa58f6f0e38b6266e52597b75d916f7 100644 (file)
@@ -22,9 +22,9 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
    PyObject *result;
    switch_status_t dres = SWITCH_STATUS_FALSE;
    
-   func = (PyObject *) globalDTMFCallbackFunction;               // Get Python function
-   arglist = Py_BuildValue("(sisi)",input,itype,buf,buflen);             // Build argument list
-   result = PyEval_CallObject(func,arglist);     // Call Python
+   func = (PyObject *) buf;               // Get Python function
+   arglist = Py_BuildValue("(si)", input, itype);             // Build argument list
+   result = PyEval_CallObject(func, arglist);     // Call Python
    Py_DECREF(arglist);                           // Trash arglist
    if (result) {                                 // If no errors, return double
      dres = (switch_status_t) PyInt_AsLong(result);
@@ -33,5 +33,22 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
    return dres;
 }
 
+
+void console_log(char *level_str, char *msg)
+{
+    switch_log_level_t level = SWITCH_LOG_DEBUG;
+    if (level_str) {
+        level = switch_log_str2level(level_str);
+    }
+    switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
+}
+
+void console_clean_log(char *msg)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, msg);
+}
+
+
+
 %}
 
index 0d4b3dd5f8524f340c230cc252969f07b648cf14..79271801b02bc2525390d085360b5a2334007332 100644 (file)
@@ -702,10 +702,9 @@ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
 
 #define  SWIGTYPE_p_switch_status_t swig_types[0] 
 #define  SWIGTYPE_p_switch_input_type_t swig_types[1] 
-#define  SWIGTYPE_p_void swig_types[2] 
-#define  SWIGTYPE_p_switch_core_session swig_types[3] 
-#define  SWIGTYPE_p_SessionContainer swig_types[4] 
-static swig_type_info *swig_types[6];
+#define  SWIGTYPE_p_switch_core_session swig_types[2] 
+#define  SWIGTYPE_p_SessionContainer swig_types[3] 
+static swig_type_info *swig_types[5];
 
 /* -------- TYPES TABLE (END) -------- */
 
@@ -719,7 +718,6 @@ static swig_type_info *swig_types[6];
 
 #include "freeswitch_python.h"
 
-extern void *globalDTMFCallbackFunction;
 extern switch_status_t PythonDTMFCallback(switch_core_session *,void *,switch_input_type_t,void *,unsigned int);
 
 static PyObject* t_output_helper(PyObject* target, PyObject* o) {
@@ -760,9 +758,9 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
    PyObject *result;
    switch_status_t dres = SWITCH_STATUS_FALSE;
    
-   func = (PyObject *) globalDTMFCallbackFunction;               // Get Python function
-   arglist = Py_BuildValue("(sisi)",input,itype,buf,buflen);             // Build argument list
-   result = PyEval_CallObject(func,arglist);     // Call Python
+   func = (PyObject *) buf;               // Get Python function
+   arglist = Py_BuildValue("(si)", input, itype);             // Build argument list
+   result = PyEval_CallObject(func, arglist);     // Call Python
    Py_DECREF(arglist);                           // Trash arglist
    if (result) {                                 // If no errors, return double
      dres = (switch_status_t) PyInt_AsLong(result);
@@ -772,30 +770,26 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
 }
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-static int _wrap_globalDTMFCallbackFunction_set(PyObject *_val) {
-    {
-        void * temp;
-        if ((SWIG_ConvertPtr(_val,(void **) &temp, 0, SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN)) == -1) {
-            PyErr_SetString(PyExc_TypeError, "C variable 'globalDTMFCallbackFunction (void *)'");
-            return 1;
-        }
-        globalDTMFCallbackFunction = (void *) temp;
+void console_log(char *level_str, char *msg)
+{
+    switch_log_level_t level = SWITCH_LOG_DEBUG;
+    if (level_str) {
+        level = switch_log_str2level(level_str);
     }
-    return 0;
+    switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
 }
 
-
-static PyObject *_wrap_globalDTMFCallbackFunction_get() {
-    PyObject *pyobj;
-    
-    pyobj = SWIG_NewPointerObj((void *) globalDTMFCallbackFunction, SWIGTYPE_p_void, 0);
-    return pyobj;
+void console_clean_log(char *msg)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, msg);
 }
 
 
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 static PyObject *_wrap_PythonDTMFCallback(PyObject *self, PyObject *args) {
     PyObject *resultobj;
     switch_core_session *arg1 = (switch_core_session *) 0 ;
@@ -832,29 +826,27 @@ static PyObject *_wrap_PythonDTMFCallback(PyObject *self, PyObject *args) {
 }
 
 
-static PyObject *_wrap_new_SessionContainer(PyObject *self, PyObject *args) {
+static PyObject *_wrap_console_log(PyObject *self, PyObject *args) {
     PyObject *resultobj;
     char *arg1 ;
-    SessionContainer *result;
+    char *arg2 ;
     
-    if(!PyArg_ParseTuple(args,(char *)"s:new_SessionContainer",&arg1)) goto fail;
-    result = (SessionContainer *)new SessionContainer(arg1);
+    if(!PyArg_ParseTuple(args,(char *)"ss:console_log",&arg1,&arg2)) goto fail;
+    console_log(arg1,arg2);
     
-    resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_SessionContainer, 1);
+    Py_INCREF(Py_None); resultobj = Py_None;
     return resultobj;
     fail:
     return NULL;
 }
 
 
-static PyObject *_wrap_delete_SessionContainer(PyObject *self, PyObject *args) {
+static PyObject *_wrap_console_clean_log(PyObject *self, PyObject *args) {
     PyObject *resultobj;
-    SessionContainer *arg1 = (SessionContainer *) 0 ;
-    PyObject * obj0 = 0 ;
+    char *arg1 ;
     
-    if(!PyArg_ParseTuple(args,(char *)"O:delete_SessionContainer",&obj0)) goto fail;
-    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    delete arg1;
+    if(!PyArg_ParseTuple(args,(char *)"s:console_clean_log",&arg1)) goto fail;
+    console_clean_log(arg1);
     
     Py_INCREF(Py_None); resultobj = Py_None;
     return resultobj;
@@ -863,33 +855,29 @@ static PyObject *_wrap_delete_SessionContainer(PyObject *self, PyObject *args) {
 }
 
 
-static PyObject *_wrap_SessionContainer_console_log(PyObject *self, PyObject *args) {
+static PyObject *_wrap_new_SessionContainer(PyObject *self, PyObject *args) {
     PyObject *resultobj;
-    SessionContainer *arg1 = (SessionContainer *) 0 ;
-    char *arg2 ;
-    char *arg3 ;
-    PyObject * obj0 = 0 ;
+    char *arg1 ;
+    SessionContainer *result;
     
-    if(!PyArg_ParseTuple(args,(char *)"Oss:SessionContainer_console_log",&obj0,&arg2,&arg3)) goto fail;
-    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    (arg1)->console_log(arg2,arg3);
+    if(!PyArg_ParseTuple(args,(char *)"s:new_SessionContainer",&arg1)) goto fail;
+    result = (SessionContainer *)new SessionContainer(arg1);
     
-    Py_INCREF(Py_None); resultobj = Py_None;
+    resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_SessionContainer, 1);
     return resultobj;
     fail:
     return NULL;
 }
 
 
-static PyObject *_wrap_SessionContainer_console_clean_log(PyObject *self, PyObject *args) {
+static PyObject *_wrap_delete_SessionContainer(PyObject *self, PyObject *args) {
     PyObject *resultobj;
     SessionContainer *arg1 = (SessionContainer *) 0 ;
-    char *arg2 ;
     PyObject * obj0 = 0 ;
     
-    if(!PyArg_ParseTuple(args,(char *)"Os:SessionContainer_console_clean_log",&obj0,&arg2)) goto fail;
+    if(!PyArg_ParseTuple(args,(char *)"O:delete_SessionContainer",&obj0)) goto fail;
     if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    (arg1)->console_clean_log(arg2);
+    delete arg1;
     
     Py_INCREF(Py_None); resultobj = Py_None;
     return resultobj;
@@ -1195,10 +1183,10 @@ static PyObject * SessionContainer_swigregister(PyObject *self, PyObject *args)
 }
 static PyMethodDef SwigMethods[] = {
         { (char *)"PythonDTMFCallback", _wrap_PythonDTMFCallback, METH_VARARGS },
+        { (char *)"console_log", _wrap_console_log, METH_VARARGS },
+        { (char *)"console_clean_log", _wrap_console_clean_log, METH_VARARGS },
         { (char *)"new_SessionContainer", _wrap_new_SessionContainer, METH_VARARGS },
         { (char *)"delete_SessionContainer", _wrap_delete_SessionContainer, METH_VARARGS },
-        { (char *)"SessionContainer_console_log", _wrap_SessionContainer_console_log, METH_VARARGS },
-        { (char *)"SessionContainer_console_clean_log", _wrap_SessionContainer_console_clean_log, METH_VARARGS },
         { (char *)"SessionContainer_answer", _wrap_SessionContainer_answer, METH_VARARGS },
         { (char *)"SessionContainer_pre_answer", _wrap_SessionContainer_pre_answer, METH_VARARGS },
         { (char *)"SessionContainer_hangup", _wrap_SessionContainer_hangup, METH_VARARGS },
@@ -1221,14 +1209,12 @@ static PyMethodDef SwigMethods[] = {
 
 static swig_type_info _swigt__p_switch_status_t[] = {{"_p_switch_status_t", 0, "switch_status_t *", 0},{"_p_switch_status_t"},{0}};
 static swig_type_info _swigt__p_switch_input_type_t[] = {{"_p_switch_input_type_t", 0, "switch_input_type_t *", 0},{"_p_switch_input_type_t"},{0}};
-static swig_type_info _swigt__p_void[] = {{"_p_void", 0, "void *", 0},{"_p_void"},{0}};
 static swig_type_info _swigt__p_switch_core_session[] = {{"_p_switch_core_session", 0, "switch_core_session *", 0},{"_p_switch_core_session"},{0}};
 static swig_type_info _swigt__p_SessionContainer[] = {{"_p_SessionContainer", 0, "SessionContainer *", 0},{"_p_SessionContainer"},{0}};
 
 static swig_type_info *swig_types_initial[] = {
 _swigt__p_switch_status_t, 
 _swigt__p_switch_input_type_t, 
-_swigt__p_void, 
 _swigt__p_switch_core_session, 
 _swigt__p_SessionContainer, 
 0
@@ -1264,7 +1250,5 @@ SWIGEXPORT(void) SWIG_init(void) {
     }
     SWIG_InstallConstants(d,swig_const_table);
     
-    PyDict_SetItemString(d,(char*)"cvar", SWIG_globals);
-    SWIG_addvarlink(SWIG_globals,(char*)"globalDTMFCallbackFunction",_wrap_globalDTMFCallbackFunction_get, _wrap_globalDTMFCallbackFunction_set);
 }