mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
run indent on the whole tree and update copyright dates in prep for 1.0.5
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16579 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -7,41 +7,39 @@ extern "C" {
|
||||
#include <lualib.h>
|
||||
#include "mod_lua_extra.h"
|
||||
}
|
||||
|
||||
#include <switch_cpp.h>
|
||||
|
||||
namespace LUA {
|
||||
class Session : public CoreSession {
|
||||
private:
|
||||
virtual void do_hangup_hook();
|
||||
lua_State *getLUA();
|
||||
lua_State *L;
|
||||
int hh;
|
||||
int mark;
|
||||
public:
|
||||
Session();
|
||||
Session(char *uuid, CoreSession *a_leg = NULL);
|
||||
Session(switch_core_session_t *session);
|
||||
~Session();
|
||||
SWITCH_MOD_DECLARE(virtual void) destroy(void);
|
||||
|
||||
virtual bool begin_allow_threads();
|
||||
virtual bool end_allow_threads();
|
||||
virtual void check_hangup_hook();
|
||||
class Session:public CoreSession {
|
||||
private:
|
||||
virtual void do_hangup_hook();
|
||||
lua_State *getLUA();
|
||||
lua_State *L;
|
||||
int hh;
|
||||
int mark;
|
||||
public:
|
||||
Session();
|
||||
Session(char *uuid, CoreSession * a_leg = NULL);
|
||||
Session(switch_core_session_t *session);
|
||||
~Session();
|
||||
SWITCH_MOD_DECLARE(virtual void) destroy(void);
|
||||
|
||||
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
|
||||
void unsetInputCallback(void);
|
||||
void setInputCallback(char *cbfunc, char *funcargs = NULL);
|
||||
void setHangupHook(char *func, char *arg = NULL);
|
||||
bool ready();
|
||||
int originate(CoreSession *a_leg_session, char *dest, int timeout);
|
||||
|
||||
char *cb_function;
|
||||
char *cb_arg;
|
||||
char *hangup_func_str;
|
||||
char *hangup_func_arg;
|
||||
void setLUA(lua_State *state);
|
||||
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 unsetInputCallback(void);
|
||||
void setInputCallback(char *cbfunc, char *funcargs = NULL);
|
||||
void setHangupHook(char *func, char *arg = NULL);
|
||||
bool ready();
|
||||
int originate(CoreSession * a_leg_session, char *dest, int timeout);
|
||||
|
||||
char *cb_function;
|
||||
char *cb_arg;
|
||||
char *hangup_func_str;
|
||||
char *hangup_func_arg;
|
||||
void setLUA(lua_State * state);
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef MOD_LUA_EXTRA
|
||||
#define MOD_LUA_EXTRA
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
void mod_lua_conjure_event(lua_State *L, switch_event_t *event, const char *name, int destroy_me);
|
||||
void mod_lua_conjure_stream(lua_State *L, switch_stream_handle_t *stream, const char *name, int destroy_me);
|
||||
SWITCH_BEGIN_EXTERN_C void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me);
|
||||
void mod_lua_conjure_stream(lua_State * L, switch_stream_handle_t *stream, const char *name, int destroy_me);
|
||||
void mod_lua_conjure_session(lua_State * L, switch_core_session_t *session, const char *name, int destroy_me);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
@@ -1,169 +1,160 @@
|
||||
typedef struct input_callback_state {
|
||||
void *function;
|
||||
void *function;
|
||||
|
||||
void *threadState;
|
||||
void *threadState;
|
||||
|
||||
void *extra;
|
||||
char *funcargs;
|
||||
void *extra;
|
||||
char *funcargs;
|
||||
} input_callback_state_t;
|
||||
|
||||
typedef enum {
|
||||
S_HUP = (1 << 0),
|
||||
S_FREE = (1 << 1),
|
||||
S_RDLOCK = (1 << 2)
|
||||
S_HUP = (1 << 0),
|
||||
S_FREE = (1 << 1),
|
||||
S_RDLOCK = (1 << 2)
|
||||
} session_flag_t;
|
||||
|
||||
class Stream {
|
||||
protected:
|
||||
switch_stream_handle_t mystream;
|
||||
switch_stream_handle_t *stream_p;
|
||||
int mine;
|
||||
public:
|
||||
Stream(void);
|
||||
Stream(switch_stream_handle_t *);
|
||||
virtual ~Stream();
|
||||
void write(const char *data);
|
||||
const char *get_data(void);
|
||||
protected:
|
||||
switch_stream_handle_t mystream;
|
||||
switch_stream_handle_t *stream_p;
|
||||
int mine;
|
||||
public:
|
||||
Stream(void);
|
||||
Stream(switch_stream_handle_t *);
|
||||
virtual ~ Stream();
|
||||
void write(const char *data);
|
||||
const char *get_data(void);
|
||||
};
|
||||
|
||||
class Event {
|
||||
protected:
|
||||
public:
|
||||
switch_event_t *event;
|
||||
char *serialized_string;
|
||||
int mine;
|
||||
protected:
|
||||
public:
|
||||
switch_event_t *event;
|
||||
char *serialized_string;
|
||||
int mine;
|
||||
|
||||
Event(const char *type, const char *subclass_name = NULL);
|
||||
Event(switch_event_t *wrap_me, int free_me=0);
|
||||
virtual ~Event();
|
||||
const char *serialize(const char *format=NULL);
|
||||
bool setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
|
||||
char *getHeader(char *header_name);
|
||||
char *getBody(void);
|
||||
char *getType(void);
|
||||
bool addBody(const char *value);
|
||||
bool addHeader(const char *header_name, const char *value);
|
||||
bool delHeader(const char *header_name);
|
||||
bool fire(void);
|
||||
Event(const char *type, const char *subclass_name = NULL);
|
||||
Event(switch_event_t *wrap_me, int free_me = 0);
|
||||
virtual ~ Event();
|
||||
const char *serialize(const char *format = NULL);
|
||||
bool setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
|
||||
char *getHeader(char *header_name);
|
||||
char *getBody(void);
|
||||
char *getType(void);
|
||||
bool addBody(const char *value);
|
||||
bool addHeader(const char *header_name, const char *value);
|
||||
bool delHeader(const char *header_name);
|
||||
bool fire(void);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CoreSession {
|
||||
protected:
|
||||
switch_input_args_t args;
|
||||
protected:
|
||||
switch_input_args_t args;
|
||||
|
||||
switch_input_args_t *ap;
|
||||
switch_caller_profile_t caller_profile;
|
||||
switch_input_args_t *ap;
|
||||
switch_caller_profile_t caller_profile;
|
||||
|
||||
char *uuid;
|
||||
char *tts_name;
|
||||
char *voice_name;
|
||||
void store_file_handle(switch_file_handle_t *fh);
|
||||
void *on_hangup;
|
||||
switch_file_handle_t local_fh;
|
||||
switch_file_handle_t *fhp;
|
||||
switch_status_t process_callback_result(char *ret);
|
||||
public:
|
||||
CoreSession();
|
||||
CoreSession(char *uuid);
|
||||
CoreSession(switch_core_session_t *new_session);
|
||||
virtual ~CoreSession();
|
||||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
unsigned int flags;
|
||||
int allocated;
|
||||
input_callback_state cb_state;
|
||||
char *uuid;
|
||||
char *tts_name;
|
||||
char *voice_name;
|
||||
void store_file_handle(switch_file_handle_t *fh);
|
||||
void *on_hangup;
|
||||
switch_file_handle_t local_fh;
|
||||
switch_file_handle_t *fhp;
|
||||
switch_status_t process_callback_result(char *ret);
|
||||
public:
|
||||
CoreSession();
|
||||
CoreSession(char *uuid);
|
||||
CoreSession(switch_core_session_t *new_session);
|
||||
virtual ~ CoreSession();
|
||||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
unsigned int flags;
|
||||
int allocated;
|
||||
input_callback_state cb_state;
|
||||
|
||||
switch_channel_state_t hook_state;
|
||||
switch_channel_state_t hook_state;
|
||||
|
||||
int answer();
|
||||
int preAnswer();
|
||||
virtual void hangup(char *cause = "normal_clearing");
|
||||
void setVariable(char *var, char *val);
|
||||
void setPrivate(char *var, void *val);
|
||||
void *getPrivate(char *var);
|
||||
const char *getVariable(char *var);
|
||||
int recordFile(char *file_name, int max_len=0, int silence_threshold=0, int silence_secs=0);
|
||||
int answer();
|
||||
int preAnswer();
|
||||
virtual void hangup(char *cause = "normal_clearing");
|
||||
void setVariable(char *var, char *val);
|
||||
void setPrivate(char *var, void *val);
|
||||
void *getPrivate(char *var);
|
||||
const char *getVariable(char *var);
|
||||
int recordFile(char *file_name, int max_len = 0, int silence_threshold = 0, int silence_secs = 0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void setCallerData(char *var, char *val);
|
||||
int originate(CoreSession *a_leg_session,
|
||||
char *dest,
|
||||
int timeout=60);
|
||||
void setDTMFCallback(void *cbfunc, char *funcargs);
|
||||
void setCallerData(char *var, char *val);
|
||||
int originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
|
||||
void setDTMFCallback(void *cbfunc, char *funcargs);
|
||||
|
||||
int speak(char *text);
|
||||
void set_tts_parms(char *tts_name, char *voice_name);
|
||||
int speak(char *text);
|
||||
void set_tts_parms(char *tts_name, char *voice_name);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int collectDigits(int timeout);
|
||||
int getDigits(char *dtmf_buf,
|
||||
switch_size_t buflen,
|
||||
switch_size_t maxdigits,
|
||||
char *terminators,
|
||||
char *terminator,
|
||||
int timeout);
|
||||
int collectDigits(int timeout);
|
||||
int getDigits(char *dtmf_buf, switch_size_t buflen, switch_size_t maxdigits, char *terminators, char *terminator, int timeout);
|
||||
|
||||
int transfer(char *extensions, char *dialplan, char *context);
|
||||
int playAndGetDigits(int min_digits,
|
||||
int max_digits,
|
||||
int max_tries,
|
||||
int timeout,
|
||||
char *terminators,
|
||||
char *audio_files,
|
||||
char *bad_input_audio_files,
|
||||
char *dtmf_buf,
|
||||
char *digits_regex);
|
||||
int streamFile(char *file, int starting_sample_count=0);
|
||||
int transfer(char *extensions, char *dialplan, char *context);
|
||||
int playAndGetDigits(int min_digits,
|
||||
int max_digits,
|
||||
int max_tries,
|
||||
int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *dtmf_buf, char *digits_regex);
|
||||
int streamFile(char *file, int starting_sample_count = 0);
|
||||
|
||||
|
||||
|
||||
int flushEvents();
|
||||
int flushEvents();
|
||||
|
||||
|
||||
|
||||
int flushDigits();
|
||||
int flushDigits();
|
||||
|
||||
int setAutoHangup(bool val);
|
||||
int setAutoHangup(bool val);
|
||||
|
||||
|
||||
|
||||
|
||||
void setHangupHook(void *hangup_func);
|
||||
void setHangupHook(void *hangup_func);
|
||||
|
||||
bool ready();
|
||||
bool ready();
|
||||
|
||||
void execute(char *app, char *data);
|
||||
void execute(char *app, char *data);
|
||||
|
||||
void sendEvent(Event *sendME);
|
||||
void sendEvent(Event * sendME);
|
||||
|
||||
virtual bool begin_allow_threads() = 0;
|
||||
virtual bool end_allow_threads() = 0;
|
||||
virtual bool begin_allow_threads() = 0;
|
||||
virtual bool end_allow_threads() = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
char* get_uuid() const { return uuid; };
|
||||
char *get_uuid() const {
|
||||
return uuid;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const switch_input_args_t& get_cb_args() const { return args; };
|
||||
const switch_input_args_t &get_cb_args() const {
|
||||
return args;
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual void check_hangup_hook() = 0;
|
||||
virtual void check_hangup_hook() = 0;
|
||||
|
||||
virtual switch_status_t run_dtmf_callback(void *input,
|
||||
switch_input_type_t itype) = 0;
|
||||
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype) = 0;
|
||||
|
||||
};
|
||||
|
||||
@@ -180,7 +171,7 @@ void api_reply_delete(char *reply);
|
||||
|
||||
|
||||
|
||||
void bridge(CoreSession &session_a, CoreSession &session_b);
|
||||
void bridge(CoreSession & session_a, CoreSession & session_b);
|
||||
|
||||
|
||||
|
||||
@@ -189,8 +180,4 @@ void bridge(CoreSession &session_a, CoreSession &session_b);
|
||||
|
||||
switch_status_t hanguphook(switch_core_session_t *session);
|
||||
|
||||
switch_status_t dtmf_callback(switch_core_session_t *session,
|
||||
void *input,
|
||||
switch_input_type_t itype,
|
||||
void *buf,
|
||||
unsigned int buflen);
|
||||
switch_status_t dtmf_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
|
||||
|
||||
Reference in New Issue
Block a user