mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-06 04:11:52 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
Reference in New Issue
Block a user