2007-03-29 22:31:56 +00:00
|
|
|
#ifndef FREESWITCH_PYTHON_H
|
2006-12-21 17:11:43 +00:00
|
|
|
#define FREESWITCH_PYTHON_H
|
|
|
|
|
|
|
|
extern "C" {
|
2008-07-11 19:42:52 +00:00
|
|
|
#include <Python.h>
|
|
|
|
#include "mod_python_extra.h"
|
2007-05-08 16:08:48 +00:00
|
|
|
}
|
2006-12-21 17:11:43 +00:00
|
|
|
|
2007-06-01 18:50:34 +00:00
|
|
|
#include <switch_cpp.h>
|
|
|
|
|
2008-07-11 19:42:52 +00:00
|
|
|
namespace PYTHON {
|
|
|
|
class Session : public CoreSession {
|
2007-05-08 16:08:48 +00:00
|
|
|
private:
|
2008-07-11 19:42:52 +00:00
|
|
|
virtual void do_hangup_hook();
|
|
|
|
PyObject *getPython();
|
|
|
|
PyObject *Py;
|
|
|
|
PyObject *Self;
|
|
|
|
int hh;
|
|
|
|
int mark;
|
|
|
|
PyThreadState *TS;
|
2007-05-08 16:08:48 +00:00
|
|
|
public:
|
2008-07-11 19:42:52 +00:00
|
|
|
Session();
|
|
|
|
Session(char *uuid);
|
|
|
|
Session(switch_core_session_t *session);
|
|
|
|
virtual ~Session();
|
|
|
|
|
|
|
|
virtual bool begin_allow_threads();
|
|
|
|
virtual bool end_allow_threads();
|
|
|
|
virtual void check_hangup_hook();
|
|
|
|
|
|
|
|
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
|
|
|
|
void setInputCallback(PyObject *cbfunc, PyObject *funcargs = NULL);
|
|
|
|
void setHangupHook(PyObject *pyfunc, PyObject *arg = NULL);
|
|
|
|
bool ready();
|
|
|
|
|
|
|
|
PyObject *cb_function;
|
|
|
|
PyObject *cb_arg;
|
|
|
|
PyObject *hangup_func;
|
|
|
|
PyObject *hangup_func_arg;
|
|
|
|
|
2008-07-11 21:56:18 +00:00
|
|
|
/* keep a pointer to parent module, internal use only*/
|
2008-07-11 19:42:52 +00:00
|
|
|
void setPython(PyObject *state);
|
2008-07-11 21:56:18 +00:00
|
|
|
|
|
|
|
/* keeps the PyObject * version of the Session so it can be used as args to the callback */
|
2008-07-11 19:42:52 +00:00
|
|
|
void setSelf(PyObject *state);
|
2008-07-11 21:56:18 +00:00
|
|
|
|
2007-05-08 16:08:48 +00:00
|
|
|
};
|
2006-12-21 17:11:43 +00:00
|
|
|
}
|
|
|
|
#endif
|