52 int64_t global_total = 0, global_sum = 0, period_sum = 0;
54 int period_avg = 0, global_avg = 0;
88 data = (int16_t *) read_frame->
data;
91 for (i = 0; i < read_frame->
samples; i++) {
92 const int16_t s = (int16_t) abs(data[i]);
107 period_avg = (int) (period_sum / period_total);
110 "\npacket_avg=%d packet_peak=%d period_avg=%d global_avg=%d\n\n", avg, peak, period_avg, global_avg);
112 if (period_total >= period_len) {
113 global_avg = (int) (global_sum / global_total);
138 unsigned char *abuf = NULL;
174 && (sval = atoi(var))) {
178 if (ms > 10 && sval) {
198 write_frame.
codec = &codec;
200 write_frame.
data = abuf;
211 cng_frame.
data = data;
226 elapsed = (int32_t) ((now - start) / 1000);
240 if (now > done || left <= 0) {
263 char ds[2] = {dtmf.
digit,
'\0'};
271 }
else if (args->
buf) {
312 if (sval && write_frame.
datalen) {
327 if (write_frame.
codec) {
391 if (++sanity >= 10000) {
407 char *remote_ip,
switch_port_t remote_port,
char *transport,
char *flags)
422 if (!strcasecmp(transport,
"udp")) {
423 conninfo->
type = AF_INET;
425 }
else if (!strcasecmp(transport,
"tcp")) {
426 conninfo->
type = AF_INET;
434 if (strstr(flags,
"native")) {
453 "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
507 unsigned long cmd_hash;
518 int el = 0, elp = 0, reneg_sec = 0;
519 const char *var = NULL;
542 int frame_count = atoi(lead_frames);
543 int max_frames = frame_count * 2;
545 while (frame_count > 0 && --max_frames > 0) {
556 if (cmd_hash == CMD_EXECUTE) {
567 if (
zstr(app_arg) && !
zstr(content_type) && !strcasecmp(content_type,
"text/plain")) {
572 loops = atoi(loop_h);
577 const char *b_uuid = NULL;
629 for (x = 0; x < loops || loops < 0; x++) {
639 if (event_uuid_name) {
682 reneg_sec = atoi(var);
683 if (reneg_sec < 0) reneg_sec = 0;
699 api =
"uuid_media_reneg";
709 }
else if (cmd_hash == CMD_UNICAST) {
717 if (
zstr(local_ip)) {
718 local_ip =
"127.0.0.1";
720 if (
zstr(remote_ip)) {
721 remote_ip =
"127.0.0.1";
723 if (
zstr(local_port)) {
726 if (
zstr(remote_port)) {
727 remote_port =
"8026";
729 if (
zstr(transport)) {
735 }
else if (cmd_hash == CMD_XFEREXT) {
748 if (!strcasecmp(hp->
name,
"application")) {
749 app = strdup(hp->
value);
751 data = strchr(app,
' ');
765 }
else if (cmd_hash == CMD_HANGUP) {
774 }
else if (cmd_hash == CMD_NOMEDIA) {
916 uint32_t stack_count = 0;
965 unsigned char *abuf = NULL;
988 if ((cause_str = strchr(to,
':'))) {
992 if ((timeout = atoi(to)) >= 0) {
1035 write_frame.
codec = &codec;
1037 write_frame.
data = abuf;
1066 if (rate && write_frame.
data && sval) {
1097 uint32_t dlen =
sizeof(decoded);
1100 uint32_t sendlen = 0;
1107 memset(decoded, 255, sendlen);
1123 sendbuf = read_frame->
data;
1124 sendlen = read_frame->
datalen;
1163 char ds[2] = {dtmf.
digit,
'\0'};
1204 if (write_frame.
codec) {
1226 uint32_t abs_timeout)
1231 uint32_t abs_elapsed = 0, digit_elapsed = 0;
1242 if (digit_timeout) {
1259 if (abs_elapsed >= abs_timeout) {
1264 if (digit_timeout) {
1266 if (digit_elapsed >= digit_timeout) {
1284 char ds[2] = {dtmf.
digit,
'\0'};
1294 if (digit_timeout) {
1346 const char *terminators,
char *terminator,
1347 uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout)
1353 uint32_t abs_elapsed = 0, digit_elapsed = 0;
1354 uint32_t eff_timeout = 0;
1356 unsigned char *abuf = NULL;
1363 if (x >= buflen || x >= maxdigits) {
1388 write_frame.
codec = &codec;
1390 write_frame.
data = abuf;
1396 if (terminator != NULL) {
1400 if (!
zstr(terminators)) {
1401 for (i = 0; i < x; i++) {
1402 if (strchr(terminators, buf[i]) && terminator != NULL) {
1403 *terminator = buf[i];
1415 if (digit_timeout && first_timeout) {
1416 eff_timeout = first_timeout;
1417 }
else if (digit_timeout && !first_timeout) {
1418 eff_timeout = digit_timeout;
1419 }
else if (first_timeout) {
1420 digit_timeout = eff_timeout = first_timeout;
1433 if (abs_elapsed >= abs_timeout) {
1447 if (digit_elapsed >= eff_timeout) {
1458 eff_timeout = digit_timeout;
1462 for (y = 0; y <= maxdigits; y++) {
1467 if (!
zstr(terminators) && strchr(terminators, dtmf.
digit) && terminator != NULL) {
1468 *terminator = dtmf.
digit;
1474 buf[x++] = dtmf.
digit;
1477 if (x >= buflen || x >= maxdigits) {
1492 if (write_frame.
data) {
1500 if (write_frame.
codec) {
1518 msg.
from = __FILE__;
1530 const char *other_uuid;
1545 msg.
from = __FILE__;
1593 }
else if (callstate ==
CCS_HELD) {
1607 const char *other_uuid;
1622 msg.
from = __FILE__;
1665 const char *other_uuid = NULL;
1674 msg.
from = __FILE__;
1699 msg2.
from = __FILE__;
1733 if ((flags & SMF_REBRIDGE)
1752 if (other_channel) {
1759 if (other_channel) {
1775 const char *other_uuid = NULL;
1784 msg.
from = __FILE__;
1811 msg2.
from = __FILE__;
1842 if ((flags & SMF_REBRIDGE)
1858 if (other_channel) {
1866 if (other_channel) {
1883 const char *other_uuid;
1891 msg.
from = __FILE__;
1956 if (other_channel) {
1989 const char *other_uuid;
1997 msg.
from = __FILE__;
2050 if (other_channel) {
2152 msg.
from = __FILE__;
2164 const char *context)
2171 const char *uuid = NULL;
2172 const char *max_forwards;
2175 int forwardval = 70;
2176 const char *use_dialplan = dialplan, *use_context = context;
2178 if (
zstr(forwardvar)) {
2182 if (!
zstr(forwardvar)) {
2183 forwardval = atoi(forwardvar) - 1;
2185 if (forwardval <= 0) {
2218 if (
zstr(use_dialplan)) {
2220 if (!
zstr(use_dialplan) && !strcasecmp(use_dialplan,
"inline")) {
2221 use_dialplan = NULL;
2225 if (
zstr(use_context)) {
2226 use_context = profile->
context;
2229 if (
zstr(use_dialplan)) {
2230 use_dialplan =
"XML";
2233 if (
zstr(use_context)) {
2234 use_context =
"default";
2237 if (
zstr(extension)) {
2238 extension =
"service";
2300 msg.
from = __FILE__;
2304 extension, use_context);
2309 extension, use_context, use_dialplan);
2324 const char *val = NULL;
2327 if (var && *var ==
'~') {
2332 if (var && !prefix) {
2341 for (hi = var_event->
headers; hi; hi = hi->
next) {
2342 char *vvar = hi->
name;
2343 char *vval = hi->
value;
2344 if (vvar && vval && (!prefix || (var && !strncmp((
char *) vvar, var, strlen(var))))) {
2377 if (parser != NULL) {
2385 pool_auto_created = 1;
2393 if (pool && *parser != NULL) {
2396 (*parser)->pool =
pool;
2397 (*parser)->digit_timeout_ms = 1000;
2404 if (pool != NULL && pool_auto_created) {
2417 if (parser != NULL) {
2418 if (parser->
hash != NULL) {
2420 parser->
hash = NULL;
2436 if (parser && stream && *stream == NULL) {
2439 memset(*stream, 0,
sizeof(**stream));
2465 if (parser != NULL && digits != NULL && *digits && parser->
hash != NULL) {
2476 if (len > parser->
buflen) {
2481 if (len > parser->
maxlen) {
2507 if (parser != NULL && digits != NULL && *digits) {
2520 void *result = NULL;
2527 len = strlen(stream->
digits);
2536 if (len > 0 && parser->
maxlen != 0 && len >= parser->
maxlen) {
2537 char *src = stream->
digits + 1;
2538 char *dst = stream->
digits;
2541 *(dst++) = *(src++);
2545 *(stream->
digits + (len++)) = digit;
2546 *(stream->
digits + len) =
'\0';
2562 if (result != NULL || parser->
terminator == digit) {
2588 if (parser != NULL) {
2687 if (caller_profile->
soft) {
2690 for (pn = caller_profile->
soft; pn; pn = pn->
next) {
2705 #define add_stat(_x, _i, _s) \ 2706 switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \ 2707 x_tmp = switch_xml_add_child_d(_x, _s, loff++); \ 2708 switch_xml_set_txt_d(x_tmp, var_val) 2710 #define add_stat_double(_x, _i, _s) \ 2711 switch_snprintf(var_val, sizeof(var_val), "%0.2f", _i); \ 2712 x_tmp = switch_xml_add_child_d(_x, _s, loff++); \ 2713 switch_xml_set_txt_d(x_tmp, var_val) 2722 char var_val[35] =
"";
2725 if (!stats)
return off;
2822 dlen = strlen(val) * 3 + 1;
2825 if ((data = malloc(dlen))) {
2846 for (; hi; hi = hi->
next) {
2850 for (i = 0; i < hi->
idx; i++) {
2866 switch_xml_t call_stats, variables, cdr, x_main_cp, x_caller_profile, x_caller_extension, x_times, time_tag,
2867 x_application, x_callflow, x_inner_extension, x_apps, x_o, x_channel_data, x_field, xhr, x_hold;
2870 int cdr_off = 0, cd_off = 0;
2872 const char *text_buffer = NULL;
2939 for (ap = app_log; ap; ap = ap->
next) {
2961 for (hr = hold_record; hr; hr = hr->
next) {
2987 while (caller_profile) {
3038 int i_off = 0, i_app_off = 0;
3122 if (caller_profile->
times) {
3195 caller_profile = caller_profile->
next;
3213 cJSON_AddItemToObject(json,
"username", cJSON_CreateString((
char *)caller_profile->
username));
3214 cJSON_AddItemToObject(json,
"dialplan", cJSON_CreateString((
char *)caller_profile->
dialplan));
3215 cJSON_AddItemToObject(json,
"caller_id_name", cJSON_CreateString((
char *)caller_profile->
caller_id_name));
3216 cJSON_AddItemToObject(json,
"ani", cJSON_CreateString((
char *)caller_profile->
ani));
3217 cJSON_AddItemToObject(json,
"aniii", cJSON_CreateString((
char *)caller_profile->
aniii));
3218 cJSON_AddItemToObject(json,
"caller_id_number", cJSON_CreateString((
char *)caller_profile->
caller_id_number));
3219 cJSON_AddItemToObject(json,
"network_addr", cJSON_CreateString((
char *)caller_profile->
network_addr));
3220 cJSON_AddItemToObject(json,
"rdnis", cJSON_CreateString((
char *)caller_profile->
rdnis));
3221 cJSON_AddItemToObject(json,
"destination_number", cJSON_CreateString(caller_profile->
destination_number));
3222 cJSON_AddItemToObject(json,
"uuid", cJSON_CreateString(caller_profile->
uuid));
3223 cJSON_AddItemToObject(json,
"source", cJSON_CreateString((
char *)caller_profile->
source));
3224 cJSON_AddItemToObject(json,
"context", cJSON_CreateString((
char *)caller_profile->
context));
3225 cJSON_AddItemToObject(json,
"chan_name", cJSON_CreateString(caller_profile->
chan_name));
3228 #define add_jstat(_j, _i, _s) \ 3229 switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \ 3230 cJSON_AddItemToObject(_j, _s, cJSON_CreateNumber(_i)) 3235 cJSON *j_stat, *j_in, *j_out;
3237 char var_val[35] =
"";
3241 j_stat = cJSON_CreateObject();
3242 j_in = cJSON_CreateObject();
3243 j_out = cJSON_CreateObject();
3245 cJSON_AddItemToObject(json, name, j_stat);
3246 cJSON_AddItemToObject(j_stat,
"inbound", j_in);
3247 cJSON_AddItemToObject(j_stat,
"outbound", j_out);
3272 cJSON *j_err_log, *j_err;
3275 j_err_log = cJSON_CreateArray();
3276 cJSON_AddItemToObject(j_in,
"errorLog", j_err_log);
3282 j_err = cJSON_CreateObject();
3284 cJSON_AddItemToObject(j_err,
"start", cJSON_CreateNumber(ep->
start));
3285 cJSON_AddItemToObject(j_err,
"stop", cJSON_CreateNumber(ep->
stop));
3286 cJSON_AddItemToObject(j_err,
"flaws", cJSON_CreateNumber(ep->
flaws));
3287 cJSON_AddItemToObject(j_err,
"consecutiveFlaws", cJSON_CreateNumber(ep->
consecutive_flaws));
3288 cJSON_AddItemToObject(j_err,
"durationMS", cJSON_CreateNumber((ep->
stop - ep->
start) / 1000));
3289 cJSON_AddItemToArray(j_err_log, j_err);
3311 for (; hi; hi = hi->
next) {
3313 char *data = hi->
value;
3317 if ((data = malloc(dlen))) {
3323 cJSON_AddItemToObject(json, hi->
name, cJSON_CreateString(data));
3325 if (data != hi->
value) {
3337 cJSON *cdr = cJSON_CreateObject();
3340 cJSON *variables, *j_main_cp, *j_caller_profile, *j_caller_extension, *j_caller_extension_apps, *j_times, *j_application,
3341 *j_callflow, *j_profile, *j_inner_extension, *j_app_log, *j_apps, *j_o, *j_o_profiles, *j_channel_data, *callStats;
3347 j_channel_data = cJSON_CreateObject();
3349 cJSON_AddItemToObject(cdr,
"channel_data", j_channel_data);
3355 cJSON_AddItemToObject(j_channel_data,
"state_number", cJSON_CreateString((
char *) tmp));
3358 cJSON_AddItemToObject(j_channel_data,
"flags", cJSON_CreateString((
char *) f));
3363 cJSON_AddItemToObject(j_channel_data,
"caps", cJSON_CreateString((
char *) f));
3367 callStats = cJSON_CreateObject();
3368 cJSON_AddItemToObject(cdr,
"callStats", callStats);
3372 variables = cJSON_CreateObject();
3373 cJSON_AddItemToObject(cdr,
"variables", variables);
3380 j_app_log = cJSON_CreateObject();
3381 j_apps = cJSON_CreateArray();
3383 cJSON_AddItemToObject(cdr,
"app_log", j_app_log);
3384 cJSON_AddItemToObject(j_app_log,
"applications", j_apps);
3386 for (ap = app_log; ap; ap = ap->
next) {
3387 j_application = cJSON_CreateObject();
3389 cJSON_AddItemToObject(j_application,
"app_name", cJSON_CreateString(ap->
app));
3390 cJSON_AddItemToObject(j_application,
"app_data", cJSON_CreateString(ap->
arg));
3392 cJSON_AddItemToObject(j_application,
"app_stamp", cJSON_CreateString(tmp));
3394 cJSON_AddItemToArray(j_apps, j_application);
3401 j_callflow = cJSON_CreateArray();
3402 cJSON_AddItemToObject(cdr,
"callflow", j_callflow);
3404 while (caller_profile) {
3406 j_profile = cJSON_CreateObject();
3409 cJSON_AddItemToObject(j_profile,
"dialplan", cJSON_CreateString((
char *)caller_profile->
dialplan));
3413 cJSON_AddItemToObject(j_profile,
"profile_index", cJSON_CreateString((
char *)caller_profile->
profile_index));
3419 j_caller_extension = cJSON_CreateObject();
3420 j_caller_extension_apps = cJSON_CreateArray();
3422 cJSON_AddItemToObject(j_profile,
"extension", j_caller_extension);
3426 cJSON_AddItemToObject(j_caller_extension,
"applications", j_caller_extension_apps);
3433 j_application = cJSON_CreateObject();
3435 cJSON_AddItemToArray(j_caller_extension_apps, j_application);
3438 cJSON_AddItemToObject(j_application,
"last_executed", cJSON_CreateString(
"true"));
3440 cJSON_AddItemToObject(j_application,
"app_name", cJSON_CreateString(ap->
application_name));
3446 j_inner_extension = cJSON_CreateArray();
3447 cJSON_AddItemToObject(j_caller_extension,
"sub_extensions", j_inner_extension);
3454 j_caller_extension = cJSON_CreateObject();
3455 cJSON_AddItemToArray(j_inner_extension, j_caller_extension);
3460 cJSON_AddItemToObject(j_caller_extension,
"dialplan", cJSON_CreateString((
char *)cp->
dialplan));
3466 j_caller_extension_apps = cJSON_CreateArray();
3467 cJSON_AddItemToObject(j_caller_extension,
"applications", j_caller_extension_apps);
3469 j_application = cJSON_CreateObject();
3470 cJSON_AddItemToArray(j_caller_extension_apps, j_application);
3473 cJSON_AddItemToObject(j_application,
"last_executed", cJSON_CreateString(
"true"));
3475 cJSON_AddItemToObject(j_application,
"app_name", cJSON_CreateString(ap->
application_name));
3482 j_main_cp = cJSON_CreateObject();
3483 cJSON_AddItemToObject(j_profile,
"caller_profile", j_main_cp);
3490 j_o = cJSON_CreateObject();
3491 cJSON_AddItemToObject(j_main_cp,
"originator", j_o);
3493 j_o_profiles = cJSON_CreateArray();
3494 cJSON_AddItemToObject(j_o,
"originator_caller_profiles", j_o_profiles);
3497 j_caller_profile = cJSON_CreateObject();
3498 cJSON_AddItemToArray(j_o_profiles, j_caller_profile);
3507 j_o = cJSON_CreateObject();
3508 cJSON_AddItemToObject(j_main_cp,
"originatee", j_o);
3510 j_o_profiles = cJSON_CreateArray();
3511 cJSON_AddItemToObject(j_o,
"originatee_caller_profiles", j_o_profiles);
3514 j_caller_profile = cJSON_CreateObject();
3515 cJSON_AddItemToArray(j_o_profiles, j_caller_profile);
3521 if (caller_profile->
times) {
3523 j_times = cJSON_CreateObject();
3524 cJSON_AddItemToObject(j_profile,
"times", j_times);
3527 cJSON_AddItemToObject(j_times,
"created_time", cJSON_CreateString(tmp));
3530 cJSON_AddItemToObject(j_times,
"profile_created_time", cJSON_CreateString(tmp));
3533 cJSON_AddItemToObject(j_times,
"progress_time", cJSON_CreateString(tmp));
3536 cJSON_AddItemToObject(j_times,
"progress_media_time", cJSON_CreateString(tmp));
3539 cJSON_AddItemToObject(j_times,
"answered_time", cJSON_CreateString(tmp));
3542 cJSON_AddItemToObject(j_times,
"bridged_time", cJSON_CreateString(tmp));
3545 cJSON_AddItemToObject(j_times,
"last_hold_time", cJSON_CreateString(tmp));
3548 cJSON_AddItemToObject(j_times,
"hold_accum_time", cJSON_CreateString(tmp));
3551 cJSON_AddItemToObject(j_times,
"hangup_time", cJSON_CreateString(tmp));
3554 cJSON_AddItemToObject(j_times,
"resurrect_time", cJSON_CreateString(tmp));
3557 cJSON_AddItemToObject(j_times,
"transfer_time", cJSON_CreateString(tmp));
3560 cJSON_AddItemToArray(j_callflow, j_profile);
3561 caller_profile = caller_profile->
next;
3597 if (delay_ms < 1 || delay_ms > 10000) {
3604 if (delay_ms < interval * 2) {
3605 delay_ms = interval * 2;
3609 qlen = delay_ms / (interval);
3638 if (read_frame->
packet) {
3641 }
else if (is_rtp) {
3653 write_frame.
datalen = (uint32_t) plen - 12;
3654 write_frame.
buflen = (uint32_t) plen;
3669 const char *module_name,
3670 const char *say_type,
3671 const char *say_method,
3672 const char *say_gender,
3678 const char *save_path = NULL, *chan_lang = NULL, *lang = NULL, *sound_path = NULL;
3680 switch_xml_t cfg, xml = NULL, language = NULL, macros = NULL, phrases = NULL;
3690 if (
zstr(module_name)) {
3699 if ((p = strchr(module_name,
':'))) {
3711 chan_lang = module_name;
3736 module_name = chan_lang;
3739 if (!(sound_path = (
char *)
switch_xml_attr(language,
"sound-prefix"))) {
3740 if (!(sound_path = (
char *)
switch_xml_attr(language,
"sound-path"))) {
3763 status = si->
say_function(session, (
char *) tosay, &say_args, args);
3793 const char *module_name,
3794 const char *say_type,
3795 const char *say_method,
3796 const char *say_gender,
3802 const char *save_path = NULL, *chan_lang = NULL, *sound_path = NULL;
3804 switch_xml_t cfg, xml = NULL, language = NULL, macros = NULL, phrases = NULL;
3824 if (!lang) lang =
"en";
3825 if (!chan_lang) chan_lang = lang;
3845 module_name = chan_lang;
3848 if (!(sound_path = (
char *)
switch_xml_attr(language,
"sound-prefix"))) {
3849 if (!(sound_path = (
char *)
switch_xml_attr(language,
"sound-path"))) {
3884 if (save_path && channel) {
3896 static const char *
get_prefixed_str(
char *
buffer,
size_t buffer_size,
const char *prefix,
size_t prefix_size,
const char *str)
3908 str_len = strlen(str);
3909 memcpy(buffer, prefix, prefix_size);
3911 if (str_len + prefix_size + 1 > buffer_size) {
3912 memcpy(buffer + prefix_size, str, buffer_size - prefix_size - 1);
3913 buffer[buffer_size - 1] =
'\0';
3915 memcpy(buffer + prefix_size, str, str_len + 1);
3922 const char *user,
const char *domain,
switch_xml_t x_user)
3929 char *prefix_buffer = NULL;
3930 size_t buffer_size = 0;
3931 size_t prefix_size = 0;
3936 if (!
zstr(prefix)) {
3937 prefix_size = strlen(prefix);
3938 buffer_size = 1024 + prefix_size + 1;
3942 if ((number_alias = (
char *)
switch_xml_attr(x_user,
"number-alias"))) {
3968 if (user && domain) {
3984 char *user, *domain;
3995 if ((prefix = strchr(user,
' '))) {
3999 if (!(domain = strchr(user,
'@'))) {
4063 if (!strncasecmp(cmd,
"speed", 5)) {
4066 if ((p = strchr(cmd,
':'))) {
4068 if (*p ==
'+' || *p ==
'-') {
4070 if (!(step = atoi(p))) {
4075 int speed = atoi(p);
4083 }
else if (!strncasecmp(cmd,
"volume", 6)) {
4086 if ((p = strchr(cmd,
':'))) {
4088 if (*p ==
'+' || *p ==
'-') {
4090 if (!(step = atoi(p))) {
4106 }
else if (!strcasecmp(cmd,
"pause")) {
4116 }
else if (!strcasecmp(cmd,
"stop")) {
4119 }
else if (!strcasecmp(cmd,
"truncate")) {
4121 }
else if (!strcasecmp(cmd,
"restart")) {
4122 unsigned int pos = 0;
4126 }
else if (!strncasecmp(cmd,
"seek", 4)) {
4128 unsigned int samps = 0;
4129 unsigned int pos = 0;
4133 if ((p = strchr(cmd,
':'))) {
4135 if (*p ==
'+' || *p ==
'-') {
4138 if (!(step = atoi(p))) {
4163 if (!strcmp(cmd,
"true") || !strcmp(cmd,
"undefined")) {
4171 #define START_SAMPLES 32768 4181 int16_t *abuf = NULL;
4192 if ((ext = strrchr(file,
'.'))) {
4238 if ((sample_count + olen) > sample_point) {
4239 olen = sample_point - sample_count;
4246 sample_count += olen;
4274 sample_count += olen;
4303 sample_count += olen;
4342 char *cf =
"presence_map.conf";
4347 int proceed = 0, ovector[100];
4352 if ( !
zstr(domain_name) ) {
4356 if ( !
zstr(exten_name) ) {
4372 if (!dname || (strcasecmp(dname,
"*") && strcasecmp(domain_name, dname)))
continue;
4378 if (!
zstr(regex) && !
zstr(proto)) {
4379 proceed =
switch_regex_perform(exten_name, regex, &re, ovector,
sizeof(ovector) /
sizeof(ovector[0]));
4384 exten_name, domain_name, proto, regex);
4432 msg.
from = __FILE__;
#define switch_event_prep_for_delivery(_event)
char * switch_channel_get_cap_string(switch_channel_t *channel)
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
switch_xml_t switch_xml_set_attr_d_buf(switch_xml_t xml, const char *name, const char *value)
Wrapper for switch_xml_set_attr() that strdup()s name/value. Value cannot be NULL.
switch_xml_t switch_xml_add_child_d(_In_ switch_xml_t xml, _In_z_ const char *name, _In_ switch_size_t off)
wrapper for switch_xml_add_child() that strdup()s name
switch_status_t switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t *stream)
Reset the collected digit stream to nothing.
#define SWITCH_SIGNAL_BRIDGE_VARIABLE
switch_time_t switch_micro_time_now(void)
Get the current epoch time in microseconds.
const char * switch_core_get_switchname(void)
switch_channel_state_t switch_channel_get_state(switch_channel_t *channel)
Get the current state of a channel in the state engine.
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
switch_status_t switch_jb_get_packet(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t *len)
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it's state machine to end.
#define switch_regex_safe_free(re)
void switch_xml_free(_In_opt_ switch_xml_t xml)
frees the memory allocated for an switch_xml structure
#define switch_channel_answer(channel)
Answer a channel (initiate/acknowledge a successful connection)
switch_status_t switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix)
int switch_ivr_set_xml_profile_data(switch_xml_t xml, switch_caller_profile_t *caller_profile, int off)
#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_sockaddr_t * local_addr
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_channel_set_profile_var(switch_channel_t *channel, const char *name, const char *val)
Set a variable on a given channel.
unsigned int digit_timeout_ms
unsigned int switch_atoui(const char *nptr)
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
void switch_ivr_bg_media(const char *uuid, switch_media_flag_t flags, switch_bool_t on, switch_bool_t is3p, uint32_t delay)
switch_status_t switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t *parser, char digit)
Set a digit string terminator.
#define SWITCH_CHANNEL_SESSION_LOG(x)
#define switch_core_session_force_locate(uuid_str)
Locate a session based on it's uuid even if the channel is not ready.
An Abstract Representation of a dialplan extension.
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
switch_rtp_numbers_t inbound
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_status_t switch_core_hash_destroy(_Inout_ switch_hash_t **hash)
Destroy an existing hash table.
switch_status_t switch_ivr_parse_all_signal_data(switch_core_session_t *session)
switch_xml_t switch_xml_set_attr_d(switch_xml_t xml, const char *name, const char *value)
Wrapper for switch_xml_set_attr() that strdup()s name/value. Value cannot be NULL.
void * switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key)
Retrieve data from a given hash.
struct switch_hold_record_s * next
switch_say_callback_t say_function
const char * switch_xml_attr(_In_opt_ switch_xml_t xml, _In_opt_z_ const char *attr)
returns the value of the requested tag attribute, or NULL if not found
switch_status_t switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa)
switch_status_t switch_ivr_process_indications(switch_core_session_t *session, switch_core_session_message_t *message)
const char * switch_channel_get_partner_uuid(switch_channel_t *channel)
#define switch_core_hash_init(_hash)
#define switch_channel_set_state(channel, state)
Set the current state of a channel.
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
switch_hold_record_t * switch_channel_get_hold_record(switch_channel_t *channel)
#define SWITCH_MAX_STACKS
#define SWITCH_TRANSFER_SOURCE_VARIABLE
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.
struct switch_caller_profile * originatee_caller_profile
switch_status_t switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan, const char *context)
switch_status_t switch_ivr_nomedia(const char *uuid, switch_media_flag_t flags)
Signal a session to request indirect media allowing it to exchange media directly with another device...
#define switch_channel_stop_broadcast(_channel)
switch_status_t switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, uint32_t digit_timeout, uint32_t abs_timeout)
Wait for DTMF digits calling a pluggable callback function when digits are collected.
#define SWITCH_RECOMMENDED_BUFFER_SIZE
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_status_t switch_xml_locate_language(switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language)
static int switch_ivr_set_xml_chan_var(switch_xml_t xml, const char *var, const char *val, int off)
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
static void switch_ivr_set_json_profile_data(cJSON *json, switch_caller_profile_t *caller_profile)
switch_size_t largest_jb_size
struct error_period * next
switch_status_t switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t **stream)
Destroys a digit stream object.
switch_status_t switch_xml_locate_user_merged(const char *key, const char *user_name, const char *domain_name, const char *ip, switch_xml_t *user, switch_event_t *params)
switch_status_t switch_ivr_unhold_uuid(const char *uuid)
Signal the session with a protocol specific unhold message.
const char * network_addr
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.
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
switch_say_method_t method
#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
Representation of an event.
#define switch_channel_ready(_channel)
switch_say_string_callback_t say_string_function
#define arg_recursion_check_stop(_args)
switch_status_t switch_ivr_hold(switch_core_session_t *session, const char *message, switch_bool_t moh)
Signal the session with a protocol specific hold message.
An Abstract Representation of a dialplan Application.
void switch_core_session_free_message(switch_core_session_message_t **message)
switch_caller_profile_t * switch_caller_profile_clone(_In_ switch_core_session_t *session, _In_ switch_caller_profile_t *tocopy)
Clone an existing caller profile object.
switch_status_t switch_ivr_park(switch_core_session_t *session, switch_input_args_t *args)
void switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's caller profile.
void switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t channels, uint32_t divisor)
Generate static noise.
#define switch_channel_media_ready(_channel)
switch_sockaddr_t * remote_addr
switch_status_t switch_core_codec_decode(switch_codec_t *codec, switch_codec_t *other_codec, void *encoded_data, uint32_t encoded_data_len, uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
Decode data using a codec handle.
A representation of an XML tree.
switch_memory_pool_t * pool
switch_status_t switch_core_codec_destroy(switch_codec_t *codec)
Destroy an initalized codec handle.
struct switch_caller_profile * next
const char * string_array_arg[MESSAGE_STRING_ARG_MAX]
const char * switch_channel_state_name(_In_ switch_channel_state_t state)
Render the name of the provided state enum.
switch_status_t switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len)
#define switch_core_session_get_name(_s)
switch_status_t switch_jb_put_packet(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t len)
switch_status_t switch_jb_destroy(switch_jb_t **jbp)
switch_size_t media_bytes
struct real_pcre switch_regex_t
char * switch_url_encode(const char *url, char *buf, size_t len)
switch_xml_t switch_xml_set_txt_d(switch_xml_t xml, const char *txt)
wrapper for switch_xml_set_txt() that strdup()s txt \ sets the character content for the given tag an...
switch_status_t switch_ivr_parse_all_events(switch_core_session_t *session)
Parse all commands from an event.
switch_event_header_t * switch_channel_variable_first(switch_channel_t *channel)
Start iterating over the entries in the channel variable list.
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_size_t dtmf_packet_count
static switch_thread_t * thread
char * switch_channel_get_flag_string(switch_channel_t *channel)
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
static const char * get_prefixed_str(char *buffer, size_t buffer_size, const char *prefix, size_t prefix_size, const char *str)
int switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_session_t *session, int off, switch_media_type_t type)
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_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.
A message object designed to allow unlike technologies to exchange data.
switch_codec_t * switch_core_session_get_read_codec(_In_ switch_core_session_t *session)
Retrieve the read codec from a given session.
#define SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE
#define SWITCH_PARK_AFTER_BRIDGE_VARIABLE
struct switch_caller_application * next
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_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_status_t switch_ivr_parse_next_event(switch_core_session_t *session)
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE
switch_status_t switch_file_rename(const char *from_path, const char *to_path, switch_memory_pool_t *pool)
#define SWITCH_MUTEX_NESTED
void switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state)
static void unicast_thread_launch(switch_unicast_conninfo_t *conninfo)
#define SWITCH_PATH_SEPARATOR
const switch_codec_implementation_t * implementation
switch_port_t remote_port
switch_status_t switch_ivr_collect_digits_count(switch_core_session_t *session, char *buf, switch_size_t buflen, switch_size_t maxdigits, const char *terminators, char *terminator, uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout)
Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up...
switch_rtcp_numbers_t rtcp
switch_byte_t switch_byte_t * buf
if((uint32_t)(unpack->cur - unpack->buf) > unpack->buflen)
#define switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
#define switch_channel_audio_sync(_c)
SWITCH_BEGIN_EXTERN_C switch_status_t switch_jb_create(switch_jb_t **jbp, switch_jb_type_t type, uint32_t min_frame_len, uint32_t max_frame_len, switch_memory_pool_t *pool)
#define switch_normalize_volume(x)
const char * switch_channel_get_hold_music(switch_channel_t *channel)
switch_status_t switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t *parser, char *digits)
Delete a string to action mapping.
char * switch_core_get_uuid(void)
Retrieve the unique identifier from the core.
switch_status_t switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len)
static switch_bool_t switch_is_moh(const char *s)
switch_status_t switch_ivr_parse_event(switch_core_session_t *session, switch_event_t *event)
Abstract interface to a say module.
const char * callee_id_number
switch_status_t switch_core_session_dequeue_signal_data(switch_core_session_t *session, void **signal_data)
switch_status_t switch_channel_add_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack)
char * switch_event_get_body(switch_event_t *event)
Retrieve the body value from an event.
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
uint32_t actual_samples_per_second
void switch_channel_clear_state_handler(switch_channel_t *channel, const switch_state_handler_table_t *state_handler)
clear a state handler table from a given channel
#define switch_channel_get_variable(_c, _v)
#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_caller_application_t * applications
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_status_t switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t **parser)
Create a digit stream parser object.
#define switch_zmalloc(ptr, len)
switch_codec_t read_codec
const char * caller_id_name
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
#define add_stat(_x, _i, _s)
switch_rtp_numbers_t outbound
switch_thread_start_t func
switch_xml_t switch_xml_new(_In_opt_z_ const char *name)
returns a new empty switch_xml structure with the given root tag name
switch_status_t switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid)
Bridge two existing sessions.
struct switch_caller_profile * children
#define switch_channel_ring_ready(channel)
Send Ringing message to a channel.
uint32_t switch_core_session_flush_private_events(switch_core_session_t *session)
Flush the private event queue of a session.
switch_status_t switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event)
switch_status_t switch_ivr_hold_toggle_uuid(const char *uuid, const char *message, switch_bool_t moh)
Toggles channel hold state of session.
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
switch_status_t switch_core_session_dequeue_private_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event)
DE-Queue a private event on a given session.
switch_status_t switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
switch_call_cause_t switch_channel_str2cause(_In_ const char *str)
return a cause code for a given string
switch_time_t last_digit_time
#define SWITCH_IVR_VERIFY_SILENCE_DIVISOR(divisor)
struct profile_node_s * next
struct switch_caller_profile * origination_caller_profile
An abstraction of a data frame.
#define arg_recursion_check_start(_args)
#define switch_set_flag_locked(obj, flag)
Set a flag on an arbitrary object while locked.
void switch_caller_extension_add_application(_In_ switch_core_session_t *session, _In_ switch_caller_extension_t *caller_extension, _In_z_ const char *application_name, _In_z_ const char *extra_data)
Add an application (instruction) to the given extension.
switch_status_t switch_ivr_transfer_variable(switch_core_session_t *sessa, switch_core_session_t *sessb, char *var)
Transfer variables from one session to another.
static void *SWITCH_THREAD_FUNC media_thread_run(switch_thread_t *thread, void *obj)
switch_byte_t switch_byte_t uint32_t buflen
#define switch_core_codec_init(_codec, _codec_name, _modname, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool)
Initialize a codec handle.
const char * profile_index
void switch_cond_next(void)
uint32_t consecutive_flaws
struct switch_caller_profile * originator_caller_profile
#define SWITCH_STANDARD_STREAM(s)
const char * switch_channel_get_hold_music_partner(switch_channel_t *channel)
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)
switch_channel_callstate_t
switch_say_gender_t gender
switch_size_t packet_count
#define SWITCH_BRIDGE_VARIABLE
switch_caller_application_t * current_application
switch_caller_extension_t * switch_caller_extension_new(_In_ switch_core_session_t *session, _In_z_ const char *extension_name, _In_z_ const char *extension_number)
Create a new extension with desired parameters.
void * switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key)
Delete data from a hash based on desired key.
switch_mutex_t * flag_mutex
switch_status_t switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, void *data)
Set a digit string to action mapping.
#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.
void * switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t *stream, char digit)
Feed digits collected into the stream for event match testing.
switch_directories SWITCH_GLOBAL_dirs
#define add_stat_double(_x, _i, _s)
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
switch_size_t jb_packet_count
switch_status_t switch_ivr_parse_next_signal_data(switch_core_session_t *session)
switch_status_t switch_channel_set_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
uint32_t switch_channel_test_cap(switch_channel_t *channel, switch_channel_cap_t cap)
switch_size_t skip_packet_count
switch_status_t switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t **stream)
Create a new digit stream object.
#define switch_str_nil(s)
Make a null string a blank string instead.
switch_frame_t write_frame
void switch_jb_debug_level(switch_jb_t *jb, uint8_t level)
void switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
#define SWITCH_R_SDP_VARIABLE
uint32_t samples_per_packet
switch_status_t switch_ivr_3p_nomedia(const char *uuid, switch_media_flag_t flags)
switch_status_t switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
switch_status_t switch_ivr_activate_unicast(switch_core_session_t *session, char *local_ip, switch_port_t local_port, char *remote_ip, switch_port_t remote_port, char *transport, char *flags)
#define switch_clear_flag_locked(obj, flag)
Clear a flag on an arbitrary object.
uint8_t number_of_channels
uint32_t samples_per_second
switch_status_t switch_ivr_generate_json_cdr(switch_core_session_t *session, cJSON **json_cdr, switch_bool_t urlencode)
Generate an JSON CDR report.
switch_status_t
Common return values.
void * switch_channel_get_private(switch_channel_t *channel, const char *key)
Retrieve private from a given channel.
#define switch_goto_status(_status, _label)
const cJSON *const target
struct error_period * error_log
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_say_interface_t * switch_loadable_module_get_say_interface(const char *name)
Retrieve the say interface by it's registered name.
switch_status_t switch_ivr_unhold(switch_core_session_t *session)
Signal the session with a protocol specific unhold message.
#define SWITCH_SIGNAL_BOND_VARIABLE
switch_xml_t switch_xml_open_cfg(_In_z_ const char *file_path, _Out_ switch_xml_t *node, _In_opt_ switch_event_t *params)
open a config in the core registry
char * destination_number
void switch_channel_variable_last(switch_channel_t *channel)
Stop iterating over channel variables.
switch_status_t switch_socket_close(switch_socket_t *sock)
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_event_dup_reply(switch_event_t **event, switch_event_t *todup)
#define switch_core_hash_insert(_h, _k, _d)
switch_status_t switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how)
#define switch_core_session_locate(uuid_str)
Locate a session based on it's uuid.
char body[SWITCH_RTP_MAX_BUF_LEN+4+sizeof(char *)]
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
switch_status_t switch_ivr_parse_signal_data(switch_core_session_t *session, switch_bool_t all, switch_bool_t only_session_thread)
switch_size_t flush_packet_count
#define SWITCH_TEMP_HOLD_MUSIC_VARIABLE
unsigned int switch_hashfunc_default(const char *key, switch_ssize_t *klen)
void switch_uuid_get(switch_uuid_t *uuid)
switch_status_t switch_core_session_dequeue_message(_In_ switch_core_session_t *session, _Out_ switch_core_session_message_t **message)
DE-Queue an message on a given session.
void switch_channel_transfer_to_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
#define switch_event_get_header(_e, _h)
#define switch_channel_set_flag(_c, _f)
switch_xml_t switch_xml_child(_In_ switch_xml_t xml, _In_z_ const char *name)
returns the first child tag (one level deeper) with the given name or NULL \ if not found ...
switch_core_session_t * session
switch_size_t media_packet_count
switch_call_direction_t switch_channel_direction(switch_channel_t *channel)
switch_app_log_t * switch_core_session_get_app_log(_In_ switch_core_session_t *session)
struct switch_channel_timetable * times
int switch_ivr_set_xml_chan_vars(switch_xml_t xml, switch_channel_t *channel, int off)
#define SWITCH_TRANSFER_HISTORY_VARIABLE
time_t switch_epoch_time_now(time_t *t)
Get the current epoch time.
const char * caller_id_number
#define switch_core_session_alloc(_session, _memory)
Allocate memory from a session's pool.
uint32_t switch_media_flag_t
const char * switch_core_session_get_text_buffer(switch_core_session_t *session)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
void switch_ivr_check_hold(switch_core_session_t *session)
void switch_channel_clear_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
static switch_bool_t switch_core_codec_ready(switch_codec_t *codec)
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.
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)
A table of settings and callbacks that define a paticular implementation of a codec.
switch_channel_callstate_t switch_channel_get_callstate(switch_channel_t *channel)
struct fspr_pool_t switch_memory_pool_t
#define SWITCH_MAX_SESSION_TRANSFERS_VARIABLE
#define switch_core_session_strdup(_session, _todup)
Copy a string using memory allocation from a session's pool.
switch_status_t switch_ivr_deactivate_unicast(switch_core_session_t *session)
void switch_event_destroy(switch_event_t **event)
Destroy an event.
static void switch_ivr_set_json_chan_vars(cJSON *json, switch_channel_t *channel, switch_bool_t urlencode)
switch_status_t switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint32_t to, switch_channel_t *super_channel)
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
switch_status_t switch_ivr_signal_bridge(switch_core_session_t *session, switch_core_session_t *peer_session)
Bridge Signalling from one session to another.
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 ...
switch_status_t switch_ivr_3p_media(const char *uuid, switch_media_flag_t flags)
struct fspr_thread_t switch_thread_t
#define SWITCH_MAX_FORWARDS_VARIABLE
#define switch_channel_set_variable(_channel, _var, _val)
switch_status_t switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname, int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool)
switch_status_t switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t *xml_cdr)
Generate an XML CDR report.
#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.
#define switch_core_session_kill_channel(session, sig)
Send a signal to a channel.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
switch_status_t switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh)
Signal the session with a protocol specific hold message.
SWITCH_BEGIN_EXTERN_C char * switch_mprintf(const char *zFormat,...)
#define SWITCH_READ_ACCEPTABLE(status)
#define switch_channel_media_up(_channel)
switch_byte_t write_frame_data[SWITCH_RECOMMENDED_BUFFER_SIZE]
const char * callee_id_name
switch_bool_t switch_core_session_in_thread(switch_core_session_t *session)
void switch_ivr_set_json_call_stats(cJSON *json, switch_core_session_t *session, switch_media_type_t type)
switch_memory_pool_t * switch_core_session_get_pool(_In_ switch_core_session_t *session)
Retrieve the memory pool from a session.
switch_status_t switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t *parser)
Destroy a digit stream parser object.
#define SWITCH_UUID_FORMATTED_LENGTH
switch_event_header_t * headers
switch_memory_pool_t * pool
struct switch_app_log * next
struct switch_caller_extension * caller_extension
static void *SWITCH_THREAD_FUNC unicast_thread_run(switch_thread_t *thread, void *obj)
switch_status_t switch_thread_pool_launch_thread(switch_thread_data_t **tdp)
switch_size_t cng_packet_count
#define add_jstat(_j, _i, _s)
switch_status_t switch_ivr_parse_all_messages(switch_core_session_t *session)
switch_memory_pool_t * pool
uint32_t switch_core_session_stack_count(switch_core_session_t *session, int x)