mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-05 03:41:53 +00:00
snake charming
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8998 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -1,61 +1,45 @@
|
||||
#ifndef FREESWITCH_PYTHON_H
|
||||
#define FREESWITCH_PYTHON_H
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef DOH
|
||||
#include <Python.h>
|
||||
#include "mod_python_extra.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <switch_cpp.h>
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
S_SWAPPED_IN = (1 << 0),
|
||||
S_SWAPPED_OUT = (1 << 1)
|
||||
} swap_state_t;
|
||||
|
||||
void console_log(char *level_str, char *msg);
|
||||
void console_clean_log(char *msg);
|
||||
|
||||
class PySession : public CoreSession {
|
||||
namespace PYTHON {
|
||||
class Session : public CoreSession {
|
||||
private:
|
||||
void *threadState;
|
||||
int swapstate;
|
||||
virtual void do_hangup_hook();
|
||||
PyObject *getPython();
|
||||
PyObject *Py;
|
||||
PyObject *Self;
|
||||
int hh;
|
||||
int mark;
|
||||
PyThreadState *TS;
|
||||
public:
|
||||
PySession();
|
||||
PySession(char *uuid);
|
||||
PySession(switch_core_session_t *session);
|
||||
~PySession();
|
||||
void setDTMFCallback(PyObject *pyfunc, char *funcargs);
|
||||
void setHangupHook(PyObject *pyfunc);
|
||||
void check_hangup_hook();
|
||||
void hangup(char *cause);
|
||||
bool begin_allow_threads();
|
||||
bool end_allow_threads();
|
||||
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();
|
||||
|
||||
/**
|
||||
* Run DTMF callback
|
||||
*
|
||||
* A static method in CoreSession is the first thing called
|
||||
* upon receving a dtmf/event callback from fs engine, and then
|
||||
* it gets the PySession instance and calls this method with
|
||||
* dtmf/event object.
|
||||
*
|
||||
* @param input - a dtmf char buffer, or an event 'object' (not sure..)
|
||||
* @param itype - a SWITCH_INPUT_TYPE_DTMF or a SWITCH_INPUT_TYPE_EVENT
|
||||
*/
|
||||
switch_status_t run_dtmf_callback(void *input,
|
||||
switch_input_type_t itype);
|
||||
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;
|
||||
|
||||
void setPython(PyObject *state);
|
||||
void setSelf(PyObject *state);
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user