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);
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);
198 SWITCH_DECLARE(
int) bind(
const char *event_name,
const char *subclass_name =
"");
237 SWITCH_DECLARE(
int) insertFile(
const char *file,
const char *insert_file,
int sample_point);
241 SWITCH_DECLARE(
void) hangup(
const char *cause =
"normal_clearing");
248 SWITCH_DECLARE(
void) say(
const char *tosay,
const char *module_name,
const char *say_type,
const char *say_method,
249 const char *say_gender = NULL);
250 SWITCH_DECLARE(
void) sayPhrase(
const char *phrase_name,
const char *phrase_data =
"",
const char *phrase_lang = NULL);
261 SWITCH_DECLARE(
int) recordFile(
char *file_name,
int time_limit = 0,
int silence_threshold = 0,
int silence_hits = 0);
291 SWITCH_DECLARE(
void) setDTMFCallback(
void *cbfunc,
char *funcargs);
294 SWITCH_DECLARE(
void) set_tts_parms(
char *tts_name,
char *voice_name);
295 SWITCH_DECLARE(
void) set_tts_params(
char *tts_name,
char *voice_name);
302 SWITCH_DECLARE(
int) collectDigits(
int digit_timeout,
int abs_timeout);
311 SWITCH_DECLARE(
char *) getDigits(
int maxdigits,
char *terminators,
int timeout);
312 SWITCH_DECLARE(
char *) getDigits(
int maxdigits,
char *terminators,
int timeout,
int interdigit);
313 SWITCH_DECLARE(
char *) getDigits(
int maxdigits,
char *terminators,
int timeout,
int interdigit,
int abstimeout);
314 SWITCH_DECLARE(
int) transfer(
char *extension,
char *dialplan = NULL,
char *context = NULL);
318 const char *prompt_audio_file,
int timeout,
const char *valid_terminators,
int digit_timeout = 0);
321 SWITCH_DECLARE(
void) detectSpeech(
char *arg0,
char *arg1 = NULL,
char *arg2 = NULL,
char *arg3 = NULL);
335 int timeout,
char *terminators,
char *audio_files,
char *bad_input_audio_files,
336 char *digits_regex,
const char *var_name = NULL,
int digit_timeout = 0,
337 const char *transfer_on_failure = NULL);
344 SWITCH_DECLARE(
char *) playAndDetectSpeech(
char *file,
char *engine,
char *grammar);
355 SWITCH_DECLARE(
int) streamFile(
char *file,
int starting_sample_count = 0);
380 SWITCH_DECLARE(
void) execute(
const char *app,
const char *data = NULL);
387 virtual bool begin_allow_threads() = 0;
388 virtual bool end_allow_threads() = 0;
394 return uuid ? uuid : (
char *)
"uninitialized";
406 virtual void check_hangup_hook() = 0;
switch_event_types_t e_event_id
void console_clean_log(char *msg)
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_channel_t * channel
const char *const const char *const const cJSON *const value
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
struct input_callback_state input_callback_state_t
#define SWITCH_DEFAULT_DTMF_DURATION
char const int const cJSON_bool format
A node to store binded events.
switch_stream_handle_t * stream_p
switch_core_session_t * session
const char * get_uuid() const
Get the uuid of this session.
int main(int argc, char *argv[])
char * getGlobalVariable(char *var_name)
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)
switch_file_handle_t * fhp
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
void setGlobalVariable(char *var_name, char *var_val)
static unsigned char * print(const cJSON *const item, cJSON_bool format, const internal_hooks *const hooks)
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.
switch_core_session_t * session
switch_memory_pool_t * pool
struct fspr_pool_t switch_memory_pool_t
void switch_msleep(unsigned ms)
input_callback_state cb_state