2007-03-29 22:31:56 +00:00
|
|
|
#ifndef FREESWITCH_PYTHON_H
|
2006-12-21 17:11:43 +00:00
|
|
|
#define FREESWITCH_PYTHON_H
|
|
|
|
|
|
|
|
#include <Python.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2007-05-08 16:08:48 +00:00
|
|
|
#ifdef DOH
|
|
|
|
}
|
|
|
|
#endif
|
2006-12-21 17:11:43 +00:00
|
|
|
|
2007-06-01 18:50:34 +00:00
|
|
|
#include <switch_cpp.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// declaration for function that is defined in mod_python.i
|
|
|
|
extern switch_status_t PythonDTMFCallback(switch_core_session *session,
|
|
|
|
void *input,
|
|
|
|
switch_input_type_t itype,
|
|
|
|
void *buf,
|
|
|
|
unsigned int buflen);
|
2006-12-21 17:11:43 +00:00
|
|
|
|
2007-05-08 16:08:48 +00:00
|
|
|
void console_log(char *level_str, char *msg);
|
|
|
|
void console_clean_log(char *msg);
|
|
|
|
char *api_execute(char *cmd, char *arg);
|
|
|
|
void api_reply_delete(char *reply);
|
|
|
|
|
2007-06-01 18:50:34 +00:00
|
|
|
struct input_callback_state {
|
|
|
|
PyObject *function;
|
|
|
|
PyThreadState *threadState;
|
|
|
|
void *extra;
|
|
|
|
char *funcargs;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PySession : public CoreSession {
|
2007-05-08 16:08:48 +00:00
|
|
|
private:
|
|
|
|
PyObject *dtmfCallbackFunction;
|
2007-06-01 18:50:34 +00:00
|
|
|
PyThreadState *threadState;
|
2007-05-08 16:08:48 +00:00
|
|
|
public:
|
2007-06-01 18:50:34 +00:00
|
|
|
PySession(char *uuid) : CoreSession(uuid) {};
|
|
|
|
PySession(switch_core_session_t *session) : CoreSession(session) {};
|
|
|
|
~PySession();
|
|
|
|
int streamfile(char *file, PyObject *pyfunc, char *funcargs, int starting_sample_count);
|
|
|
|
void begin_allow_threads();
|
|
|
|
void end_allow_threads();
|
|
|
|
|
2007-05-08 16:08:48 +00:00
|
|
|
protected:
|
|
|
|
};
|
2006-12-21 17:11:43 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|