merge changes to mod_python from jkr888 branch. Thanks Johny.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3781 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2006-12-21 17:11:43 +00:00
parent f8bc176e19
commit ce3fd3fce4
9 changed files with 6813 additions and 749 deletions
+37
View File
@@ -0,0 +1,37 @@
%module freeswitch
%include "cstring.i"
%cstring_bounded_mutable(char *dtmf_buf, 128);
%cstring_bounded_mutable(char *terminator, 8);
%{
#include "freeswitch_python.h"
%}
%include freeswitch_python.h
%{
switch_status_t PythonDTMFCallback(switch_core_session_t *session,
void *input,
switch_input_type_t itype,
void *buf,
unsigned int buflen)
{
PyObject *func, *arglist;
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
Py_DECREF(arglist); // Trash arglist
if (result) { // If no errors, return double
dres = (switch_status_t) PyInt_AsLong(result);
}
Py_XDECREF(result);
return dres;
}
%}