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 {
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 SWITCH_DECLARE(
void) bindAction(
char *action, const
char *arg, const
char *bind);
103 SWITCH_DECLARE(
void) execute(CoreSession * session, const
char *name);
114 SWITCH_DECLARE(
const char *) execute(const
char *command, const
char *data = NULL);
168 SWITCH_DECLARE(
int) chat_execute(const
char *app, const
char *data = NULL);
170 SWITCH_DECLARE(const
char *) serialize(const
char *format = NULL);
176 SWITCH_DECLARE(
bool) addHeader(const
char *header_name, const
char *value);
197 SWITCH_DECLARE(
int) bind(const
char *event_name, const
char *subclass_name = "");
236 SWITCH_DECLARE(
int) insertFile(const
char *file, const
char *insert_file,
int sample_point);
239 SWITCH_DECLARE(
void) hangup(const
char *cause = "normal_clearing");
246 SWITCH_DECLARE(
void) say(const
char *tosay, const
char *module_name, const
char *say_type, const
char *say_method,
247 const
char *say_gender = NULL);
248 SWITCH_DECLARE(
void) sayPhrase(const
char *phrase_name, const
char *phrase_data = "", const
char *phrase_lang = NULL);
259 SWITCH_DECLARE(
int) recordFile(
char *file_name,
int time_limit = 0,
int silence_threshold = 0,
int silence_hits = 0);
289 SWITCH_DECLARE(
void) setDTMFCallback(
void *cbfunc,
char *funcargs);
292 SWITCH_DECLARE(
void) set_tts_parms(
char *tts_name,
char *voice_name);
293 SWITCH_DECLARE(
void) set_tts_params(
char *tts_name,
char *voice_name);
300 SWITCH_DECLARE(
int) collectDigits(
int digit_timeout,
int abs_timeout);
309 SWITCH_DECLARE(
char *) getDigits(
int maxdigits,
char *terminators,
int timeout);
310 SWITCH_DECLARE(
char *) getDigits(
int maxdigits,
char *terminators,
int timeout,
int interdigit);
311 SWITCH_DECLARE(
int) transfer(
char *extension,
char *dialplan = NULL,
char *context = NULL);
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 SWITCH_DECLARE(
int) streamFile(
char *file,
int starting_sample_count = 0);
365 SWITCH_DECLARE(
void) execute(const
char *app, const
char *data = NULL);
372 virtual
bool begin_allow_threads() = 0;
373 virtual
bool end_allow_threads() = 0;
378 const
char *get_uuid()
const {
379 return uuid ? uuid : (
char *)
"uninitialized";
391 virtual void check_hangup_hook() = 0;
struct apr_queue_t switch_queue_t
switch_channel_t * channel
switch_event_types_t e_event_id
DTMF(char idigit, uint32_t iduration=SWITCH_DEFAULT_DTMF_DURATION)
void console_clean_log(char *msg)
void raw_write(const char *data, int len)
void console_log2(char *level_str, char *file, char *func, int line, char *msg)
switch_event_types_t
Built-in Events.
switch_priority_t
Priority Indication.
Representation of an event.
switch_status_t dtmf_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
switch_stream_handle_t mystream
switch_core_session_t * session
struct input_callback_state input_callback_state_t
#define SWITCH_DEFAULT_DTMF_DURATION
A node to store binded events.
switch_stream_handle_t * stream_p
int main(int argc, char *argv[])
char * getGlobalVariable(char *var_name)
switch_memory_pool_t * pool
void console_log(char *level_str, char *msg)
switch_byte_t switch_byte_t * buf
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 consoleCleanLog(char *msg)
void consoleLog(char *level_str, 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
void setGlobalVariable(char *var_name, char *var_val)
void bridge(CoreSession &session_a, CoreSession &session_b)
bridge the audio of session_b into session_a
switch_byte_t switch_byte_t uint32_t buflen
switch_call_cause_t cause
switch_channel_state_t hook_state
bool email(char *to, char *from, char *headers=NULL, char *body=NULL, char *file=NULL, char *convert_cmd=NULL, char *convert_ext=NULL)
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
void consoleLog2(char *level_str, char *file, char *func, int line, char *msg)
switch_status_t
Common return values.
const switch_input_args_t & get_cb_args() const
Get the callback function arguments associated with this session.
struct apr_pool_t switch_memory_pool_t
const char * get_data(void)
void switch_msleep(unsigned ms)
input_callback_state cb_state
void write(const char *data)
const char * read(int *len)