38 #include <speex/speex_preprocess.h> 39 #include <speex/speex_echo.h> 129 return (
const char *) dmachine->
name;
135 uint32_t digit_timeout_ms,
136 uint32_t input_timeout_ms,
160 if (match_callback) {
164 if (nonmatch_callback) {
170 *dmachine_p = dmachine;
190 if (!(dmachine && *dmachine))
return;
192 pool = (*dmachine)->pool;
196 if ((*dmachine)->my_pool) {
203 if (!dmachine->
realm) {
222 dmachine->
realm = headp;
244 if (headp == dmachine->
realm) {
246 "Digit parser %s: '%s' was the active realm, no realm currently selected.\n", dmachine->
name, realm);
247 dmachine->
realm = NULL;
266 const char *msg =
"";
285 if ((ptr->is_regex && !strcmp(ptr->digits, digits+1)) || !strcmp(ptr->digits, digits)) {
286 msg =
"Reuse Existing ";
299 if (*digits_ ==
'=') {
304 if (*digits_ ==
'~') {
307 if ((repl = strchr(digits_,
'~')) && *(repl+1) ==
'~') {
314 binding->
digits = digits_;
326 headp->
tail = binding;
328 len = strlen(digits);
330 if (dmachine->
realm != headp) {
344 msg, dmachine->
name, digits, realm, key, (
void *)(intptr_t) callback, user_data);
347 msg, dmachine->
name, digits, realm, key, (
void *)(intptr_t) callback, user_data);
366 int pmatches = 0, ematches = 0, rmatches = 0;
373 int ovector[30] = { 0 };
384 len = (strlen(dmachine->
digits) + strlen(bp->
digits) + 10) * proceed;
385 substituted = malloc(len);
387 memset(substituted, 0, len);
425 if ((q=strrchr(dmachine->
digits, *p))) {
453 if (!(both_bp && partial_bp) && strlen(bp->
digits) != strlen(dmachine->
digits) && pmatch) {
464 if (both_bp && exact_bp && partial_bp)
break;
489 if (r_bp->substituted) {
521 return &dmachine->
match;
567 *match_p = &dmachine->
match;
607 }
else if (is_timeout) {
663 for (p = digits; p && *p; p++) {
818 if (dh && !dh->
mux) {
835 int16_t *fp = rframe->
data;
840 for (x = 0; x < (uint32_t) len * dh->
fh.
channels; x++) {
841 int32_t mixed = fp[x] + buf[x];
843 fp[x] = (int16_t) mixed;
847 if (len < rframe->samples) {
918 }
else if (!dh->
mux) {
936 int16_t *fp = rframe->
data;
941 for (x = 0; x < (uint32_t) len * dh->
fh.
channels; x++) {
942 int32_t mixed = fp[x] + buf[x];
944 fp[x] = (int16_t) mixed;
949 rframe->
samples = (uint32_t) len;
1063 if ((ext = strrchr(file,
'.'))) {
1079 if (hangup_on_error) {
1090 if (flags && strchr(flags,
'm')) {
1094 if (flags && strchr(flags,
'l')) {
1098 if (flags && strchr(flags,
'f')) {
1102 if (flags && strchr(flags,
'r')) {
1103 if (strchr(flags,
'w')) {
1182 int16_t *fdata = (int16_t *) frame->
data;
1183 uint32_t samples = frame->
datalen /
sizeof(*fdata);
1185 uint32_t channel_num = 0;
1193 for (channel_num = 0; channel_num < codec_impl->
number_of_channels && is_silence; channel_num++) {
1194 uint32_t
count = 0, j = channel_num;
1196 for (count = 0; count < samples; count++) {
1197 energy += abs(fdata[j]);
1200 is_silence &= (uint32_t) ((energy / (samples / divisor)) < silence_threshold);
1212 char *vvar = NULL, *vval = NULL;
1214 vvar = (
char *) hi->
name;
1215 vval = (
char *) hi->
value;
1272 unsigned char *data;
1359 const char *var = NULL;
1360 const char *post_process_exec = NULL;
1368 char *data, *expanded = NULL;
1373 if ((data = strchr(cmd,
':'))) {
1380 if (expanded && expanded != data) {
1603 }
else if (rh->
fh) {
1607 const char *file_trimmed_ms = NULL;
1608 const char *file_size = NULL;
1609 const char *file_trimmed = NULL;
1925 if (!strcasecmp(file,
"all")) {
1953 const char *var = NULL;
2138 if (ep->
errs > 10) {
2223 msg.
from = __FILE__;
2280 if (gcd)
return (x * y) / gcd;
2291 int codec_initialized = 0;
2292 const char *
name, *num;
2302 const char *macro_name =
"eavesdrop_announce";
2303 const char *id_name = NULL;
2306 char cid_buf[1024] =
"";
2308 uint32_t sanity = 600;
2313 int lcm, buff_min_len, buffered = 1;
2319 if (tsession == session) {
2326 if (!--sanity)
break;
2356 if (!
zstr(require_group)) {
2359 char *argv[10] = { 0 };
2368 data = strdup(group_name);
2370 for (i = 0; i < argc; i++) {
2372 if (argv[i] && !strcmp(argv[i], require_group)) {
2424 codec_initialized = 1;
2427 write_frame.
codec = &codec;
2442 if (!(flags & ED_TAP_READ) && !(flags &
ED_TAP_WRITE)) {
2464 if (flags & ED_TAP_READ) {
2469 if (flags & ED_TAP_WRITE) {
2480 if (
switch_true(vval) || !strcasecmp(vval,
"aleg") || !strcasecmp(vval,
"bleg") || !strcasecmp(vval,
"both")) {
2483 if (
switch_true(vval) || !strcasecmp(vval,
"bleg") || !strcasecmp(vval,
"both")) {
2515 msg.
from = __FILE__;
2525 if ((flags & ED_TAP_READ) || (flags & ED_TAP_WRITE)) {
2527 flags &= ~ED_BRIDGE_READ;
2528 flags &= ~ED_BRIDGE_WRITE;
2562 uint32_t len =
sizeof(
buf);
2564 char *fcommand = NULL;
2566 int vid_bug = 0, vid_dual = 0;
2600 for (d = fcommand; *d; d++) {
2686 if (channels == 0) {
2697 buff_min_len = lcm * 2;
2708 int tchanged = 0, changed = 0;
2727 if (changed || tchanged) {
2731 "SPYING CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n",
2747 "SPYED CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n",
2787 if (buffered == 1) {
2830 if (codec_initialized)
2893 if ((*rh)->recording_session != session) {
2897 if ((*rh)->native) {
2900 }
else if((*rh)->fh) {
2906 pool = (*rh)->helper_pool;
2915 const char *val = NULL;
2941 char *file_path = NULL;
2943 char *in_file = NULL, *out_file = NULL;
3023 if (channels == 1) {
3067 int tmp = atoi(vval);
3118 fileperms = strtol(vval, 0, 16);
3134 if ((ext = strrchr(file,
'.'))) {
3143 if (hangup_on_error) {
3196 if (hangup_on_error) {
3207 if (hangup_on_error) {
3338 msg.
from = __FILE__;
3394 speex_preprocess_state_destroy(cb->
read_st);
3398 speex_preprocess_state_destroy(cb->
write_st);
3402 speex_echo_state_destroy(cb->
read_ec);
3406 speex_echo_state_destroy(cb->
write_ec);
3472 char *mydata = NULL, *argv[5];
3485 if (!strcasecmp(cmds,
"stop")) {
3491 mydata = strdup(cmds);
3494 for (i = 0; i < argc; i++) {
3495 char *var = argv[i];
3500 SpeexPreprocessState *st = NULL;
3501 SpeexEchoState *ec = NULL;
3506 if ((val = strchr(var,
'='))) {
3510 while (*var ==
'.' || *var ==
'_') {
3522 }
else if (rw ==
'w') {
3538 if (!strcasecmp(var,
"agc")) {
3540 int tmp = atoi(val);
3547 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &tr);
3548 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &l);
3550 }
else if (!strcasecmp(var,
"noise_suppress")) {
3553 r = speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &db);
3559 }
else if (!strcasecmp(var,
"echo_cancel")) {
3561 int tmp = atoi(val);
3563 if (!tr && tmp > 0) {
3568 speex_echo_state_destroy(cb->
read_ec);
3571 speex_echo_state_destroy(cb->
write_ec);
3589 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_ECHO_STATE, ec);
3593 }
else if (!strcasecmp(var,
"echo_suppress")) {
3596 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, &db);
3632 speex_preprocess_state_destroy(cb->
read_st);
3636 speex_preprocess_state_destroy(cb->
write_st);
3640 speex_echo_state_destroy(cb->
read_ec);
3644 speex_echo_state_destroy(cb->
write_ec);
3669 int level = 0, mute = 0;
3734 int existing = 0, c_read = 0, c_write = 0, flags =
SMBF_NO_PAUSE;
3755 if (!strcasecmp(direction,
"write")) {
3758 }
else if (!strcasecmp(direction,
"read")) {
3761 }
else if (!strcasecmp(direction,
"both")) {
3763 c_read = c_write = 1;
3767 if (!strcasecmp(cmd,
"mute")) {
3776 }
else if (!strcasecmp(cmd,
"level")) {
3777 if (level < 5 && level > -5) {
3903 if (!audio_buffer) {
4036 buf[0] = dtmf->
digit;
4053 if (bytes < frame->datalen) {
4111 pvt->
read = !!read_stream;
4124 #define MAX_TONES 16 4215 for (i = 0; i < cont->
index; i++) {
4285 "Event queue failed!\n");
4315 for (i = 0; i < cont->
index; i++) {
4328 const char *
key,
const char *tone_spec,
4329 const char *flags, time_t timeout,
4336 int i = 0, ok = 0, detect_fax = 0;
4354 for (i = 0; i < cont->
index; i++) {
4366 if (
zstr(tone_spec)) {
4376 int tmp = atoi(var);
4382 if (!hits) hits = 1;
4387 p = (
char *) tone_spec;
4391 next = strchr(p,
',');
4398 if (!strncasecmp(p,
"1100", 4)) {
4399 detect_fax = cont->
index;
4444 int tmp = atoi(var);
4451 int tmp = atoi(var);
4461 if (strchr(flags,
'o')) {
4465 if (strchr(flags,
'r')) {
4467 }
else if (strchr(flags,
'w')) {
4479 switch_core_event_hook_add_send_dtmf(session,
tone_on_dtmf);
4480 switch_core_event_hook_add_recv_dtmf(session,
tone_on_dtmf);
4515 #define SWITCH_META_VAR_KEY "__dtmf_meta" 4516 #define SWITCH_BLOCK_DTMF_KEY "__dtmf_block" 4605 *digit = dtmf->
digit;
4614 if (ok && md->
sr[direction].
map[dval].
app) {
4615 uint32_t flags = md->
sr[direction].
map[dval].
flags;
4651 memset(&md->
sr[direction].
map[dval], 0,
sizeof(md->
sr[direction].
map[dval]));
4676 if (!md || key > 9) {
4724 switch_core_event_hook_add_send_dtmf(session,
block_on_dtmf);
4725 switch_core_event_hook_add_recv_dtmf(session,
block_on_dtmf);
4741 char t_meta = *meta_var;
4749 if (meta !=
'*' && meta !=
'#') {
4767 switch_core_event_hook_add_send_dtmf(session,
meta_on_dtmf);
4768 switch_core_event_hook_add_recv_dtmf(session,
meta_on_dtmf);
4803 #define PLAY_AND_DETECT_DONE 1 4804 #define PLAY_AND_DETECT_DONE_RECOGNIZING 2 4829 if (!
zstr(speech_type)) {
4832 if (!strcasecmp(speech_type,
"detected-speech")) {
4836 if (!
zstr(result)) {
4844 }
else if (!strcasecmp(speech_type,
"detected-partial-speech")) {
4846 }
else if (!strcasecmp(speech_type,
"begin-speaking")) {
4849 }
else if (!strcasecmp(
"closed", speech_type)) {
4862 if (!strcasecmp(terminators,
"any")) {
4863 terminators =
"1234567890*#";
4864 }
else if (!strcasecmp(terminators,
"none")) {
4868 if (terminators && strchr(terminators, dtmf->
digit)) {
4884 const char *mod_name,
4885 const char *grammar,
4887 uint32_t input_timeout,
4891 int recognizing = 0;
4898 if (result == NULL) {
4902 if (!input_timeout) input_timeout = 5000;
4925 myargs.
buf = &state;
4926 myargs.
buflen =
sizeof(state);
5011 char *xmlstr = NULL;
5045 if (!strncasecmp(p,
"pound", 5)) {
5048 }
else if (!strncasecmp(p,
"hash", 4)) {
5051 }
else if (!strncasecmp(p,
"star", 4)) {
5054 }
else if (!strncasecmp(p,
"asterisk", 8)) {
5174 switch_core_event_hook_remove_recv_dtmf(session,
speech_on_dtmf);
5237 switch_core_event_hook_remove_recv_dtmf(session,
speech_on_dtmf);
5291 if (sth && sth->
ah && name && val) {
5416 switch_snprintf(key,
sizeof(key),
"%s/%s/%s/%s", mod_name, NULL, NULL, dest);
5438 const char *variable_prefix =
"asr_json_param_";
5446 char *var = hp->
name;
5447 char *val = hp->
value;
5449 if (!strncasecmp(var, variable_prefix, strlen(variable_prefix)) && !
zstr(val)) {
5450 char *json_var = var + strlen(variable_prefix);
5462 const char *mod_name,
5541 size_t len =
sizeof(*helper);
5578 size_t len =
sizeof(*helper);
5582 len += strlen(extension) + 1;
5586 len += strlen(dialplan) + 1;
5590 len += strlen(context) + 1;
5598 cur +=
sizeof(*helper);
5609 cur += strlen(helper->
dialplan) + 1;
5638 size_t len =
sizeof(*helper) + strlen(path) + 1;
5644 cur +=
sizeof(*helper);
5660 const char *other_uuid = NULL;
5661 char *app =
"playback";
5665 int app_flags = 0, nomedia = 0;
5675 mypath = strdup(path);
5678 if ((p = strchr(mypath,
':')) && *(p + 1) ==
':') {
5690 if ((cause = strchr(app,
'!'))) {
5693 cause =
"normal_clearing";
5725 other_session = NULL;
5803 if (frame->
img && oht->
img) {
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
struct switch_ivr_dmachine_binding * next
uint32_t switch_bind_flag_t
switch_frame_t * switch_core_media_bug_get_video_ping_frame(switch_media_bug_t *bug)
switch_time_t switch_micro_time_now(void)
Get the current epoch time in microseconds.
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it's state machine to end.
#define switch_regex_safe_free(re)
switch_status_t switch_ivr_dmachine_set_terminators(switch_ivr_dmachine_t *dmachine, const char *terminators)
switch_status_t switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix)
switch_event_types_t event_id
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
void switch_channel_set_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
switch_status_t switch_core_asr_start_input_timers(switch_asr_handle_t *ah)
Start input timers on an asr handle.
uint8_t thread_needs_transfer
switch_input_args_t * original_args
char * switch_core_session_sprintf(_In_ switch_core_session_t *session, _In_z_ _Printf_format_string_ const char *fmt,...)
printf-style style printing routine. The data is output to a string allocated from the session ...
switch_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool)
switch_mutex_t * read_mutex
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_ivr_dmachine_callback_t nonmatch_callback
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
switch_size_t switch_buffer_zwrite(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen)
SpeexEchoState * write_ec
switch_status_t switch_mutex_destroy(switch_mutex_t *lock)
switch_core_session_message_types_t message_id
#define SWITCH_CHANNEL_LOG
void switch_core_session_reset(_In_ switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec)
Reset the buffers and resampler on a session.
switch_size_t switch_buffer_read(_In_ switch_buffer_t *buffer, _In_ void *data, _In_ switch_size_t datalen)
Read data from a switch_buffer_t up to the ammount of datalen if it is available. Remove read data fr...
switch_status_t switch_core_asr_disable_all_grammars(switch_asr_handle_t *ah)
Disable all grammars from an asr handle.
char last_failed_digits[DMACHINE_MAX_DIGIT_LEN]
switch_time_t last_read_time
switch_status_t switch_channel_set_variable_name_printf(switch_channel_t *channel, const char *val, const char *fmt,...)
switch_status_t switch_mutex_trylock(switch_mutex_t *lock)
switch_status_t switch_core_hash_destroy(_Inout_ switch_hash_t **hash)
Destroy an existing hash table.
const char *const const double number
switch_status_t switch_channel_queue_dtmf(_In_ switch_channel_t *channel, _In_ const switch_dtmf_t *dtmf)
Queue DTMF on a given channel.
char * switch_find_end_paren(const char *s, char open, char close)
void * switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key)
Retrieve data from a given hash.
switch_status_t switch_core_asr_get_result_headers(switch_asr_handle_t *ah, switch_event_t **headers, switch_asr_flag_t *flags)
Get result headers from an asr handle.
switch_status_t switch_channel_execute_on_value(switch_channel_t *channel, const char *variable_value)
switch_status_t switch_ivr_eavesdrop_exec_all(switch_core_session_t *session, const char *app, const char *arg)
switch_core_session_t * session
void switch_img_free(switch_image_t **img)
Close an image descriptor.
switch_media_flag_t flags
A container for a single multi-tone detection TELETONE_MAX_TONES dictates the maximum simultaneous to...
void * switch_core_media_bug_get_user_data(_In_ switch_media_bug_t *bug)
Obtain private data from a media bug.
const char * switch_channel_get_partner_uuid(switch_channel_t *channel)
uint32_t switch_ivr_schedule_hangup(time_t runtime, const char *uuid, switch_call_cause_t cause, switch_bool_t bleg)
Hangup an existing session in the future.
switch_hash_t * binding_hash
#define switch_core_hash_init(_hash)
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
static switch_bool_t session_audio_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_status_t switch_core_session_set_video_read_callback(switch_core_session_t *session, switch_core_video_thread_callback_func_t func, void *user_data)
void switch_perform_substitution(switch_regex_t *re, int match_count, const char *data, const char *field_data, char *substituted, switch_size_t len, int *ovector)
static switch_status_t play_and_detect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *data, unsigned int len)
An abstraction to store a tone mapping.
switch_status_t switch_buffer_create_dynamic(_Out_ switch_buffer_t **buffer, _In_ switch_size_t blocksize, _In_ switch_size_t start_len, _In_ switch_size_t max_len)
Allocate a new dynamic switch_buffer.
static void set_completion_cause(struct record_helper *rh, const char *completion_cause)
SpeexPreprocessState * write_st
switch_status_t switch_ivr_stop_record_session(switch_core_session_t *session, const char *file)
Stop Recording a session.
switch_status_t switch_ivr_sleep(switch_core_session_t *session, uint32_t ms, switch_bool_t sync, switch_input_args_t *args)
Wait for time to pass for a specified number of milliseconds.
switch_frame_t * switch_core_media_bug_get_native_read_frame(switch_media_bug_t *bug)
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]
switch_mutex_t * cond_mutex
static switch_bool_t switch_ivr_dmachine_check_timeout(switch_ivr_dmachine_t *dmachine)
void switch_core_media_bug_set_write_replace_frame(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame)
Set a return replace frame.
switch_buffer_t * wbuffer
SWITCH_STANDARD_SCHED_FUNC(sch_hangup_callback)
static void deliver_asr_event(switch_core_session_t *session, switch_event_t *event, switch_input_args_t *args)
struct oht_s overly_helper_t
teletone_audio_t * buffer
#define switch_channel_up(_channel)
#define SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE
switch_memory_pool_t * helper_pool
#define SWITCH_RECOMMENDED_BUFFER_SIZE
switch_time_t silence_time
void switch_channel_event_set_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event)
Add information about a given channel to an event object.
switch_ivr_dmachine_t * dmachine
switch_status_t switch_ivr_stop_session_audio(switch_core_session_t *session)
switch_status_t switch_core_asr_open(switch_asr_handle_t *ah, const char *module_name, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool)
Open an asr handle.
static switch_status_t block_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
switch_status_t switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec)
Assign the read codec to a given session.
#define SWITCH_URL_SEPARATOR
void switch_core_media_bug_set_media_params(switch_media_bug_t *bug, switch_mm_t *mm)
switch_core_session_t * session
switch_status_t switch_core_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
Get results from an asr handle.
static void *SWITCH_THREAD_FUNC bcast_thread(switch_thread_t *thread, void *obj)
#define SWITCH_BLOCK_DTMF_KEY
switch_status_t switch_api_execute(const char *cmd, const char *arg, switch_core_session_t *session, switch_stream_handle_t *stream)
Execute a registered API command.
switch_status_t switch_ivr_broadcast(const char *uuid, const char *path, switch_media_flag_t flags)
Signal the session to broadcast audio.
teletone_generation_session_t ts
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
void switch_core_session_raw_read(switch_core_session_t *session)
static switch_status_t record_helper_destroy(struct record_helper **rh, switch_core_session_t *session)
switch_ivr_dmachine_binding_t * last_matching_binding
switch_status_t switch_core_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags)
Feed DTMF to an asr handle.
switch_buffer_t * r_buffer
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
uint32_t decoded_bytes_per_packet
switch_memory_pool_t * pool
void switch_ivr_dmachine_set_target(switch_ivr_dmachine_t *dmachine, switch_digit_action_target_t target)
switch_status_t switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt,...) PRINTF_FUNCTION(4
Add a header to an event.
Representation of an event.
dm_binding_head_t * realm
static switch_status_t speech_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
A container for a DTMF detection state.
switch_status_t switch_core_media_bug_set_pre_buffer_framecount(switch_media_bug_t *bug, uint32_t framecount)
#define switch_channel_ready(_channel)
switch_status_t switch_event_add_body(switch_event_t *event, const char *fmt,...) PRINTF_FUNCTION(2
Add a body to an event.
switch_thread_cond_t * cond
double teletone_process_t
#define arg_recursion_check_stop(_args)
static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
void switch_media_bug_set_spy_fmt(switch_media_bug_t *bug, switch_vid_spy_fmt_t spy_fmt)
switch_status_t switch_core_session_read_lock(_In_ switch_core_session_t *session)
Acquire a read lock on the session.
switch_status_t switch_queue_trypop(switch_queue_t *queue, void **data)
#define SWITCH_PLAYBACK_TERMINATOR_USED
switch_digit_action_target_t
void switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t channels, uint32_t divisor)
Generate static noise.
int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
Execute a single tone generation instruction.
switch_core_session_t * switch_core_media_bug_get_session(_In_ switch_media_bug_t *bug)
Obtain the session from a media bug.
static uint32_t switch_gcd(uint32_t x, uint32_t y)
static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_threshold, switch_codec_implementation_t *codec_impl)
static void asr_set_json_text_params(switch_core_session_t *session, switch_asr_handle_t *ah)
switch_status_t switch_core_session_get_real_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
int teletone_destroy_session(teletone_generation_session_t *ts)
Free the buffer allocated by a tone generation session.
static switch_bool_t read_displace_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_status_t switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
Feed audio data to an asr handle.
switch_core_session_t * caller
#define PLAY_AND_DETECT_DONE_RECOGNIZING
uint32_t switch_core_media_bug_set_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag)
switch_status_t switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args)
play a file from the disk to the session
static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_status_t switch_core_codec_destroy(switch_codec_t *codec)
Destroy an initalized codec handle.
switch_status_t switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
const char * string_array_arg[MESSAGE_STRING_ARG_MAX]
switch_time_t last_write_time
#define switch_core_session_get_name(_s)
static void tone_detect_set_total_time(switch_tone_container_t *cont, int index)
static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *obj)
#define PLAY_AND_DETECT_DONE
void switch_core_media_bug_set_read_replace_frame(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame)
Set a return replace frame.
uint32_t digit_timeout_ms
struct real_pcre switch_regex_t
#define SWITCH_IMG_FMT_ARGB
switch_ivr_dmachine_binding_t * binding_list
switch_status_t switch_event_dup(switch_event_t **event, switch_event_t *todup)
Duplicate an event.
switch_status_t switch_ivr_parse_all_events(switch_core_session_t *session)
Parse all commands from an event.
switch_status_t switch_ivr_media(const char *uuid, switch_media_flag_t flags)
Signal a session to request direct media access to it's remote end.
switch_status_t switch_core_session_execute_application_async(switch_core_session_t *session, const char *app, const char *arg)
static switch_thread_t * thread
switch_status_t switch_ivr_eavesdrop_pop_eavesdropper(switch_core_session_t *session, switch_core_session_t **sessionp)
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
switch_mutex_t * buffer_mutex
switch_size_t switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen)
Write data into a switch_buffer_t up to the length of datalen.
switch_status_t switch_core_media_bug_add(_In_ switch_core_session_t *session, _In_ const char *function, _In_ const char *target, _In_ switch_media_bug_callback_t callback, _In_opt_ void *user_data, _In_ time_t stop_time, _In_ switch_media_bug_flag_t flags, _Out_ switch_media_bug_t **new_bug)
Add a media bug to the session.
struct switch_runtime runtime
uint32_t switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Test for presence of given flag on a given channel.
switch_core_session_t * recording_session
switch_core_session_t * eavesdropper
uint32_t switch_scheduler_add_task(time_t task_runtime, switch_scheduler_func_t func, const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags)
Schedule a task in the future.
static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachine, switch_bool_t is_timeout)
static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_status_t switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
Read a frame from a session.
void switch_img_find_position(switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP)
uint32_t input_timeout_ms
switch_status_t switch_ivr_stop_inband_dtmf_session(switch_core_session_t *session)
Stop looking for DTMF inband.
switch_status_t switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name)
Load a grammar to an asr handle.
A message object designed to allow unlike technologies to exchange data.
switch_status_t switch_core_asr_pause(switch_asr_handle_t *ah)
Pause detection on an asr handle.
switch_codec_t * switch_core_session_get_read_codec(_In_ switch_core_session_t *session)
Retrieve the read codec from a given session.
switch_status_t switch_file_remove(const char *path, switch_memory_pool_t *pool)
switch_buffer_t * thread_buffer
uint32_t switch_core_max_dtmf_duration(uint32_t duration)
switch_status_t switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan, const char *context)
Transfer an existing session to another location.
const char * switch_core_media_bug_get_text(switch_media_bug_t *bug)
#define SWITCH_SPEECH_KEY
#define is_dtmf(key)
determine if a character is a valid DTMF key
switch_core_session_t * session
void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol)
Change the volume of a signed linear audio frame.
switch_status_t switch_core_session_write_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
Write a frame to a session.
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
Initilize a multi-frequency tone detector.
int teletone_run(teletone_generation_session_t *ts, const char *cmd)
Execute a tone generation script and call callbacks after each instruction.
switch_status_t switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
#define switch_core_session_execute_application(_a, _b, _c)
Execute an application on a session.
_Ret_ switch_channel_t * switch_core_session_get_channel(_In_ switch_core_session_t *session)
Retrieve a pointer to the channel object associated with a given session.
switch_byte_t is_priority
static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
void switch_channel_clear_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
void switch_ivr_broadcast_in_thread(switch_core_session_t *session, const char *app, int flags)
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
switch_codec_implementation_t read_impl
int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
Initilize a tone generation session.
char digits[DMACHINE_MAX_DIGIT_LEN]
#define SWITCH_MUTEX_NESTED
switch_frame_t * switch_core_media_bug_get_read_replace_frame(_In_ switch_media_bug_t *bug)
Obtain a replace frame from a media bug.
switch_status_t switch_core_media_bug_pop(switch_core_session_t *orig_session, const char *function, switch_media_bug_t **pop)
switch_status_t switch_core_session_get_app_flags(const char *app, int32_t *flags)
switch_core_session_t * session
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]
#define SWITCH_PATH_SEPARATOR
switch_status_t switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on)
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]
switch_digit_action_target_t target
const switch_codec_implementation_t * implementation
switch_status_t switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session, switch_media_bug_callback_t callback, void *(*user_data_dup_func)(switch_core_session_t *, void *))
switch_status_t switch_core_session_execute_application_get_flags(_In_ switch_core_session_t *session, _In_ const char *app, _In_opt_z_ const char *arg, _Out_opt_ int32_t *flags)
Execute an application on a session.
switch_byte_t switch_byte_t * buf
static void exec_cb(switch_media_bug_t *bug, void *user_data)
if((uint32_t)(unpack->cur - unpack->buf) > unpack->buflen)
switch_status_t switch_core_get_variables(switch_event_t **event)
switch_status_t switch_ivr_play_and_detect_speech(switch_core_session_t *session, const char *file, const char *mod_name, const char *grammar, char **result, uint32_t input_timeout, switch_input_args_t *args)
play a file to the session while doing speech recognition.
#define switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
#define switch_channel_audio_sync(_c)
unsigned int switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen)
Separate a string into an array based on a character delimiter.
switch_channel_t * channel
switch_status_t switch_core_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
Close an asr handle.
switch_core_session_t * session
switch_ivr_dmachine_binding_t * tail
switch_codec_implementation_t tread_impl
teletone_process_t freqs[TELETONE_MAX_TONES]
static switch_status_t record_helper_create(struct record_helper **rh, switch_core_session_t *session)
void switch_event_merge(switch_event_t *event, switch_event_t *tomerge)
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
const char * callee_id_number
void switch_buffer_lock(_In_ switch_buffer_t *buffer)
switch_codec_implementation_t read_impl
const char * completion_cause
char * switch_event_get_body(switch_event_t *event)
Retrieve the body value from an event.
switch_status_t switch_ivr_stop_detect_speech(switch_core_session_t *session)
Stop background Speech detection on a session.
#define switch_core_session_request_video_refresh(_s)
switch_thread_cond_t * cond
switch_frame_t * switch_core_media_bug_get_write_replace_frame(_In_ switch_media_bug_t *bug)
Obtain a replace frame from a media bug.
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
switch_status_t switch_ivr_record_session_event(switch_core_session_t *session, const char *file, uint32_t limit, switch_file_handle_t *fh, switch_event_t *vars)
static switch_bool_t speech_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
uint32_t actual_samples_per_second
switch_status_t switch_core_media_bug_push_spy_frame(switch_media_bug_t *bug, switch_frame_t *frame, switch_rw_t rw)
switch_status_t switch_ivr_pause_detect_speech(switch_core_session_t *session)
Pause background Speech detection on a session.
switch_ivr_dmachine_match_t match
switch_memory_pool_t * pool
#define switch_channel_get_variable(_c, _v)
switch_call_cause_t cause
#define SWITCH_THREAD_STACKSIZE
switch_status_t switch_channel_dequeue_dtmf(_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf)
Retrieve DTMF digits from a given channel.
switch_status_t switch_core_media_bug_remove_callback(switch_core_session_t *session, switch_media_bug_callback_t callback)
Remove media bug callback.
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
switch_file_handle_t in_fh
#define switch_zmalloc(ptr, len)
void switch_img_copy(switch_image_t *img, switch_image_t **new_img)
Copy image to a new image.
switch_ivr_dmachine_callback_t match_callback
const char * caller_id_name
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
teletone_hit_type_t teletone_dtmf_detect(teletone_dtmf_detect_state_t *dtmf_detect_state, int16_t sample_buffer[], int samples)
Check a sample buffer for the presence of DTMF digits.
switch_status_t switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit)
switch_status_t switch_ivr_preprocess_session(switch_core_session_t *session, const char *cmds)
switch_status_t switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event)
switch_status_t switch_ivr_inband_dtmf_session(switch_core_session_t *session)
Start looking for DTMF inband.
static void display_exec_cb(switch_media_bug_t *bug, void *user_data)
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]
switch_status_t switch_channel_transfer_variable_prefix(switch_channel_t *orig_channel, switch_channel_t *new_channel, const char *prefix)
switch_status_t switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
switch_image_t * switch_img_read_png(const char *file_name, switch_img_fmt_t img_fmt)
uint32_t switch_core_media_bug_clear_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag)
void switch_buffer_zero(_In_ switch_buffer_t *buffer)
Remove all data from the buffer.
static switch_status_t generate_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
static switch_bool_t preprocess_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
#define switch_channel_down_nosig(_channel)
switch_byte_t write_out[2048]
switch_img_position_t pos
switch_buffer_t * w_buffer
An abstraction of a data frame.
switch_status_t switch_core_asr_disable_grammar(switch_asr_handle_t *ah, const char *name)
Disable a grammar from an asr handle.
switch_status_t switch_ivr_session_audio(switch_core_session_t *session, const char *cmd, const char *direction, int level)
#define arg_recursion_check_start(_args)
switch_status_t switch_ivr_stop_tone_detect_session(switch_core_session_t *session)
Stop looking for TONES.
switch_status_t switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file)
Stop displacing a session.
switch_ivr_dmachine_callback_t callback
switch_status_t switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame, switch_bool_t fill)
Read a frame from the bug.
uint32_t switch_asr_flag_t
switch_status_t switch_core_media_bug_remove(_In_ switch_core_session_t *session, _Inout_ switch_media_bug_t **bug)
Remove a media bug from the session.
switch_status_t switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, const char *grammar, const char *name)
Load a grammar on a background speech detection handle.
switch_vid_spy_fmt_t switch_media_bug_parse_spy_fmt(const char *name)
#define switch_core_codec_init(_codec, _codec_name, _modname, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool)
Initialize a codec handle.
switch_status_t switch_ivr_eavesdrop_session(switch_core_session_t *session, const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags)
Eavesdrop on a another session.
#define switch_core_session_get_partner(_session, _partner)
uint32_t switch_eavesdrop_flag_t
switch_status_t switch_ivr_detect_speech_disable_grammar(switch_core_session_t *session, const char *name)
Disable a grammar on a background speech detection handle.
#define SWITCH_STANDARD_STREAM(s)
int microseconds_per_packet
char * switch_core_get_variable(_In_z_ const char *varname)
Retrieve a global variable from the core.
int switch_regex_perform(const char *field, const char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen)
char * switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size)
switch_status_t switch_ivr_detect_speech(switch_core_session_t *session, const char *mod_name, const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah)
Engage background Speech detection on a session.
switch_status_t switch_core_session_queue_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event)
Queue an event on a given session.
int32_t switch_fileperms_t
switch_byte_t read_data[2048]
switch_status_t switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name)
Unload a grammar on a background speech detection handle.
switch_status_t switch_ivr_stop_inband_dtmf_generate_session(switch_core_session_t *session)
Stop generating DTMF inband.
void * switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key)
Delete data from a hash based on desired key.
void switch_buffer_add_mutex(_In_ switch_buffer_t *buffer, _In_ switch_mutex_t *mutex)
static switch_status_t video_eavesdrop_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
switch_byte_t write_data[2048]
switch_status_t switch_ivr_resume_detect_speech(switch_core_session_t *session)
Resume background Speech detection on a session.
#define switch_core_session_receive_message(_session, _message)
void switch_core_session_rwunlock(_In_ switch_core_session_t *session)
Unlock a read or write lock on as given session.
switch_directories SWITCH_GLOBAL_dirs
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
void switch_core_session_video_reset(switch_core_session_t *session)
switch_media_bug_flag_enum_t
void switch_channel_set_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
#define switch_str_nil(s)
Make a null string a blank string instead.
static void record_helper_post_process(struct record_helper *rh, switch_core_session_t *session)
switch_queue_t * digit_queue
static char switch_itodtmf(char i)
struct fspr_thread_mutex_t switch_mutex_t
int teletone_dtmf_get(teletone_dtmf_detect_state_t *dtmf_detect_state, char *buf, unsigned int *dur)
retrieve any collected digits into a string buffer
static void merge_recording_variables(struct record_helper *rh, switch_event_t *event)
void switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t orig_channels, uint32_t channels)
static switch_bool_t video_write_overlay_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_status_t switch_thread_cond_signal(switch_thread_cond_t *cond)
static int switch_channel_var_true(switch_channel_t *channel, const char *variable)
static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_status_t switch_ivr_tone_detect_session(switch_core_session_t *session, const char *key, const char *tone_spec, const char *flags, time_t timeout, int hits, const char *app, const char *data, switch_tone_detect_callback_t callback)
Start looking for TONES.
#define SWITCH_DEFAULT_DIR_PERMS
switch_status_t switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
Write a video frame to a session.
uint32_t switch_core_default_dtmf_duration(uint32_t duration)
switch_digit_action_target_t switch_ivr_dmachine_get_target(switch_ivr_dmachine_t *dmachine)
teletone_dtmf_detect_state_t dtmf_detect
#define switch_channel_expand_variables(_channel, _in)
static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj)
uint32_t samples_per_packet
switch_status_t switch_core_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
Check an asr handle for results.
#define switch_event_safe_destroy(_event)
switch_bool_t speech_detected
uint8_t number_of_channels
uint32_t samples_per_second
static int recording_var_true(switch_channel_t *channel, switch_event_t *vars, const char *name)
switch_status_t
Common return values.
static const char * get_recording_var(switch_channel_t *channel, switch_event_t *vars, const char *name)
switch_status_t(* switch_ivr_dmachine_callback_t)(switch_ivr_dmachine_match_t *match)
const char *const const char *const path
void * switch_channel_get_private(switch_channel_t *channel, const char *key)
Retrieve private from a given channel.
switch_status_t switch_core_session_queue_private_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event, switch_bool_t priority)
Queue a private event on a given session.
switch_time_t last_digit_time
#define switch_goto_status(_status, _label)
const cJSON *const target
switch_bool_t(* switch_tone_detect_callback_t)(switch_core_session_t *, const char *, const char *)
uint8_t transfer_complete
switch_status_t switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event, switch_bool_t force)
DE-Queue an event on a given session.
switch_byte_t read_out[2048]
int teletone_multi_tone_detect(teletone_multi_tone_t *mt, int16_t sample_buffer[], int samples)
Check a sample buffer for the presence of the mulit-frequency tone described by mt.
switch_event_t * variables
switch_status_t switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
switch_buffer_t * audio_buffer
switch_status_t switch_ivr_detect_speech_disable_all_grammars(switch_core_session_t *session)
Disable all grammars on a background speech detection handle.
switch_size_t switch_channel_has_dtmf(_In_ switch_channel_t *channel)
Test for presence of DTMF on a given channel.
#define switch_core_hash_insert(_h, _k, _d)
void switch_buffer_unlock(_In_ switch_buffer_t *buffer)
#define switch_core_session_locate(uuid_str)
Locate a session based on it's uuid.
int switch_channel_state_change_pending(switch_channel_t *channel)
uint32_t switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples, int channels)
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
static switch_bool_t switch_is_file_path(const char *file)
static void send_record_stop_event(switch_channel_t *channel, switch_codec_implementation_t *read_impl, struct record_helper *rh)
switch_memory_pool_t * pool
switch_status_t switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val)
switch_status_t switch_ivr_eavesdrop_update_display(switch_core_session_t *session, const char *name, const char *number)
char last_matching_digits[DMACHINE_MAX_DIGIT_LEN]
switch_status_t switch_core_asr_resume(switch_asr_handle_t *ah)
Resume detection on an asr handle.
struct fspr_thread_cond_t switch_thread_cond_t
switch_core_session_t * session
#define switch_event_get_header(_e, _h)
switch_status_t switch_ivr_displace_session(switch_core_session_t *session, const char *file, uint32_t limit, const char *flags)
displace the media for a session with the audio from a file
#define switch_channel_set_flag(_c, _f)
SpeexPreprocessState * read_st
An abstraction to store a tone generation session.
#define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE
#define switch_set_string(_dst, _src)
switch_status_t switch_queue_trypush(switch_queue_t *queue, void *data)
void switch_core_media_bug_set_read_demux_frame(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame)
#define switch_channel_media_ack(_channel)
static int teletone_dtmf_generate_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
time_t switch_epoch_time_now(time_t *t)
Get the current epoch time.
switch_status_t switch_ivr_detect_speech_enable_grammar(switch_core_session_t *session, const char *name)
Enable a grammar on a background speech detection handle.
const char * caller_id_number
switch_mutex_t * write_mutex
switch_size_t samples_out
switch_frame_t demux_frame
#define SWITCH_PLAYBACK_TERMINATORS_VARIABLE
#define switch_core_session_alloc(_session, _memory)
Allocate memory from a session's pool.
static void * switch_ivr_record_user_data_dup(switch_core_session_t *session, void *user_data)
switch_bool_t hangup_on_error
static int switch_dtmftoi(char *s)
uint32_t switch_ivr_schedule_broadcast(time_t runtime, const char *uuid, const char *path, switch_media_flag_t flags)
Signal the session to broadcast audio in the future.
uint32_t switch_media_flag_t
switch_status_t switch_core_asr_enable_grammar(switch_asr_handle_t *ah, const char *name)
Enable a grammar from an asr handle.
#define SWITCH_META_VAR_KEY
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
switch_dtmf_source_t source
void switch_channel_clear_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
const char * switch_stristr(const char *instr, const char *str)
void switch_core_gen_encoded_silence(unsigned char *data, const switch_codec_implementation_t *read_impl, switch_size_t len)
switch_status_t switch_ivr_detect_speech_init(switch_core_session_t *session, const char *mod_name, const char *dest, switch_asr_handle_t *ah)
Initialize background Speech detection on a session, so that parameters can be set, and grammars loaded. After calling this function, it is possible to call switch_ivr_set_param_detect_speech() to set recognition parameters. Calling switch_ivr_detect_speech_load_grammar() starts the speech recognition.
switch_status_t switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
switch_status_t switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
switch_status_t switch_ivr_inband_dtmf_generate_session(switch_core_session_t *session, switch_bool_t read_stream)
Start generating DTMF inband.
A table of settings and callbacks that define a paticular implementation of a codec.
#define switch_is_valid_rate(_tmp)
switch_status_t switch_ivr_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session)
void switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent)
put a small img over a big IMG at position x,y, with alpha transparency
#define switch_normalize_to_16bit(n)
uint32_t switch_media_bug_flag_t
switch_frame_t * switch_core_media_bug_get_native_write_frame(switch_media_bug_t *bug)
struct fspr_pool_t switch_memory_pool_t
uint32_t switch_core_media_bug_test_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag)
Test for the existance of a flag on an media bug.
switch_file_handle_t out_fh
#define switch_channel_up_nosig(_channel)
switch_status_t switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
#define switch_core_session_strdup(_session, _todup)
Copy a string using memory allocation from a session's pool.
void switch_event_destroy(switch_event_t **event)
Destroy an event.
switch_status_t switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args)
NEEDDESC -
const char * match_digits
switch_file_handle_t * fh
switch_status_t switch_core_media_bug_exec_all(switch_core_session_t *orig_session, const char *function, switch_media_bug_exec_cb_t cb, void *user_data)
switch_core_session_t * transfer_from_session
static switch_bool_t write_displace_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
#define SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE
int switch_channel_test_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
char * switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt,...)
printf-style style printing routine. The data is output to a string allocated from the pool ...
struct fspr_thread_t switch_thread_t
switch_tone_detect_callback_t callback
switch_status_t switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name)
Unload a grammar from an asr handle.
#define switch_channel_set_variable(_channel, _var, _val)
switch_time_t switch_time_now(void)
switch_status_t switch_ivr_record_session(switch_core_session_t *session, const char *file, uint32_t limit, switch_file_handle_t *fh)
Record a session to disk.
static switch_bool_t text_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_size_t pre_buffer_datalen
#define switch_channel_pre_answer(channel)
Indicate progress on a channel to attempt early media.
switch_caller_profile_t * switch_channel_get_caller_profile(switch_channel_t *channel)
Retrieve the given channel's caller profile.
void switch_core_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val)
Set a text parameter on an asr handle.
switch_size_t switch_buffer_inuse(_In_ switch_buffer_t *buffer)
Get the in use amount of a switch_buffer_t.
static uint32_t switch_lcm(uint32_t x, uint32_t y)
switch_status_t switch_channel_api_on(switch_channel_t *channel, const char *variable_prefix)
void switch_buffer_destroy(switch_buffer_t **buffer)
Destroy the buffer.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
SWITCH_BEGIN_EXTERN_C char * switch_mprintf(const char *zFormat,...)
#define SWITCH_READ_ACCEPTABLE(status)
switch_tone_detect_t list[MAX_TONES+1]
static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
#define switch_channel_media_up(_channel)
#define SWITCH_CHANNEL_CHANNEL_LOG(x)
const char * callee_id_name
void teletone_dtmf_detect_init(teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
Initilize a DTMF detection state object.
switch_memory_pool_t * switch_core_session_get_pool(_In_ switch_core_session_t *session)
Retrieve the memory pool from a session.
#define SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE
#define DMACHINE_MAX_DIGIT_LEN
switch_status_t last_return
#define SWITCH_UUID_FORMATTED_LENGTH
switch_status_t switch_ivr_detect_speech_start_input_timers(switch_core_session_t *session)
Start input timers on a background speech detection handle.
uint32_t switch_ivr_schedule_transfer(time_t runtime, const char *uuid, char *extension, char *dialplan, char *context)
Transfer an existing session to another location in the future.
switch_status_t switch_regex_match(const char *target, const char *expression)
Function to evaluate an expression against a string.
#define SWITCH_DEFAULT_FILE_BUFFER_LEN
switch_event_header_t * headers
static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
switch_status_t switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority)