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
+20 -3
View 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);
}
%}