38 #include <speex/speex_preprocess.h>
39 #include <speex/speex_echo.h>
88 return dmachine->last_return;
94 return dmachine->target;
100 dmachine->target = target;
108 dmachine->match_callback = match_callback;
116 dmachine->nonmatch_callback = nonmatch_callback;
122 return (
const char *) dmachine->name;
128 uint32_t digit_timeout_ms,
129 uint32_t input_timeout_ms,
153 if (match_callback) {
157 if (nonmatch_callback) {
163 *dmachine_p = dmachine;
171 dmachine->digit_timeout_ms = digit_timeout_ms;
176 dmachine->input_timeout_ms = input_timeout_ms;
183 if (!(dmachine && *dmachine))
return;
185 pool = (*dmachine)->pool;
189 if ((*dmachine)->my_pool) {
196 if (!dmachine->realm) {
204 dmachine->name, dmachine->realm->name, terminators);
215 dmachine->realm = headp;
237 if (headp == dmachine->realm) {
239 "Digit parser %s: '%s' was the active realm, no realm currently selected.\n", dmachine->name, realm);
240 dmachine->realm = NULL;
258 const char *msg =
"";
275 if ((ptr->is_regex && !strcmp(ptr->digits, digits+1)) || !strcmp(ptr->digits, digits)) {
276 msg =
"Reuse Existing ";
287 if (*digits ==
'~') {
303 headp->
tail = binding;
305 len = strlen(digits);
307 if (dmachine->realm != headp) {
313 }
else if (len > dmachine->max_digit_len) {
314 dmachine->max_digit_len = (uint32_t) len;
321 msg, dmachine->name, digits, realm, key, (
void *)(intptr_t) callback, user_data);
324 msg, dmachine->name, digits, realm, key, (
void *)(intptr_t) callback, user_data);
343 int pmatches = 0, ematches = 0, rmatches = 0;
373 if ((q=strrchr(dmachine->
digits, *p))) {
395 if (!exact_bp && pmatch && (((pmatches == 1 || ematches == 1) && !rmatches) || is_timeout) && !strcmp(bp->
digits, dmachine->
digits)) {
401 if (!(both_bp && partial_bp) && strlen(bp->
digits) != strlen(dmachine->
digits) && pmatch) {
412 if (both_bp && exact_bp && partial_bp)
break;
425 r_bp = exact_bp ? exact_bp : both_bp;
462 if (dmachine->is_match) {
463 dmachine->is_match = 0;
464 return &dmachine->match;
473 return dmachine->last_failed_digits;
491 if (dmachine->pinging) {
495 dmachine->pinging = 1;
497 if (
zstr(dmachine->digits) && !is_timeout) {
499 }
else if (dmachine->cur_digit_len > dmachine->max_digit_len) {
504 dmachine->match.match_digits = dmachine->last_matching_digits;
505 dmachine->match.match_key = dmachine->last_matching_binding->key;
506 dmachine->match.user_data = dmachine->last_matching_binding->user_data;
509 *match_p = &dmachine->match;
512 dmachine->is_match = 1;
516 if (dmachine->last_matching_binding->callback) {
517 s = dmachine->last_matching_binding->callback(&dmachine->match);
531 if (dmachine->match_callback) {
532 dmachine->match.user_data = dmachine->user_data;
533 s = dmachine->match_callback(&dmachine->match);
549 }
else if (is_timeout) {
551 }
else if (is_match ==
DM_MATCH_NONE && dmachine->cur_digit_len == dmachine->max_digit_len) {
559 dmachine->match.match_digits = dmachine->last_failed_digits;
563 if (dmachine->nonmatch_callback) {
564 dmachine->match.user_data = dmachine->user_data;
565 s = dmachine->nonmatch_callback(&dmachine->match);
587 dmachine->last_return = r;
589 dmachine->pinging = 0;
605 for (p = digits; p && *p; p++) {
607 if (dmachine->cur_digit_len < dmachine->max_digit_len) {
609 char *e = dmachine->digits + strlen(dmachine->digits);
613 dmachine->cur_digit_len++;
631 return !!dmachine->cur_digit_len;
637 memset(dmachine->digits, 0,
sizeof(dmachine->digits));
638 dmachine->cur_digit_len = 0;
639 dmachine->last_digit_time = 0;
675 if (args && (args->input_callback || args->buf || args->buflen)) {
683 if (!args->input_callback && !args->buf) {
688 if (args->input_callback) {
691 *((
char *) args->buf) = dtmf.
digit;
696 if (args->input_callback) {
753 if (dh && !dh->
mux) {
770 int16_t *fp = rframe->
data;
775 for (x = 0; x < (uint32_t) len * dh->
fh.
channels; x++) {
776 int32_t mixed = fp[x] + buf[x];
778 fp[x] = (int16_t) mixed;
782 if (len < rframe->samples) {
837 if (dh && !dh->
mux) {
853 int16_t *fp = rframe->
data;
858 for (x = 0; x < (uint32_t) len * dh->
fh.
channels; x++) {
859 int32_t mixed = fp[x] + buf[x];
861 fp[x] = (int16_t) mixed;
866 rframe->
samples = (uint32_t) len;
973 if ((ext = strrchr(file,
'.'))) {
989 if (hangup_on_error) {
1000 if (flags && strchr(flags,
'm')) {
1004 if (flags && strchr(flags,
'l')) {
1008 if (flags && strchr(flags,
'r')) {
1069 int16_t *fdata = (int16_t *) frame->
data;
1070 uint32_t samples = frame->
datalen /
sizeof(*fdata);
1072 uint32_t channel_num = 0;
1080 for (channel_num = 0; channel_num < codec_impl->
number_of_channels && is_silence; channel_num++) {
1081 uint32_t count = 0, j = channel_num;
1083 for (count = 0; count < samples; count++) {
1084 energy += abs(fdata[j]);
1087 is_silence &= (uint32_t) ((energy / (samples / divisor)) < silence_threshold);
1126 unsigned char *data;
1318 }
else if (rh->
fh) {
1397 char *data, *expanded = NULL;
1402 if ((data = strchr(cmd,
':'))) {
1409 if (expanded && expanded != data) {
1549 if (!strcasecmp(file,
"all")) {
1563 memcpy(dup, rh,
sizeof(*rh));
1573 const char *var = NULL;
1753 if (ep->
errs > 10) {
1823 msg.
from = __FILE__;
1872 int codec_initialized = 0;
1873 const char *name, *num;
1883 const char *macro_name =
"eavesdrop_announce";
1884 const char *id_name = NULL;
1887 char cid_buf[1024] =
"";
1889 uint32_t sanity = 600;
1900 if (!--sanity)
break;
1920 if (!
zstr(require_group)) {
1923 char *argv[10] = { 0 };
1933 data = strdup(group_name);
1935 for (i = 0; i < argc; i++) {
1937 if (argv[i] && !strcmp(argv[i], require_group)) {
1980 codec_initialized = 1;
1983 write_frame.
codec = &codec;
2019 if (
switch_true(vval) || !strcasecmp(vval,
"aleg") || !strcasecmp(vval,
"bleg") || !strcasecmp(vval,
"both")) {
2022 if (
switch_true(vval) || !strcasecmp(vval,
"bleg") || !strcasecmp(vval,
"both")) {
2054 msg.
from = __FILE__;
2093 uint32_t len =
sizeof(
buf);
2095 char *fcommand = NULL;
2097 int vid_bug = 0, vid_dual = 0;
2131 for (d = fcommand; *d; d++) {
2222 int tchanged = 0, changed = 0;
2241 if (changed || tchanged) {
2245 "SPYING CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n",
2254 "SPYED CHANNEL CODEC CHANGE FROM %dhz@%dc to %dhz@%dc\n",
2315 if (codec_initialized)
2359 char *file_path = NULL;
2361 char *in_file = NULL, *out_file = NULL;
2428 if (channels == 1) {
2462 fh->samplerate = tmp;
2466 if (!fh->samplerate) {
2470 fh->channels = channels;
2473 int tmp = atoi(vval);
2476 fh->pre_buffer_datalen = tmp;
2538 if ((ext = strrchr(file,
'.'))) {
2547 if (hangup_on_error) {
2584 if (hangup_on_error) {
2594 if (hangup_on_error) {
2724 msg.
from = __FILE__;
2768 speex_preprocess_state_destroy(cb->
read_st);
2772 speex_preprocess_state_destroy(cb->
write_st);
2776 speex_echo_state_destroy(cb->
read_ec);
2780 speex_echo_state_destroy(cb->
write_ec);
2846 char *mydata = NULL, *argv[5];
2859 if (!strcasecmp(cmds,
"stop")) {
2865 mydata = strdup(cmds);
2868 for (i = 0; i < argc; i++) {
2869 char *var = argv[i];
2874 SpeexPreprocessState *st = NULL;
2875 SpeexEchoState *ec = NULL;
2880 if ((val = strchr(var,
'='))) {
2884 while (*var ==
'.' || *var ==
'_') {
2896 }
else if (rw ==
'w') {
2912 if (!strcasecmp(var,
"agc")) {
2914 int tmp = atoi(val);
2921 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &tr);
2922 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &l);
2924 }
else if (!strcasecmp(var,
"noise_suppress")) {
2927 r = speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &db);
2933 }
else if (!strcasecmp(var,
"echo_cancel")) {
2935 int tmp = atoi(val);
2937 if (!tr && tmp > 0) {
2942 speex_echo_state_destroy(cb->
read_ec);
2945 speex_echo_state_destroy(cb->
write_ec);
2963 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_ECHO_STATE, ec);
2967 }
else if (!strcasecmp(var,
"echo_suppress")) {
2970 speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, &db);
3006 speex_preprocess_state_destroy(cb->
read_st);
3010 speex_preprocess_state_destroy(cb->
write_st);
3014 speex_echo_state_destroy(cb->
read_ec);
3018 speex_echo_state_destroy(cb->
write_ec);
3043 int level = 0, mute = 0;
3108 int existing = 0, c_read = 0, c_write = 0, flags =
SMBF_NO_PAUSE;
3129 if (!strcasecmp(direction,
"write")) {
3132 }
else if (!strcasecmp(direction,
"read")) {
3135 }
else if (!strcasecmp(direction,
"both")) {
3137 c_read = c_write = 1;
3141 if (!strcasecmp(cmd,
"mute")) {
3150 }
else if (!strcasecmp(cmd,
"level")) {
3151 if (level < 5 && level > -5) {
3278 if (!audio_buffer) {
3411 buf[0] = dtmf->
digit;
3428 if (bytes < frame->datalen) {
3486 pvt->
read = !!read_stream;
3499 #define MAX_TONES 16
3590 for (i = 0; i < cont->
index; i++) {
3660 "Event queue failed!\n");
3690 for (i = 0; i < cont->
index; i++) {
3703 const
char *key, const
char *tone_spec,
3704 const
char *flags, time_t timeout,
3711 int i = 0, ok = 0, detect_fax = 0;
3729 for (i = 0; i < cont->
index; i++) {
3741 if (
zstr(tone_spec)) {
3751 int tmp = atoi(var);
3757 if (!hits) hits = 1;
3762 p = (
char *) tone_spec;
3766 next = strchr(p,
',');
3773 if (!strncasecmp(p,
"1100", 4)) {
3774 detect_fax = cont->
index;
3823 int tmp = atoi(var);
3830 int tmp = atoi(var);
3840 if (strchr(flags,
'o')) {
3844 if (strchr(flags,
'r')) {
3846 }
else if (strchr(flags,
'w')) {
3859 switch_core_event_hook_add_send_dtmf(session,
tone_on_dtmf);
3860 switch_core_event_hook_add_recv_dtmf(session,
tone_on_dtmf);
3895 #define SWITCH_META_VAR_KEY "__dtmf_meta"
3896 #define SWITCH_BLOCK_DTMF_KEY "__dtmf_block"
3984 *digit = dtmf->
digit;
3993 if (ok && md->
sr[direction].
map[dval].
app) {
3994 uint32_t flags = md->
sr[direction].
map[dval].
flags;
4030 memset(&md->
sr[direction].
map[dval], 0,
sizeof(md->
sr[direction].
map[dval]));
4055 if (!md || key > 9) {
4103 switch_core_event_hook_add_send_dtmf(session,
block_on_dtmf);
4104 switch_core_event_hook_add_recv_dtmf(session,
block_on_dtmf);
4120 char t_meta = *meta_var;
4128 if (meta !=
'*' && meta !=
'#') {
4146 switch_core_event_hook_add_send_dtmf(session,
meta_on_dtmf);
4147 switch_core_event_hook_add_recv_dtmf(session,
meta_on_dtmf);
4182 #define PLAY_AND_DETECT_DONE 1
4183 #define PLAY_AND_DETECT_DONE_RECOGNIZING 2
4199 if (!
zstr(speech_type)) {
4200 if (!strcasecmp(speech_type,
"detected-speech")) {
4204 if (!
zstr(result)) {
4211 }
else if (!strcasecmp(speech_type,
"begin-speaking")) {
4214 }
else if (!strcasecmp(
"closed", speech_type)) {
4225 if (!strcasecmp(terminators,
"any")) {
4226 terminators =
"1234567890*#";
4227 }
else if (!strcasecmp(terminators,
"none")) {
4231 if (terminators && strchr(terminators, dtmf->
digit)) {
4247 const
char *mod_name,
4248 const
char *grammar,
4250 uint32_t input_timeout,
4254 int recognizing = 0;
4261 if (result == NULL) {
4265 if (!input_timeout) input_timeout = 5000;
4285 args->buflen =
sizeof(state);
4369 char *xmlstr = NULL;
4403 if (!strncasecmp(p,
"pound", 5)) {
4406 }
else if (!strncasecmp(p,
"hash", 4)) {
4409 }
else if (!strncasecmp(p,
"star", 4)) {
4412 }
else if (!strncasecmp(p,
"asterisk", 8)) {
4582 switch_core_event_hook_remove_recv_dtmf(session,
speech_on_dtmf);
4635 if (sth && sth->
ah && name && val) {
4760 switch_snprintf(key,
sizeof(key),
"%s/%s/%s/%s", mod_name, NULL, NULL, dest);
4779 const
char *mod_name,
4822 const char *other_uuid;
4850 size_t len =
sizeof(*helper);
4887 size_t len =
sizeof(*helper);
4891 len += strlen(extension) + 1;
4895 len += strlen(dialplan) + 1;
4899 len += strlen(context) + 1;
4907 cur +=
sizeof(*helper);
4918 cur += strlen(helper->
dialplan) + 1;
4947 size_t len =
sizeof(*helper) + strlen(path) + 1;
4953 cur +=
sizeof(*helper);
4969 const char *other_uuid = NULL;
4970 char *app =
"playback";
4974 int app_flags = 0, nomedia = 0;
4984 mypath = strdup(path);
4987 if ((p = strchr(mypath,
':')) && *(p + 1) ==
':') {
4999 if ((cause = strchr(app,
'!'))) {
5002 cause =
"normal_clearing";
5034 master = other_session;
5035 other_session = NULL;
5115 if (frame->
img && oht->
img) {
struct apr_queue_t switch_queue_t
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.
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.
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
#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_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.
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_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)
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]
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_STANDARD_SCHED_FUNC(sch_hangup_callback)
struct oht_s overly_helper_t
teletone_audio_t * buffer
#define switch_channel_up(_channel)
#define SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE
#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
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)
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.
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 switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_threshold, switch_codec_implementation_t *codec_impl)
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
#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
static int switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
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 * 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)
struct apr_thread_cond_t switch_thread_cond_t
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.
#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_thread_join(switch_status_t *retval, switch_thread_t *thd)
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.
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
if((uint32_t)(unpack->cur-unpack->buf) > unpack->buflen)
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)
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.
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]
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.
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.
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_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_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_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.
#define SWITCH_BRIDGE_VARIABLE
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)
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.
switch_queue_t * digit_queue
static char switch_itodtmf(char i)
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
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 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_session_request_video_refresh(switch_core_session_t *session)
switch_status_t switch_core_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
Check an asr handle for results.
switch_bool_t speech_detected
uint8_t number_of_channels
struct apr_thread_mutex_t switch_mutex_t
uint32_t samples_per_second
switch_status_t
Common return values.
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
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_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.
switch_status_t switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh)
Record a session to disk.
#define switch_core_hash_insert(_h, _k, _d)
void switch_buffer_unlock(_In_ switch_buffer_t *buffer)
struct apr_thread_t switch_thread_t
#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.
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)
switch_status_t(* switch_ivr_dmachine_callback_t)(switch_ivr_dmachine_match_t *match)
#define switch_channel_media_ack(_channel)
static const char * skip(const char *in)
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)
struct apr_pool_t switch_memory_pool_t
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)
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 -
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)
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)
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_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.
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.
switch_bool_t(* switch_tone_detect_callback_t)(switch_core_session_t *, const char *, const char *)
#define SWITCH_DEFAULT_FILE_BUFFER_LEN
static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)