anti-venom for a nasty python byte

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5098 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-05-07 21:27:42 +00:00
parent 9572b3ce8c
commit 46c14326b3
6 changed files with 244 additions and 150 deletions

View File

@ -32,6 +32,10 @@ del types
PythonDTMFCallback = _freeswitch.PythonDTMFCallback PythonDTMFCallback = _freeswitch.PythonDTMFCallback
console_log = _freeswitch.console_log
console_clean_log = _freeswitch.console_clean_log
class SessionContainer(_object): class SessionContainer(_object):
__swig_setmethods__ = {} __swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, SessionContainer, name, value) __setattr__ = lambda self, name, value: _swig_setattr(self, SessionContainer, name, value)
@ -46,8 +50,6 @@ class SessionContainer(_object):
try: try:
if self.thisown: destroy(self) if self.thisown: destroy(self)
except: pass 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 answer(*args): return _freeswitch.SessionContainer_answer(*args)
def pre_answer(*args): return _freeswitch.SessionContainer_pre_answer(*args) def pre_answer(*args): return _freeswitch.SessionContainer_pre_answer(*args)
def hangup(*args): return _freeswitch.SessionContainer_hangup(*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) if not hasattr(self,"thisown"): _swig_setattr(self, SessionContainer, 'thisown', 0)
_swig_setattr(self, SessionContainer,self.__class__,SessionContainer) _swig_setattr(self, SessionContainer,self.__class__,SessionContainer)
_freeswitch.SessionContainer_swigregister(SessionContainerPtr) _freeswitch.SessionContainer_swigregister(SessionContainerPtr)
cvar = _freeswitch.cvar

View File

@ -1,6 +1,6 @@
#include "freeswitch_python.h" #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) SessionContainer::SessionContainer(char *nuuid)
{ {
@ -8,35 +8,25 @@ SessionContainer::SessionContainer(char *nuuid)
dtmfCallbackFunction = NULL; dtmfCallbackFunction = NULL;
tts_name = NULL; tts_name = NULL;
voice_name = NULL; voice_name = NULL;
if ((session = switch_core_session_locate(uuid))) {
switch_core_session_rwunlock(session); if (session = switch_core_session_locate(uuid)) {
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
} }
} }
SessionContainer::~SessionContainer() SessionContainer::~SessionContainer()
{ {
} if (session) {
switch_core_session_rwunlock(session);
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);
} }
int SessionContainer::answer() int SessionContainer::answer()
{ {
switch_status_t status; switch_status_t status;
sanity_check(-1);
status = switch_channel_answer(channel); status = switch_channel_answer(channel);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
@ -44,30 +34,34 @@ int SessionContainer::answer()
int SessionContainer::pre_answer() int SessionContainer::pre_answer()
{ {
switch_status_t status; switch_status_t status;
sanity_check(-1);
switch_channel_pre_answer(channel); switch_channel_pre_answer(channel);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
void SessionContainer::hangup(char *cause) void SessionContainer::hangup(char *cause)
{ {
sanity_check();
switch_channel_hangup(channel, switch_channel_str2cause(cause)); switch_channel_hangup(channel, switch_channel_str2cause(cause));
} }
void SessionContainer::set_variable(char *var, char *val) void SessionContainer::set_variable(char *var, char *val)
{ {
sanity_check();
switch_channel_set_variable(channel, var, val); switch_channel_set_variable(channel, var, val);
} }
void SessionContainer::get_variable(char *var, char *val) void SessionContainer::get_variable(char *var, char *val)
{ {
sanity_check();
switch_channel_get_variable(channel, var); switch_channel_get_variable(channel, var);
} }
void SessionContainer::set_state(char *state) 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) { if ((current_state = switch_channel_name_state(state)) < CS_HANGUP) {
switch_channel_set_state(channel, current_state); 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) int SessionContainer::play_file(char *file, char *timer_name)
{ {
switch_status_t status; 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)) { if (switch_strlen_zero(timer_name)) {
timer_name = NULL; timer_name = NULL;
} }
if (!dtmfCallbackFunction) { if (dtmfCallbackFunction) {
status = switch_ivr_play_file(session, NULL, file, &args); args.buf = dtmfCallbackFunction;
}
else {
globalDTMFCallbackFunction = dtmfCallbackFunction;
args.input_callback = PythonDTMFCallback; 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; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
void SessionContainer::set_dtmf_callback(PyObject *pyfunc) void SessionContainer::set_dtmf_callback(PyObject *pyfunc)
{ {
sanity_check();
if (!PyCallable_Check(pyfunc)) { if (!PyCallable_Check(pyfunc)) {
dtmfCallbackFunction = NULL; dtmfCallbackFunction = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF function is not a python function."); 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_status_t status;
switch_codec_t *codec; 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); codec = switch_core_session_get_read_codec(session);
if (!dtmfCallbackFunction) { if (dtmfCallbackFunction) {
status = switch_ivr_speak_text(session, tts_name, voice_name, args.buf = dtmfCallbackFunction;
codec->implementation->samples_per_second, text, &args);
}
else {
globalDTMFCallbackFunction = dtmfCallbackFunction;
args.input_callback = PythonDTMFCallback; args.input_callback = PythonDTMFCallback;
status = switch_ivr_speak_text(session, tts_name, voice_name, ap = &args;
codec->implementation->samples_per_second, text, &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; return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
} }
void SessionContainer::set_tts_parms(char *tts_name_p, char *voice_name_p) void SessionContainer::set_tts_parms(char *tts_name_p, char *voice_name_p)
{ {
sanity_check();
tts_name = tts_name_p; tts_name = tts_name_p;
voice_name = voice_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) int SessionContainer::get_digits(char *dtmf_buf, int len, char *terminators, char *terminator, int timeout)
{ {
switch_status_t status; 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); 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; 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) int SessionContainer::transfer(char *extension, char *dialplan, char *context)
{ {
switch_status_t status; switch_status_t status;
sanity_check(-1);
status = switch_ivr_session_transfer(session, extension, dialplan, context); status = switch_ivr_session_transfer(session, extension, dialplan, context);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0; 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) char *audio_files, char *bad_input_audio_files, char *dtmf_buf, char *digits_regex)
{ {
switch_status_t status; switch_status_t status;
sanity_check(-1);
status = switch_play_and_get_digits( session, (uint32_t) min_digits,(uint32_t) max_digits, status = switch_play_and_get_digits( session, (uint32_t) min_digits,(uint32_t) max_digits,
(uint32_t) max_tries, (uint32_t) timeout, (uint32_t) max_tries, (uint32_t) timeout,
terminators, audio_files, bad_input_audio_files, dtmf_buf, 128, digits_regex); terminators, audio_files, bad_input_audio_files, dtmf_buf, 128, digits_regex);

View File

@ -9,8 +9,9 @@ extern "C" {
#include <switch.h> #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); 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 { class SessionContainer {
private: private:
@ -23,8 +24,8 @@ extern "C" {
public: public:
SessionContainer(char *uuid); SessionContainer(char *uuid);
~SessionContainer(); ~SessionContainer();
void console_log(char *level_str, char *msg); //void console_log(char *level_str, char *msg);
void console_clean_log(char *msg); //void console_clean_log(char *msg);
int answer(); int answer();
int pre_answer(); int pre_answer();
void hangup(char *cause); void hangup(char *cause);

View File

@ -42,43 +42,127 @@
#include <switch.h> #include <switch.h>
void init_freeswitch(void); void init_freeswitch(void);
static switch_api_interface_t python_run_interface; static switch_api_interface_t python_run_interface;
const char modname[] = "mod_python"; 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) 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; eval_some_python(switch_core_session_get_uuid(session), (char *)data);
pythonfile = fopen(data, "r");
}
Py_Initialize(); struct switch_py_thread {
PySys_SetArgv(1, argv); char *args;
init_freeswitch(); switch_memory_pool_t *pool;
PyRun_SimpleFile(pythonfile, ""); };
Py_Finalize();
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));
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) 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)) { if (switch_strlen_zero(text)) {
stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax); stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
return SWITCH_STATUS_SUCCESS; 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(); pt->pool = pool;
init_freeswitch(); pt->args = switch_core_strdup(pt->pool, text);
PyRun_SimpleFile(pythonfile, "");
Py_Finalize(); 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"); stream->write_function(stream, "OK\n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
@ -114,32 +198,46 @@ static switch_loadable_module_interface_t python_module_interface = {
/*.directory_interface */ NULL /*.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) 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 */ /* connect my internal structure to the blank pointer passed to me */
*module_interface = &python_module_interface; *module_interface = &python_module_interface;
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");
Py_Initialize();
PyEval_InitThreads();
mainThreadState = PyThreadState_Get();
PyEval_ReleaseLock();
/* indicate that the module should continue to be loaded */ /* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
/* /*
Called when the system shuts down Called when the system shuts down*/
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void) SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{ {
return SWITCH_STATUS_SUCCESS;
} 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 */ /* Return the number of arguments of the application command line */

View File

@ -22,9 +22,9 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
PyObject *result; PyObject *result;
switch_status_t dres = SWITCH_STATUS_FALSE; switch_status_t dres = SWITCH_STATUS_FALSE;
func = (PyObject *) globalDTMFCallbackFunction; // Get Python function func = (PyObject *) buf; // Get Python function
arglist = Py_BuildValue("(sisi)",input,itype,buf,buflen); // Build argument list arglist = Py_BuildValue("(si)", input, itype); // Build argument list
result = PyEval_CallObject(func,arglist); // Call Python result = PyEval_CallObject(func, arglist); // Call Python
Py_DECREF(arglist); // Trash arglist Py_DECREF(arglist); // Trash arglist
if (result) { // If no errors, return double if (result) { // If no errors, return double
dres = (switch_status_t) PyInt_AsLong(result); dres = (switch_status_t) PyInt_AsLong(result);
@ -33,5 +33,22 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
return dres; 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);
}
%} %}

View 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_status_t swig_types[0]
#define SWIGTYPE_p_switch_input_type_t swig_types[1] #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[2]
#define SWIGTYPE_p_switch_core_session swig_types[3] #define SWIGTYPE_p_SessionContainer swig_types[3]
#define SWIGTYPE_p_SessionContainer swig_types[4] static swig_type_info *swig_types[5];
static swig_type_info *swig_types[6];
/* -------- TYPES TABLE (END) -------- */ /* -------- TYPES TABLE (END) -------- */
@ -719,7 +718,6 @@ static swig_type_info *swig_types[6];
#include "freeswitch_python.h" #include "freeswitch_python.h"
extern void *globalDTMFCallbackFunction;
extern switch_status_t PythonDTMFCallback(switch_core_session *,void *,switch_input_type_t,void *,unsigned int); 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) { static PyObject* t_output_helper(PyObject* target, PyObject* o) {
@ -760,9 +758,9 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
PyObject *result; PyObject *result;
switch_status_t dres = SWITCH_STATUS_FALSE; switch_status_t dres = SWITCH_STATUS_FALSE;
func = (PyObject *) globalDTMFCallbackFunction; // Get Python function func = (PyObject *) buf; // Get Python function
arglist = Py_BuildValue("(sisi)",input,itype,buf,buflen); // Build argument list arglist = Py_BuildValue("(si)", input, itype); // Build argument list
result = PyEval_CallObject(func,arglist); // Call Python result = PyEval_CallObject(func, arglist); // Call Python
Py_DECREF(arglist); // Trash arglist Py_DECREF(arglist); // Trash arglist
if (result) { // If no errors, return double if (result) { // If no errors, return double
dres = (switch_status_t) PyInt_AsLong(result); dres = (switch_status_t) PyInt_AsLong(result);
@ -772,30 +770,26 @@ switch_status_t PythonDTMFCallback(switch_core_session_t *session,
} }
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);
}
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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;
}
return 0;
}
static PyObject *_wrap_globalDTMFCallbackFunction_get() {
PyObject *pyobj;
pyobj = SWIG_NewPointerObj((void *) globalDTMFCallbackFunction, SWIGTYPE_p_void, 0);
return pyobj;
}
static PyObject *_wrap_PythonDTMFCallback(PyObject *self, PyObject *args) { static PyObject *_wrap_PythonDTMFCallback(PyObject *self, PyObject *args) {
PyObject *resultobj; PyObject *resultobj;
switch_core_session *arg1 = (switch_core_session *) 0 ; switch_core_session *arg1 = (switch_core_session *) 0 ;
@ -832,6 +826,35 @@ static PyObject *_wrap_PythonDTMFCallback(PyObject *self, PyObject *args) {
} }
static PyObject *_wrap_console_log(PyObject *self, PyObject *args) {
PyObject *resultobj;
char *arg1 ;
char *arg2 ;
if(!PyArg_ParseTuple(args,(char *)"ss:console_log",&arg1,&arg2)) goto fail;
console_log(arg1,arg2);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_console_clean_log(PyObject *self, PyObject *args) {
PyObject *resultobj;
char *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;
fail:
return NULL;
}
static PyObject *_wrap_new_SessionContainer(PyObject *self, PyObject *args) { static PyObject *_wrap_new_SessionContainer(PyObject *self, PyObject *args) {
PyObject *resultobj; PyObject *resultobj;
char *arg1 ; char *arg1 ;
@ -863,41 +886,6 @@ static PyObject *_wrap_delete_SessionContainer(PyObject *self, PyObject *args) {
} }
static PyObject *_wrap_SessionContainer_console_log(PyObject *self, PyObject *args) {
PyObject *resultobj;
SessionContainer *arg1 = (SessionContainer *) 0 ;
char *arg2 ;
char *arg3 ;
PyObject * obj0 = 0 ;
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);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_SessionContainer_console_clean_log(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 ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
(arg1)->console_clean_log(arg2);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_SessionContainer_answer(PyObject *self, PyObject *args) { static PyObject *_wrap_SessionContainer_answer(PyObject *self, PyObject *args) {
PyObject *resultobj; PyObject *resultobj;
SessionContainer *arg1 = (SessionContainer *) 0 ; SessionContainer *arg1 = (SessionContainer *) 0 ;
@ -1195,10 +1183,10 @@ static PyObject * SessionContainer_swigregister(PyObject *self, PyObject *args)
} }
static PyMethodDef SwigMethods[] = { static PyMethodDef SwigMethods[] = {
{ (char *)"PythonDTMFCallback", _wrap_PythonDTMFCallback, METH_VARARGS }, { (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 *)"new_SessionContainer", _wrap_new_SessionContainer, METH_VARARGS },
{ (char *)"delete_SessionContainer", _wrap_delete_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_answer", _wrap_SessionContainer_answer, METH_VARARGS },
{ (char *)"SessionContainer_pre_answer", _wrap_SessionContainer_pre_answer, METH_VARARGS }, { (char *)"SessionContainer_pre_answer", _wrap_SessionContainer_pre_answer, METH_VARARGS },
{ (char *)"SessionContainer_hangup", _wrap_SessionContainer_hangup, 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_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_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_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 _swigt__p_SessionContainer[] = {{"_p_SessionContainer", 0, "SessionContainer *", 0},{"_p_SessionContainer"},{0}};
static swig_type_info *swig_types_initial[] = { static swig_type_info *swig_types_initial[] = {
_swigt__p_switch_status_t, _swigt__p_switch_status_t,
_swigt__p_switch_input_type_t, _swigt__p_switch_input_type_t,
_swigt__p_void,
_swigt__p_switch_core_session, _swigt__p_switch_core_session,
_swigt__p_SessionContainer, _swigt__p_SessionContainer,
0 0
@ -1264,7 +1250,5 @@ SWIGEXPORT(void) SWIG_init(void) {
} }
SWIG_InstallConstants(d,swig_const_table); 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);
} }