35 #define QUOTED_ESC_COMMA 1 36 #define UNQUOTED_ESC_COMMA 2 80 originate_on_consume_media_transmit
204 if (!strcasecmp(collect->
key,
"exec")) {
206 char *app_name, *app_data;
208 if (!(data = collect->
file)) {
214 if ((app_data = strchr(app_name,
' '))) {
250 memset(buf, 0,
sizeof(buf));
268 if (!strcmp(collect->
key, buf)) {
300 int x = 0, i, delayed_channels = 0, active_channels = 0;
301 uint32_t early_exit_time = 0, delayed_min = 0;
305 for (i = 0; i < max; i++) {
316 if (active_channels == 0 && delayed_channels) {
317 for (i = 0; i < max; i++) {
324 early_exit_time = delayed_min - (uint32_t)(
switch_time_t) elapsed;
327 for (i = 0; i < max; i++) {
330 if (active_channels == 0) {
385 if (!strcmp(app,
"fail")) {
388 bd =
"monitor_early_media_fail";
393 }
else if (!strcmp(app,
"ring")) {
397 bd =
"monitor_early_media_ring";
434 if (!
zstr(var) && !strcasecmp(var,
"passthru")) {
463 "Error inheriting codec. Channel %s has no read codec yet.\n",
477 char bug_key[256] =
"";
478 int send_ringback = 0;
479 uint8_t ring_ready_val = 0;
480 int pickups_without_timelimit = 0;
489 caller_channel = NULL;
494 for (i = 0; i < len; i++) {
525 for (i = 0; i < len; i++) {
535 for (j = 0; j < len; j++) {
539 oglobals->
hups = len;
548 pickups_without_timelimit++;
564 pindex = (uint32_t) i;
588 pindex = (uint32_t) i;
604 char *fail_array[128] = { 0 };
606 char *fail_data = strdup(var);
611 fail_count =
switch_separate_string(fail_data,
'!', fail_array, (
sizeof(fail_array) /
sizeof(fail_array[0])));
613 for (fx = 0; fx < fail_count; fx++) {
614 char *cause = fail_array[fx];
618 if (!(p = strchr(cause,
':'))) {
631 if (!(hits = atoi(p))) {
636 if (!(p = strchr(p,
':'))) {
647 for (q = p; q && *q; q++) {
652 switch_snprintf(bug_key,
sizeof(bug_key),
"monitor_early_media_fail_%d", ++y);
666 char *ring_array[128] = { 0 };
668 char *ring_data = strdup(var);
673 ring_count =
switch_separate_string(ring_data,
'!', ring_array, (
sizeof(ring_array) /
sizeof(ring_array[0])));
675 for (fx = 0; fx < ring_count; fx++) {
677 char *p = ring_array[fx], *q;
684 if (!(hits = atoi(p))) {
688 if (!(p = strchr(p,
':'))) {
699 for (q = p; q && *q; q++) {
706 switch_snprintf(bug_key,
sizeof(bug_key),
"monitor_early_media_ring_%d", ++y);
712 int tmp = atoi(var_total);
713 if (tmp > 0 && tmp < 100) {
773 pickups_without_timelimit--;
787 if (!
zstr(oglobals->
key) || !
zstr(group_confirm_key)) {
790 int extend_timeout = 0;
791 int cancel_timeout = 0;
794 extend_timeout = atoi(group_confirm_timeout);
795 if (extend_timeout == 0) {
802 if (extend_timeout > 0) {
816 if (!
zstr(group_confirm_key)) {
822 if (!
zstr(group_confirm_file)) {
843 pindex = (uint32_t) i;
857 pindex = (uint32_t) i;
862 if (oglobals->
hups > 0 && oglobals->
hups + pickups_without_timelimit == len) {
871 if (rval == 0 && pickups_without_timelimit) {
872 for (i = 0; i < len; i++) {
947 const char *ringback_data = NULL;
958 const char *cancel_key = NULL;
979 timelimit = atoi(var);
985 timelimit *= 1000000;
988 if (caller_channel) {
995 if (!ringback_data) {
1000 ringback_data = NULL;
1001 }
else if (
zstr(ringback_data)) {
1003 int sval = atoi(var);
1013 if (read_codec && ringback_data) {
1022 if (!ringback.
asis) {
1036 if (caller_channel) {
1043 "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
1046 write_frame.
codec = &write_codec;
1055 ringback_data = NULL;
1058 if (ringback_data) {
1059 char *tmp_data = NULL;
1064 if (ringback.
asis) {
1065 write_frame.
codec = read_codec;
1068 ringback_data = tmp_data;
1084 ringback.
fh = &ringback.
fhb;
1086 if (!strncasecmp(ringback_data,
"silence", 7)) {
1087 const char *p = ringback_data + 7;
1107 ringback_data = NULL;
1117 if (caller_channel) {
1126 if (caller_channel && cancel_key) {
1130 if (dtmf.
digit == *cancel_key) {
1142 if (diff > timelimit) {
1156 if (read_frame && !pass) {
1158 if (!write_frame.
codec) {
1165 unsigned int pos = 0;
1167 if (ringback.
asis) {
1186 "Failure to read or re-read after seeking to beginning on file [%s]\n", ringback.
fh->
file_path);
1197 }
else if (ringback.
silence) {
1263 const char *
import, *val;
1272 char *argv[64] = { 0 };
1275 for (i = 0; i < argc; i++) {
1297 char *tmp_data = NULL;
1303 inherit_codec(caller_channel, originate_status[0].peer_session);
1317 }
else if (oglobals->
bridge_early_media > -1 &&
zstr(ringback_data) && len == 1 && originate_status[0].peer_session) {
1323 if (read_impl.
impl_id == write_impl.impl_id &&
1333 write_impl.iananame, write_impl.actual_samples_per_second, write_impl.microseconds_per_packet / 1000);
1338 if (!ringback->
asis) {
1347 if (oglobals->
bridge_early_media > -1 &&
zstr(ringback_data) && len == 1 && originate_status[0].peer_session) {
1364 "Raw Codec Activation Success L16@%uhz %d channel %dms\n",
1366 write_frame->
codec = write_codec;
1381 if (
zstr(ringback_data)) {
1388 if (ringback->
asis) {
1389 write_frame->
codec = read_codec;
1392 ringback_data = tmp_data;
1414 ringback->
fh = &ringback->
fhb;
1416 }
else if (!strncasecmp(ringback_data,
"silence", 7)) {
1417 const char *c = ringback_data + 7;
1518 if (handle->
done != 2) {
1570 const char *bridgeto,
1571 uint32_t timelimit_sec,
1573 const char *cid_name_override,
1574 const char *cid_num_override,
1633 const char *tmp_var = NULL;
1655 while (data && *data && *data ==
' ') {
1661 while (data && *data ==
'<') {
1662 char *parsed = NULL;
1676 while (data && *data && *data ==
' ') {
1680 if (ovars && ovars != var_event) {
1701 for (i = 0; i < x_argc; i++) {
1703 handles[i].bleg = NULL;
1704 handles[i].cause = 0;
1705 handles[i].cancel_cause = 0;
1706 handles[i].bridgeto = x_argv[i];
1707 handles[i].timelimit_sec = timelimit_sec;
1708 handles[i].table = table;
1709 handles[i].cid_name_override = cid_name_override;
1710 handles[i].cid_num_override = cid_num_override;
1711 handles[i].caller_profile_override = cp;
1713 handles[i].flags = flags;
1728 if (!ringback_data) {
1754 if (cancel_cause && *cancel_cause > 0) {
1758 for (i = 0; i < x_argc; i++) {
1761 if (handles[i].done == 0) {
1763 }
else if (handles[i].done == 1) {
1765 handles[i].done = 2;
1770 handles[i].done = -1;
1781 if (!running || over == x_argc) {
1812 for (i = 0; i < x_argc; i++) {
1813 if (hp == &handles[i]) {
1817 if (cancel_cause && *cancel_cause > 0) {
1818 handles[i].cancel_cause = *cancel_cause;
1831 for (i = 0; i < x_argc; i++) {
1833 if (hp == &handles[i]) {
1844 *cause = handles[i].cause;
1853 if (channel && rb_data.
thread) {
1876 if (var_event && var_event != ovars) {
1901 uint8_t array_pos = 0;
1905 int i, x,
ready = 0, answered = 0, ring_ready = 0;
1907 uint32_t datalen = 0;
1925 originate_status[array_pos].
array_pos = (uint8_t) i;
1934 while (state->
ready) {
1936 memset(mux_data, 0,
sizeof(mux_data));
1940 for (array_pos = 0; array_pos <
MAX_PEERS && originate_status[array_pos].
peer_session; array_pos++) {
1943 i = originate_status[array_pos].
array_pos;
1979 data = (int16_t *) read_frame->
data;
1980 if (datalen < read_frame->datalen) {
1981 datalen = read_frame->
datalen;
1983 for (x = 0; x < (int) read_frame->
datalen / 2; x++) {
1984 sample = data[x] + mux_data[x];
1986 mux_data[x] = (int16_t) sample;
1992 datalen = read_frame->
datalen;
1999 if (!ready || answered || ring_ready) {
2008 uint16_t flen = (uint16_t)datalen;
2021 for (array_pos = 0; array_pos <
MAX_PEERS && originate_status[array_pos].
peer_session; array_pos++) {
2024 i = originate_status[array_pos].
array_pos;
2026 if (!session)
continue;
2047 #define peer_eligible(_peer) (_peer && !(switch_channel_test_flag(_peer, CF_TRANSFER) || \ 2048 switch_channel_test_flag(_peer, CF_REDIRECT) || \ 2049 switch_channel_test_flag(_peer, CF_BRIDGED) || \ 2050 switch_channel_get_state(_peer) == CS_RESET || \ 2051 !switch_channel_test_flag(_peer, CF_ORIGINATING))) 2067 const char *bridgeto,
2068 uint32_t timelimit_sec,
2070 const char *cid_name_override,
2071 const char *cid_num_override,
2087 char *chan_type = NULL, *chan_data;
2090 time_t start, global_start;
2093 int r = 0, i, and_argc = 0, or_argc = 0;
2094 int32_t sleep_ms = 1000,
try = 0, retries = 1, retry_timelimit_sec = 0;
2095 int32_t min_retry_period_ms = sleep_ms;
2103 const char *ringback_data = NULL;
2105 int8_t fail_on_single_reject = 0;
2106 int8_t hangup_on_single_reject = 0;
2107 char *fail_on_single_reject_var = NULL;
2108 char *loop_data = NULL;
2109 uint32_t progress_timelimit_sec = 0;
2110 const char *cid_tmp, *lc;
2113 int local_clobber = 0;
2114 const char *cancel_key = NULL;
2115 const char *holding = NULL;
2116 const char *soft_holding = NULL;
2118 int read_packet = 0;
2119 int check_reject = 1;
2121 const char *ani_override = NULL;
2122 const char *aniii_override = NULL;
2123 const char *ent_aleg_uuid = NULL;
2127 if (!bridgeto || dh) {
2143 caller_profile_override, ovars, flags, cancel_cause, NULL);
2149 oglobals.
file = NULL;
2153 if (caller_profile_override) {
2155 }
else if (session) {
2164 const char *to_var, *bypass_media = NULL, *proxy_media = NULL;
2174 timelimit_sec = atoi(to_var);
2180 if (!
zstr(proxy_media)) {
2192 msg.
from = __FILE__;
2214 "Channel is already up, delaying proxy mode 'till both legs are answered.\n");
2221 if (timelimit_sec <= 0) {
2234 odata = strdup(bridgeto);
2260 if (caller_channel) {
2265 while (data && *data && *data ==
' ') {
2278 if (var_event && var_event != ovars) {
2288 while (*data ==
'<') {
2289 char *parsed = NULL;
2302 while (*data ==
'{') {
2303 char *parsed = NULL;
2319 while (data && *data && *data ==
' ') {
2323 if (
zstr(data) && !dh) {
2330 int tmp = atoi(var);
2332 while (tmp && (!cancel_cause || *cancel_cause == 0)) {
2341 const char *cdr_total_var;
2342 const char *cdr_var;
2343 const char *json_cdr_var;
2355 int tmp = atoi(cdr_total_var);
2366 int tmp = atoi(cdr_total_var);
2375 for (; hi; hi = hi->
next) {
2377 if (!strcasecmp((
char *) hi->
name,
"group_confirm_key")) {
2379 }
else if (!strcasecmp((
char *) hi->
name,
"group_confirm_file")) {
2381 }
else if (!strcasecmp((
char *) hi->
name,
"group_confirm_read_timeout")) {
2383 }
else if (!strcasecmp((
char *) hi->
name,
"group_confirm_cancel_timeout")) {
2385 }
else if (!strcasecmp((
char *) hi->
name,
"group_confirm_timeout")) {
2387 }
else if (!strcasecmp((
char *) hi->
name,
"forked_dial")) {
2389 }
else if (!strcasecmp((
char *) hi->
name,
"fail_on_single_reject")) {
2391 }
else if (!strcasecmp((
char *) hi->
name,
"hangup_on_single_reject")) {
2393 }
else if (!strcasecmp((
char *) hi->
name,
"ignore_early_media")) {
2395 }
else if (!strcasecmp((
char *) hi->
name,
"bridge_early_media")) {
2397 }
else if (!strcasecmp((
char *) hi->
name,
"originate_continue_on_timeout")) {
2399 }
else if (!strcasecmp((
char *) hi->
name,
"ignore_ring_ready")) {
2401 }
else if (!strcasecmp((
char *) hi->
name,
"monitor_early_media_ring")) {
2403 }
else if (!strcasecmp((
char *) hi->
name,
"monitor_early_media_ring_total")) {
2405 }
else if (!strcasecmp((
char *) hi->
name,
"monitor_early_media_fail")) {
2407 }
else if (!strcasecmp((
char *) hi->
name,
"return_ring_ready")) {
2409 }
else if (!strcasecmp((
char *) hi->
name,
"ring_ready")) {
2411 }
else if (!strcasecmp((
char *) hi->
name,
"instant_ringback")) {
2413 }
else if (!strcasecmp((
char *) hi->
name,
"progress_timeout")) {
2415 }
else if (!strcasecmp((
char *) hi->
name,
"language")) {
2438 if (caller_channel) {
2439 ringback_data = NULL;
2446 if (!ringback_data) {
2454 ringback_data = NULL;
2459 if (ringback_data) {
2483 oglobals.
file = strdup(var);
2489 int tmp = atoi(var);
2508 fail_on_single_reject_var = strdup(var);
2512 fail_on_single_reject = 1;
2514 fail_on_single_reject = -1;
2518 if ((!
zstr(oglobals.
file)) && (!strcmp(oglobals.
file,
"undef"))) {
2520 oglobals.
file = NULL;
2538 }
else if (!strcmp(var_val,
"consume")) {
2541 }
else if (!strcmp(var_val,
"ring_ready")) {
2578 int tmp = atoi(var_val);
2580 timelimit_sec = (uint32_t) tmp;
2585 int tmp = atoi(var_val);
2587 progress_timelimit_sec = (uint32_t) tmp;
2593 tmp = atoi(var_val);
2595 retry_timelimit_sec = tmp;
2598 "Invalid originate_retry_timeout setting of %s ignored, value must be > 0\n", var_val);
2604 tmp = atoi(var_val);
2606 if (tmp > 0 && (retry_timelimit_sec > 0 || tmp < 101)) {
2610 "Invalid originate_retries setting of %d ignored, value must be between 1 and 100\n", tmp);
2616 tmp = atoi(var_val);
2617 if (tmp >= 500 && tmp <= 60000) {
2621 "Invalid originate_retry_sleep_ms setting of %d ignored, value must be between 500 and 60000\n", tmp);
2627 tmp = atoi(var_val);
2628 if (tmp >= 500 && tmp <= 300000) {
2629 min_retry_period_ms = tmp;
2632 "Invalid originate_retry_min_period_ms setting of %d ignored, value must be between 500 and 300000\n", tmp);
2641 cid_name_override = cid_tmp;
2644 if (cid_name_override) {
2653 cid_num_override = cid_tmp;
2656 if (cid_num_override) {
2672 if (aniii_override) {
2676 if (cid_num_override) {
2680 if (cid_name_override) {
2684 if (!progress_timelimit_sec) {
2685 progress_timelimit_sec = timelimit_sec;
2691 for (
try = 0;
try < retries;
try++) {
2697 if (retry_timelimit_sec > 0) {
2698 if (elapsed > retry_timelimit_sec) {
2702 }
else if (cancel_cause && *cancel_cause != 0) {
2712 if (min_retry_period_ms > sleep_ms) {
2713 int64_t retry_sleep_ms = min_retry_period_ms - sleep_ms - ((
switch_micro_time_now() - last_retry_start) / 1000);
2714 if (retry_sleep_ms > 0 && retry_sleep_ms <= 300000) {
2716 if (caller_channel) {
2730 loop_data = strdup(data);
2736 or_argc =
switch_separate_string(loop_data,
'|', pipe_names, (
sizeof(pipe_names) /
sizeof(pipe_names[0])));
2739 if ((flags & SOF_NOBLOCK) && or_argc > 1) {
2749 for (r = 0; r < or_argc && (!cancel_cause || *cancel_cause == 0); r++) {
2750 char *p, *end = NULL;
2758 memset(peer_names, 0,
sizeof(peer_names));
2759 peer_session = NULL;
2765 peer_channel = NULL;
2779 if (caller_channel) {
2801 if (!end && *p ==
'[') {
2803 if (*(p+1) ==
'^' && *(p + 2) ==
'^') {
2815 if (end && p < end && *p ==
',' && *(p-1) !=
'\\') {
2831 and_argc =
switch_separate_string(pipe_names[r],
',', peer_names, (
sizeof(peer_names) /
sizeof(peer_names[0])));
2837 if ((flags & SOF_NOBLOCK) && and_argc > 1) {
2842 for (i = 0; i < and_argc; i++) {
2843 const char *current_variable;
2844 switch_event_t *local_var_event = NULL, *originate_var_event = NULL;
2848 if (!(chan_type = peer_names[i])) {
2855 while (chan_type && *chan_type && *chan_type ==
' ') {
2861 if (*chan_type ==
'[') {
2866 while (*chan_type ==
'[') {
2867 char *parsed = NULL;
2870 for (p = chan_type + 1; p && p < bend && *p; p++) {
2882 if (chan_type == parsed) {
2891 if (local_var_event) {
2899 peer_names[i], event_string);
2905 while (chan_type && *chan_type && *chan_type ==
' ') {
2909 if ((chan_data = strchr(chan_type,
'/')) != 0) {
2927 cid_name_override, cid_num_override, NULL, ani_override, aniii_override, NULL, __FILE__, NULL, chan_data);
2937 if (aniii_override) {
2940 if (cid_name_override) {
2943 if (cid_num_override) {
2953 if (!cid_name_override) {
2956 if (!cid_num_override) {
2963 cid_name_override, cid_num_override, NULL, ani_override, aniii_override, NULL, __FILE__, NULL, chan_data);
2980 if (and_argc > 1 || or_argc > 1) {
3003 if (local_var_event) {
3055 new_profile, &new_session, NULL, myflags, cancel_cause);
3063 if (fail_on_single_reject_var) {
3065 int neg = *fail_on_single_reject_var ==
'!';
3066 int pos = !!
switch_stristr(cause_str, fail_on_single_reject_var);
3074 if (fail_on_single_reject == 1 || pos) {
3075 force_reason = reason;
3095 if (caller_channel) {
3100 if (local_var_event) {
3113 if (local_var_event) {
3119 if (local_clobber) {
3123 for (header = var_event->
headers; header; header = header->
next) {
3130 if (local_var_event) {
3132 for (header = local_var_event->
headers; header; header = header->
next) {
3138 if (!local_clobber) {
3142 for (header = var_event->
headers; header; header = header->
next) {
3168 int val = atoi(vvar);
3178 int val = atoi(vvar);
3187 int val = atoi(vvar);
3203 if (!
zstr(ent_aleg_uuid)) {
3205 a_session = l_session;
3261 uint32_t valid_channels = 0;
3262 for (i = 0; i < and_argc; i++) {
3288 if (elapsed > (time_t) timelimit_sec) {
3295 !oglobals.
progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
3310 if (valid_channels == 0) {
3319 if (caller_channel) {
3322 ringback_data = NULL;
3329 if (ringback_data) {
3334 if (ringback_data) {
3340 if (caller_channel) {
3349 if (cancel_cause && *cancel_cause > 0) {
3351 force_reason = *cancel_cause;
3363 if (!oglobals.
sent_ring && !oglobals.
progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
3371 if ((to = (uint8_t) (elapsed >= (time_t) timelimit_sec)) || (fail_on_single_reject && oglobals.
hups)) {
3374 if (fail_on_single_reject_var) {
3378 for (i = 0; i < and_argc; i++) {
3380 const char *cause_str;
3390 neg = *fail_on_single_reject_var ==
'!';
3423 if (caller_channel && cancel_key) {
3427 if (dtmf.
digit == *cancel_key) {
3467 early_state.
ready = 1;
3469 early_state.
ttl = and_argc;
3488 ringback_data = NULL;
3500 if (ringback.
asis) {
3503 if (buflen >
sizeof(uint16_t)) {
3505 if (buflen >= (mlen +
sizeof(uint16_t))) {
3517 }
else if (ringback.
fh) {
3519 unsigned int pos = 0;
3521 if (ringback.
asis) {
3545 write_frame.
samples = (uint32_t) olen;
3560 }
else if (ringback.
silence) {
3595 if (caller_channel) {
3600 holding = soft_holding;
3601 soft_holding = NULL;
3620 }
else if (and_argc == 1) {
3625 for (i = 0; i < and_argc; i++) {
3636 for (i = 0; i < and_argc; i++) {
3653 peer_session = NULL;
3654 peer_channel = NULL;
3660 const char *dest = NULL;
3661 const char *context = NULL;
3662 const char *dialplan = NULL;
3665 if (caller_channel) {
3666 if (
zstr(context)) {
3669 if (
zstr(dialplan)) {
3674 if (
zstr(context)) {
3675 context =
"default";
3678 if (
zstr(context)) {
3686 if (caller_channel) {
3697 }
else if (caller_channel) {
3707 holding_session = NULL;
3717 }
else if (
zstr(soft_holding)) {
3737 caller_channel = NULL;
3759 peer_session = NULL;
3760 peer_channel = NULL;
3763 for (i = 0; i < and_argc; i++) {
3768 if (i != oglobals.
idx) {
3790 if (caller_channel && i == 0) {
3834 if (caller_channel && peer_channel) {
3837 peer_channel = NULL;
3841 if (caller_channel) {
3879 *bleg = peer_session;
3900 if (caller_channel) {
3918 const char *cdr_var = NULL;
3919 const char *json_cdr_var = NULL;
3922 cJSON *json_cdr = NULL;
3926 char buf[128] =
"", buf2[128] =
"";
3928 if (caller_channel) {
3932 if (caller_channel) {
3940 for (i = 0; i < and_argc; i++) {
3950 for (i = 0; i < and_argc; i++) {
3982 for (i = 0; i < and_argc; i++) {
3998 json_text = cJSON_PrintUnformatted(json_cdr);
3999 switch_snprintf(buf,
sizeof(buf),
"%s_%d", json_cdr_var, ++cdr_total);
4002 cJSON_Delete(json_cdr);
4019 }
else if (caller_channel) {
4023 for (i = 0; i < and_argc; i++) {
4062 if (caller_channel) {
4088 early_state.
ready = 0;
4095 if (early_state.
buffer) {
4116 for (i = 0; i < and_argc; i++) {
4164 if (fail_on_single_reject && check_reject && !
switch_true(fail_on_single_reject_var)) {
4165 for (i = 0; i < and_argc; i++) {
4167 const char *cause_str;
4181 neg = *fail_on_single_reject_var ==
'!';
4220 if (bleg && *bleg) {
4223 if (session && caller_channel) {
4248 if (caller_channel) {
4261 if (var_event && var_event != ovars) {
4269 *cause = force_reason;
4272 if (caller_channel) {
4280 if (hangup_on_single_reject) {
4383 if (!todup || !handle) {
4397 for (j = 0; j < ll_todup->
leg_idx; j++) {
4470 *leg_listP = leg_list;
4584 for (i = 0; i < max && handle->
leg_lists[idx]->
legs[i]; i++) {
4598 for (i = 0; i < max && handle->
leg_lists[idx]->
legs[i]; i++) {
4630 *json = cJSON_CreateObject();
4633 cJSON_AddItemToObject(*json, hp->
name, cJSON_CreateString(hp->
value));
4642 cJSON *vars_json = NULL;
4643 *json = cJSON_CreateObject();
4645 cJSON_AddStringToObject(*json,
"dial_string", leg->
dial_string);
4648 cJSON_AddItemToObject(*json,
"vars", vars_json);
4657 cJSON *legs_json = cJSON_CreateArray();
4658 *json = cJSON_CreateObject();
4659 cJSON_AddItemToObject(*json,
"legs", legs_json);
4660 for (i = 0; i < ll->
leg_idx; i++) {
4662 cJSON *leg_json = NULL;
4664 cJSON_AddItemToArray(legs_json, leg_json);
4674 cJSON *global_vars_json = NULL;
4675 cJSON *leg_lists_json = NULL;
4679 *json = cJSON_CreateObject();
4681 cJSON_AddItemToObject(*json,
"vars", global_vars_json);
4684 leg_lists_json = cJSON_CreateArray();
4685 cJSON_AddItemToObject(*json,
"leg_lists", leg_lists_json);
4688 cJSON *leg_list_json = NULL;
4690 cJSON_AddItemToArray(leg_lists_json, leg_list_json);
4702 *str = cJSON_PrintUnformatted(json);
4712 cJSON *vars_json = NULL;
4713 cJSON *var_json = NULL;
4714 cJSON *leg_lists_json = NULL;
4720 leg_lists_json = cJSON_GetObjectItem(json,
"leg_lists");
4722 cJSON *leg_list_json = NULL;
4724 cJSON *legs_json = cJSON_GetObjectItem(leg_list_json,
"legs");
4725 cJSON *leg_json = NULL;
4733 const char *dial_string = NULL;
4743 vars_json = cJSON_GetObjectItem(leg_json,
"vars");
4756 vars_json = cJSON_GetObjectItem(json,
"vars");
4772 cJSON *handle_json = NULL;
4774 if (
zstr(handle_string)) {
4778 handle_json = cJSON_Parse(handle_string);
4784 cJSON_Delete(handle_json);
4792 cJSON *global_vars_json = NULL;
4793 cJSON *handles_json = NULL;
4797 *json = cJSON_CreateObject();
4799 cJSON_AddItemToObject(*json,
"vars", global_vars_json);
4802 handles_json = cJSON_CreateArray();
4803 cJSON_AddItemToObject(*json,
"handles", handles_json);
4806 cJSON *handle_json = NULL;
4808 cJSON_AddItemToArray(handles_json, handle_json);
4820 *str = cJSON_PrintUnformatted(json);
4830 cJSON *handle_json = NULL;
4831 cJSON *handles_json = NULL;
4832 cJSON *vars_json = NULL;
4836 handles_json = cJSON_GetObjectItem(handle_list_json,
"handles");
4837 if (!handles_json || !cJSON_IsArray(handles_json)) {
4842 for (handle_json = handles_json->
child; handle_json; handle_json = handle_json->
next) {
4851 char *handle_json_str = cJSON_PrintUnformatted(handle_json);
4857 if ((*hl)->handle_idx == 0) {
4863 vars_json = cJSON_GetObjectItem(handle_list_json,
"vars");
4865 cJSON *var_json = NULL;
4881 cJSON *handle_list_json = NULL;
4883 if (
zstr(handle_list_string)) {
4887 handle_list_json = cJSON_Parse(handle_list_string);
4888 if (!handle_list_json) {
4893 cJSON_Delete(handle_list_json);
4900 char *str = (
char *) buf;
4904 if (strchr(str, dtmf->
digit)) {
4921 cause, data, 0, NULL, NULL, NULL, NULL, NULL,
SOF_NONE, NULL, hl)) !=
SWITCH_STATUS_SUCCESS) {
4984 cause, data, 0, NULL, NULL, NULL, NULL, NULL,
SOF_NONE, NULL, dh)) !=
SWITCH_STATUS_SUCCESS) {
switch_time_t switch_micro_time_now(void)
Get the current epoch time in microseconds.
#define SWITCH_DEFAULT_CLID_NUMBER
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_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it's state machine to end.
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)
static int check_per_channel_timeouts(originate_global_t *oglobals, int max, time_t start, switch_call_cause_t *force_reason)
switch_memory_pool_t * pool
switch_memory_pool_t * pool
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
static switch_status_t leg_serialize_json_obj(switch_dial_leg_t *leg, cJSON **json)
A module interface to implement an application.
switch_call_cause_t cancel_cause
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.
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
#define SWITCH_CHANNEL_SESSION_LOG(x)
const char * ringback_data
int monitor_early_media_ring_total
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
switch_status_t switch_channel_set_timestamps(_In_ switch_channel_t *channel)
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_memory_pool_t * pool
char * switch_find_end_paren(const char *s, char open, char close)
switch_caller_profile_t * caller_profile
switch_status_t switch_ivr_gentones(switch_core_session_t *session, const char *script, int32_t loops, switch_input_args_t *args)
#define switch_event_del_header(_e, _h)
switch_core_session_t * down_session
static char * switch_sanitize_number(char *number)
#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.
const char * switch_channel_cause2str(_In_ switch_call_cause_t cause)
return a cause string for a given cause
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.
#define SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_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.
teletone_generation_session_t ts
uint8_t ignore_early_media
struct switch_dial_handle_s * handle
teletone_audio_t * buffer
switch_channel_t * peer_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_channel_up(_channel)
unsigned int switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen)
#define SWITCH_RECOMMENDED_BUFFER_SIZE
switch_status_t switch_ivr_enterprise_originate(switch_core_session_t *session, switch_core_session_t **bleg, switch_call_cause_t *cause, const char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, const char *cid_name_override, const char *cid_num_override, switch_caller_profile_t *caller_profile_override, switch_event_t *ovars, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause, switch_dial_handle_list_t *hl)
switch_status_t switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup)
#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
struct switch_dial_leg_s * next
#define UNQUOTED_ESC_COMMA
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
#define SWITCH_CALL_TIMEOUT_VARIABLE
#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
static void *SWITCH_THREAD_FUNC enterprise_originate_thread(switch_thread_t *thread, void *obj)
Representation of an event.
#define switch_channel_ready(_channel)
uint8_t return_ring_ready
switch_status_t switch_core_session_read_lock(_In_ switch_core_session_t *session)
Acquire a read lock on the session.
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.
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.
#define SWITCH_PROXY_MEDIA_VARIABLE
#define switch_channel_media_ready(_channel)
static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_t *session)
uint32_t per_channel_timelimit_sec
switch_status_t switch_core_session_exec(_In_ switch_core_session_t *session, _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg)
Execute an application on a session.
int teletone_destroy_session(teletone_generation_session_t *ts)
Free the buffer allocated by a tone generation session.
switch_bool_t switch_is_number(const char *str)
switch_thread_t * ethread
int monitor_early_media_ring_count
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
A representation of an XML tree.
switch_call_cause_t switch_core_session_outgoing_channel(_In_opt_ switch_core_session_t *session, _In_opt_ switch_event_t *var_event, _In_z_ const char *endpoint_name, _In_ switch_caller_profile_t *caller_profile, _Inout_ switch_core_session_t **new_session, _Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
Request an outgoing session spawned from an existing session using a desired endpoing module...
switch_status_t switch_core_codec_destroy(switch_codec_t *codec)
Destroy an initalized codec handle.
#define switch_core_session_get_name(_s)
static void *SWITCH_THREAD_FUNC enterprise_originate_ringback_thread(switch_thread_t *thread, void *obj)
uint32_t switch_originate_flag_t
switch_caller_profile_t * switch_caller_profile_new(_In_ switch_memory_pool_t *pool, _In_opt_z_ const char *username, _In_opt_z_ const char *dialplan, _In_opt_z_ const char *caller_id_name, _In_opt_z_ const char *caller_id_number, _In_opt_z_ const char *network_addr, _In_opt_z_ const char *ani, _In_opt_z_ const char *aniii, _In_opt_z_ const char *rdnis, _In_opt_z_ const char *source, _In_opt_z_ const char *context, _In_opt_z_ const char *destination_number)
Create a new caller profile object.
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_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.
static switch_thread_t * thread
#define switch_channel_ring_ready_value(channel, _rv)
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
static switch_status_t switch_dial_handle_list_add_handle(switch_dial_handle_list_t *hl, switch_dial_handle_t *handle)
static void wait_for_cause(switch_channel_t *channel)
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.
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.
switch_codec_t * switch_core_session_get_write_codec(_In_ switch_core_session_t *session)
Retrieve the write codec from a given session.
A message object designed to allow unlike technologies to exchange data.
#define SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE
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_DEFAULT_CLID_NAME
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.
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)
int teletone_run(teletone_generation_session_t *ts, const char *cmd)
Execute a tone generation script and call callbacks after each instruction.
switch_status_t switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
_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.
#define UNPROTECT_INTERFACE(_it)
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE
int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
Initilize a tone generation session.
#define SWITCH_MUTEX_NESTED
static switch_status_t originate_on_routing(switch_core_session_t *session)
switch_size_t switch_buffer_toss(_In_ switch_buffer_t *buffer, _In_ switch_size_t datalen)
Remove data from the buffer.
const switch_state_handler_table_t * table
switch_call_cause_t cause
#define SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE
switch_status_t switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on)
originate_status_t originate_status[MAX_PEERS]
const switch_codec_implementation_t * implementation
switch_byte_t switch_byte_t * buf
#define SWITCH_SOFT_HOLDING_UUID_VARIABLE
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)
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_status_t switch_ivr_multi_threaded_bridge(_In_ switch_core_session_t *session, _In_ switch_core_session_t *peer_session, switch_input_callback_function_t dtmf_callback, void *session_data, void *peer_session_data)
Bridge Audio from one session to another.
#define SWITCH_DEFAULT_TIMEOUT
switch_application_interface_t * switch_loadable_module_get_application_interface(const char *name)
Retrieve the application interface by it's registered name.
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_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel, switch_event_t *var_event, const char *export_varname)
#define peer_eligible(_peer)
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)
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
uint32_t actual_samples_per_second
switch_core_session_t * session
void switch_buffer_set_loops(_In_ switch_buffer_t *buffer, _In_ int32_t loops)
Assign a number of loops to read.
#define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE
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_BYPASS_MEDIA_VARIABLE
#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_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.
uint32_t switch_core_session_messages_waiting(switch_core_session_t *session)
uint32_t per_channel_progress_timelimit_sec
switch_status_t switch_channel_caller_extension_masquerade(switch_channel_t *orig_channel, switch_channel_t *new_channel, uint32_t offset)
#define switch_zmalloc(ptr, len)
switch_core_session_t * bleg
switch_core_session_t * session
switch_size_t switch_buffer_read_loop(_In_ switch_buffer_t *buffer, _In_ void *data, _In_ switch_size_t datalen)
Read data endlessly from a switch_buffer_t.
static switch_status_t o_bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
const char * caller_id_name
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
switch_status_t switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid)
Bridge two existing sessions.
static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void *obj)
#define switch_channel_ring_ready(channel)
Send Ringing message to a channel.
switch_status_t(* switch_input_callback_function_t)(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *buf, unsigned int buflen)
switch_dial_handle_t * dh
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
#define SWITCH_BLANK_STRING
switch_application_function_t application_function
#define SWITCH_ENT_ORIGINATE_DELIM
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
#define switch_channel_down_nosig(_channel)
switch_core_session_t * session
#define SWITCH_IVR_VERIFY_SILENCE_DIVISOR(divisor)
An abstraction of a data frame.
switch_event_t * global_vars
static void launch_collect_thread(struct key_collect *collect)
switch_status_t switch_ivr_stop_tone_detect_session(switch_core_session_t *session)
Stop looking for TONES.
int switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap)
void switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's originator caller profile.
const char * cJSON_GetObjectCstr(const cJSON *object, const char *string)
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.
void switch_cond_next(void)
const char * cid_num_override
switch_status_t switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
int microseconds_per_packet
char * switch_core_get_variable(_In_z_ const char *varname)
Retrieve a global variable from the core.
void switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
void switch_channel_restart(switch_channel_t *channel)
char * switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size)
static switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id)
char * switch_channel_get_uuid(switch_channel_t *channel)
Retrieve the given channel's unique id.
#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.
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
switch_caller_profile_flag_t flags
switch_status_t switch_channel_set_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
switch_bool_t cancel_timeout
#define switch_str_nil(s)
Make a null string a blank string instead.
switch_status_t switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, switch_call_cause_t *cause, const char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, const char *cid_name_override, const char *cid_num_override, switch_caller_profile_t *caller_profile_override, switch_event_t *ovars, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause, switch_dial_handle_t *dh)
Make an outgoing call.
struct fspr_thread_mutex_t switch_mutex_t
void switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t orig_channels, uint32_t channels)
static int switch_channel_var_true(switch_channel_t *channel, const char *variable)
switch_caller_profile_t * caller_profile_override
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.
switch_core_session_t * peer_session
#define SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE
unsigned int switch_core_session_running(_In_ switch_core_session_t *session)
determine if the session's state machine is running
static switch_status_t setup_ringback(originate_global_t *oglobals, originate_status_t *originate_status, int len, const char *ringback_data, ringback_t *ringback, switch_frame_t *write_frame, switch_codec_t *write_codec)
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
switch_event_t * leg_vars
uint32_t samples_per_packet
static switch_status_t vars_serialize_json_obj(switch_event_t *event, cJSON **json)
uint8_t number_of_channels
uint8_t ignore_ring_ready
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.
uint32_t per_channel_delay_start
#define SWITCH_HOLDING_UUID_VARIABLE
void * switch_channel_get_private(switch_channel_t *channel, const char *key)
Retrieve private from a given channel.
#define switch_goto_status(_status, _label)
originate_global_t * oglobals
static switch_status_t leg_list_serialize_json_obj(switch_dial_leg_list_t *ll, cJSON **json)
#define SWITCH_SIGNAL_BOND_VARIABLE
char * destination_number
void switch_channel_variable_last(switch_channel_t *channel)
Stop iterating over channel variables.
void switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's originatee caller profile.
#define SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE
switch_size_t switch_channel_has_dtmf(_In_ switch_channel_t *channel)
Test for presence of DTMF on a given channel.
#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)
switch_caller_profile_t * caller_profile_override
#define SWITCH_B_SDP_VARIABLE
switch_size_t switch_buffer_peek(_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, without removing re...
switch_buffer_t * audio_buffer
uint32_t encoded_bytes_per_packet
static switch_bool_t switch_is_file_path(const char *file)
struct switch_dial_handle_s * handle
#define switch_event_get_header(_e, _h)
#define switch_channel_set_flag(_c, _f)
switch_status_t switch_channel_set_name(switch_channel_t *channel, const char *name)
Assign a name to a given channel.
An abstraction to store a tone generation session.
switch_mutex_t * fence_mutex
switch_status_t switch_core_session_wake_session_thread(_In_ switch_core_session_t *session)
#define SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE
switch_caller_profile_t * switch_caller_profile_dup(_In_ switch_memory_pool_t *pool, _In_ switch_caller_profile_t *tocopy)
Duplicate an existing caller profile object.
switch_core_session_t * session
time_t switch_epoch_time_now(time_t *t)
Get the current epoch time.
const char * caller_id_number
#define SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE
static switch_status_t switch_dial_handle_dup(switch_dial_handle_t **handle, switch_dial_handle_t *todup)
int switch_channel_add_state_handler(switch_channel_t *channel, const switch_state_handler_table_t *state_handler)
add a state handler table to a given channel
#define switch_core_session_alloc(_session, _memory)
Allocate memory from a session's pool.
uint8_t monitor_early_media_ring
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
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.
const char * switch_stristr(const char *instr, const char *str)
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_status_t switch_ivr_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session)
#define switch_normalize_to_16bit(n)
static int switch_false(const char *expr)
Evaluate the falsefullness of a string expression.
struct fspr_pool_t switch_memory_pool_t
#define switch_channel_up_nosig(_channel)
#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_event_t * global_vars
switch_status_t switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
switch_dial_leg_list_t * leg_lists[MAX_PEERS]
static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *obj)
static switch_bool_t monitor_callback(switch_core_session_t *session, const char *app, const char *data)
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.
struct fspr_thread_t switch_thread_t
#define switch_channel_set_variable(_channel, _var, _val)
switch_file_handle_t * fh
#define cJSON_ArrayForEach(element, array)
switch_dial_handle_t * handles[MAX_PEERS]
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.
switch_originate_flag_t flags
static switch_status_t originate_on_consume_media_transmit(switch_core_session_t *session)
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_event_serialize(switch_event_t *event, char **str, switch_bool_t encode)
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_status_t switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel)
static uint8_t check_channel_status(originate_global_t *oglobals, uint32_t len, switch_call_cause_t *force_reason, time_t start)
SWITCH_BEGIN_EXTERN_C char * switch_mprintf(const char *zFormat,...)
#define SWITCH_READ_ACCEPTABLE(status)
#define switch_channel_media_up(_channel)
static const switch_state_handler_table_t originate_state_handlers
#define SWITCH_CHANNEL_CHANNEL_LOG(x)
const char * callee_id_name
const char * cid_name_override
switch_memory_pool_t * switch_core_session_get_pool(_In_ switch_core_session_t *session)
Retrieve the memory pool from a session.
switch_event_header_t * headers
static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
#define SWITCH_EXPORT_VARS_VARIABLE
switch_call_cause_t switch_channel_get_cause(_In_ switch_channel_t *channel)
return the cause code for a given channel
#define switch_xml_toxml(xml, prn_header)
Converts an switch_xml structure back to xml in html format. Returns a string of html data that \ mus...
switch_status_t switch_core_session_thread_launch(_In_ switch_core_session_t *session)
Launch the session thread (state machine) on a given session.
switch_status_t switch_ivr_parse_all_messages(switch_core_session_t *session)
switch_memory_pool_t * pool
uint8_t monitor_early_media_fail
switch_dial_leg_t * legs[MAX_PEERS]
void switch_channel_handle_cause(switch_channel_t *channel, switch_call_cause_t cause)