12 #define this_check(x) do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
13 #define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return;}} while(0)
14 #define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid),SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
15 #define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid),SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
16 #define init_vars() allocated = 0; \
22 xml_cdr_text = NULL; \
23 memset(&args, 0, sizeof(args)); \
27 memset(&cb_state, 0, sizeof(cb_state)); \
28 hook_state = CS_NEW; \
30 cause = SWITCH_CAUSE_NONE
34 #ifndef SWITCHTOMEMPOOL
35 #define SWITCHTOMEMPOOL
36 class SwitchToMempool {
73 void consoleLog2(
char *level_str,
char *file,
char *func,
int line,
char *msg);
77 bool email(
char *to,
char *from,
char *headers = NULL,
char *body = NULL,
78 char *file = NULL,
char *convert_cmd = NULL,
char *convert_ext = NULL);
90 const char *greeting_sound,
91 const char *short_greeting_sound,
92 const char *invalid_sound,
93 const char *exit_sound,
94 const char *transfer_sound,
95 const char *confirm_macro,
96 const char *confirm_key,
97 const char *tts_engine,
98 const char *tts_voice,
99 int confirm_attempts,
int inter_timeout,
int digit_len,
100 int timeout,
int max_failures,
int max_timeouts);
102 void bindAction(
char *action,
const char *arg,
const char *bind);
114 const char *
execute(
const char *command,
const char *data = NULL);
152 const char *
read(
int *len);
153 void write(
const char *data);
154 void raw_write(
const char *data,
int len);
165 Event(
const char *type,
const char *subclass_name = NULL);
168 int chat_execute(
const char *app,
const char *data = NULL);
169 int chat_send(
const char *dest_proto = NULL);
170 const char *
serialize(
const char *format = NULL);
172 const char *
getHeader(
const char *header_name);
175 bool addBody(
const char *value);
176 bool addHeader(
const char *header_name,
const char *value);
195 EventConsumer(
const char *event_name = NULL,
const char *subclass_name =
"",
int len = 5000);
197 int bind(
const char *event_name,
const char *subclass_name =
"");
198 Event *
pop(
int block = 0,
int timeout = 0);
236 int insertFile(
const char *file,
const char *insert_file,
int sample_point);
239 void hangup(
const char *cause =
"normal_clearing");
246 void say(
const char *tosay,
const char *module_name,
const char *say_type,
const char *say_method,
247 const char *say_gender = NULL);
248 void sayPhrase(
const char *phrase_name,
const char *phrase_data =
"",
const char *phrase_lang = NULL);
259 int recordFile(
char *file_name,
int time_limit = 0,
int silence_threshold = 0,
int silence_hits = 0);
291 int speak(
char *text);
309 char *
getDigits(
int maxdigits,
char *terminators,
int timeout);
310 char *
getDigits(
int maxdigits,
char *terminators,
int timeout,
int interdigit);
311 int transfer(
char *extension,
char *dialplan = NULL,
char *context = NULL);
314 char *
read(
int min_digits,
int max_digits,
315 const char *prompt_audio_file,
int timeout,
const char *valid_terminators,
int digit_timeout = 0);
328 int timeout,
char *terminators,
char *audio_files,
char *bad_input_audio_files,
329 char *digits_regex,
const char *var_name = NULL,
int digit_timeout = 0,
330 const char *transfer_on_failure = NULL);
340 int streamFile(
char *file,
int starting_sample_count = 0);
341 int sleep(
int ms,
int sync=0);
365 void execute(
const char *app,
const char *data = NULL);
379 return uuid ? uuid : (
char *)
"uninitialized";
396 void consoleLog2(
char *level_str,
char *file,
char *func,
int line,
char *msg);
403 void console_log2(
char *level_str,
char *file,
char *func,
int line,
char *msg);
struct apr_queue_t switch_queue_t
void consoleLog2(char *level_str, char *file, char *func, int line, char *msg)
switch_channel_t * channel
int flushEvents()
flush any pending events
switch_event_types_t e_event_id
void set_tts_parms(char *tts_name, char *voice_name)
switch_event_node_t * enodes[SWITCH_EVENT_ALL+1]
void execute(const char *app, const char *data=NULL)
void hangup(const char *cause="normal_clearing")
DTMF(char idigit, uint32_t iduration=SWITCH_DEFAULT_DTMF_DURATION)
void consoleLog2(char *level_str, char *file, char *func, int line, char *msg)
const char * execute(const char *command, const char *data=NULL)
void raw_write(const char *data, int len)
const char * hangupCause()
EventConsumer(const char *event_name=NULL, const char *subclass_name="", int len=5000)
switch_event_types_t
Built-in Events.
int insertFile(const char *file, const char *insert_file, int sample_point)
void switch_msleep(unsigned ms)
switch_priority_t
Priority Indication.
Representation of an event.
switch_status_t process_callback_result(char *result)
const char * getType(void)
int setAutoHangup(bool val)
virtual bool begin_allow_threads()=0
switch_stream_handle_t mystream
switch_core_session_t * session
void setPrivate(char *var, void *val)
const char * get_uuid() const
Get the uuid of this session.
#define SWITCH_DEFAULT_DTMF_DURATION
void waitForAnswer(CoreSession *calling_session)
A node to store binded events.
int sleep(int ms, int sync=0)
bool addBody(const char *value)
void bridge(CoreSession &session_a, CoreSession &session_b)
bridge the audio of session_b into session_a
void setVariable(char *var, char *val)
void setGlobalVariable(char *var_name, char *var_val)
int flushDigits()
flush any pending digits
char * getDigits(int maxdigits, char *terminators, int timeout)
switch_stream_handle_t * stream_p
void consoleCleanLog(char *msg)
int chat_execute(const char *app, const char *data=NULL)
bool email(char *to, char *from, char *headers=NULL, char *body=NULL, char *file=NULL, char *convert_cmd=NULL, char *convert_ext=NULL)
int main(int argc, char *argv[])
switch_memory_pool_t * pool
void sayPhrase(const char *phrase_name, const char *phrase_data="", const char *phrase_lang=NULL)
switch_byte_t switch_byte_t * buf
void setHangupHook(void *hangup_func)
Set the hangup callback function.
void consoleLog(char *level_str, char *msg)
void console_clean_log(char *msg)
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
switch_core_session_t * session
switch_file_handle_t * fhp
int streamFile(char *file, int starting_sample_count=0)
Play a file that resides on disk into the channel.
switch_status_t hanguphook(switch_core_session_t *session)
the actual hangup hook called back by freeswitch core which in turn gets the session and calls the ap...
void set_tts_params(char *tts_name, char *voice_name)
void sendEvent(Event *sendME)
const char * getVariable(char *var)
bool delHeader(const char *header_name)
Event * pop(int block=0, int timeout=0)
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype)=0
virtual void destroy(void)
switch_byte_t switch_byte_t uint32_t buflen
struct input_callback_state input_callback_state_t
switch_call_cause_t cause
switch_channel_state_t hook_state
const char * serialize(const char *format=NULL)
void console_log(char *level_str, char *msg)
int recordFile(char *file_name, int time_limit=0, int silence_threshold=0, int silence_hits=0)
Record to a file.
char * read(int min_digits, int max_digits, const char *prompt_audio_file, int timeout, const char *valid_terminators, int digit_timeout=0)
void console_log2(char *level_str, char *file, char *func, int line, char *msg)
Event(const char *type, const char *subclass_name=NULL)
char * getGlobalVariable(char *var_name)
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
bool setPriority(switch_priority_t priority=SWITCH_PRIORITY_NORMAL)
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
Common return values.
void setDTMFCallback(void *cbfunc, char *funcargs)
set a DTMF callback function
void * getPrivate(char *var)
int transfer(char *extension, char *dialplan=NULL, char *context=NULL)
const switch_input_args_t & get_cb_args() const
Get the callback function arguments associated with this session.
virtual void check_hangup_hook()=0
Callback to the language specific hangup callback.
const char * executeString(const char *command)
struct apr_pool_t switch_memory_pool_t
bool addHeader(const char *header_name, const char *value)
void consoleLog(char *level_str, char *msg)
void store_file_handle(switch_file_handle_t *fh)
const char * getHeader(const char *header_name)
char * playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *digits_regex, const char *var_name=NULL, int digit_timeout=0, const char *transfer_on_failure=NULL)
Play a file into channel and collect dtmfs.
const char * get_data(void)
int chat_send(const char *dest_proto=NULL)
void setEventData(Event *e)
int originate(CoreSession *a_leg_session, char *dest, int timeout=60, switch_state_handler_table_t *handlers=NULL)
Set attributes of caller data for purposes of outgoing calls.
virtual bool end_allow_threads()=0
input_callback_state cb_state
int collectDigits(int abs_timeout)
void say(const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender=NULL)
void write(const char *data)
const char * read(int *len)
int bind(const char *event_name, const char *subclass_name="")