35 #define QUOTED_ESC_COMMA 1
36 #define UNQUOTED_ESC_COMMA 2
80 originate_on_consume_media_transmit
166 if (!strcasecmp(collect->
key,
"exec")) {
168 char *app_name, *app_data;
170 if (!(data = collect->
file)) {
176 if ((app_data = strchr(app_name,
' '))) {
211 memset(buf, 0,
sizeof(buf));
229 if (!strcmp(collect->
key, buf)) {
260 int x = 0, i, delayed_channels = 0, active_channels = 0;
261 uint32_t early_exit_time = 0, delayed_min = 0;
265 for (i = 0; i < max; i++) {
268 if (originate_status[i].per_channel_delay_start) {
276 if (active_channels == 0 && delayed_channels) {
277 for (i = 0; i < max; i++) {
278 if (originate_status[i].peer_channel && originate_status[i].per_channel_delay_start &&
279 (!delayed_min || delayed_min > originate_status[i].per_channel_delay_start)) {
283 early_exit_time = delayed_min - (uint32_t) elapsed;
285 for (i = 0; i < max; i++) {
286 if (originate_status[i].peer_channel && originate_status[i].per_channel_delay_start &&
287 (elapsed > originate_status[i].per_channel_delay_start || active_channels == 0)) {
288 if (active_channels == 0) {
289 if (originate_status[i].per_channel_timelimit_sec) {
290 if (originate_status[i].per_channel_timelimit_sec > early_exit_time) {
297 if (originate_status[i].per_channel_progress_timelimit_sec) {
298 if (originate_status[i].per_channel_progress_timelimit_sec > early_exit_time) {
310 if (!originate_status[i].per_channel_delay_start) {
316 if (originate_status[i].per_channel_progress_timelimit_sec && elapsed > originate_status[i].per_channel_progress_timelimit_sec &&
326 if (originate_status[i].per_channel_timelimit_sec && elapsed > originate_status[i].per_channel_timelimit_sec) {
340 if (!strcmp(app,
"fail")) {
343 bd =
"monitor_early_media_fail";
348 }
else if (!strcmp(app,
"ring")) {
352 bd =
"monitor_early_media_ring";
389 if (!
zstr(var) && !strcasecmp(var,
"passthru")) {
418 "Error inheriting codec. Channel %s has no read codec yet.\n",
432 char bug_key[256] =
"";
433 int send_ringback = 0;
434 uint8_t ring_ready_val = 0;
444 caller_channel = NULL;
449 for (i = 0; i < len; i++) {
480 for (i = 0; i < len; i++) {
483 if (originate_status[i].tagged && originate_status[i].peer_session) {
490 for (j = 0; j < len; j++) {
494 oglobals->
hups = len;
505 if (!(originate_status[i].peer_channel && originate_status[i].peer_session)) {
511 if (!originate_status[i].ring_ready) {
512 originate_status[i].
ring_ready = ring_ready_val;
517 pindex = (uint32_t) i;
541 pindex = (uint32_t) i;
548 if (!originate_status[i].early_media) {
557 char *fail_array[128] = { 0 };
559 char *fail_data = strdup(var);
564 fail_count =
switch_separate_string(fail_data,
'!', fail_array, (
sizeof(fail_array) /
sizeof(fail_array[0])));
566 for (fx = 0; fx < fail_count; fx++) {
567 char *cause = fail_array[fx];
571 if (!(p = strchr(cause,
':'))) {
584 if (!(hits = atoi(p))) {
589 if (!(p = strchr(p,
':'))) {
600 for (q = p; q && *q; q++) {
605 switch_snprintf(bug_key,
sizeof(bug_key),
"monitor_early_media_fail_%d", ++y);
619 char *ring_array[128] = { 0 };
621 char *ring_data = strdup(var);
626 ring_count =
switch_separate_string(ring_data,
'!', ring_array, (
sizeof(ring_array) /
sizeof(ring_array[0])));
628 for (fx = 0; fx < ring_count; fx++) {
630 char *p = ring_array[fx], *q;
637 if (!(hits = atoi(p))) {
641 if (!(p = strchr(p,
':'))) {
652 for (q = p; q && *q; q++) {
659 switch_snprintf(bug_key,
sizeof(bug_key),
"monitor_early_media_ring_%d", ++y);
665 int tmp = atoi(var_total);
666 if (tmp > 0 && tmp < 100) {
768 pindex = (uint32_t) i;
776 pindex = (uint32_t) i;
781 if (oglobals->
hups > 0 && oglobals->
hups + pickups == len) {
789 if (rval == 0 && pickups) {
790 for (i = 0; i < len; i++) {
801 inherit_codec(caller_channel, originate_status[pindex].peer_session);
862 const char *ringback_data = NULL;
873 const char *cancel_key = NULL;
894 timelimit = atoi(var);
900 timelimit *= 1000000;
903 if (caller_channel) {
910 if (!ringback_data) {
915 ringback_data = NULL;
916 }
else if (
zstr(ringback_data)) {
918 int sval = atoi(var);
928 if (read_codec && ringback_data) {
937 if (!ringback.
asis) {
951 if (caller_channel) {
958 "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
961 write_frame.
codec = &write_codec;
970 ringback_data = NULL;
974 char *tmp_data = NULL;
980 write_frame.
codec = read_codec;
983 ringback_data = tmp_data;
999 ringback.
fh = &ringback.
fhb;
1001 if (!strncasecmp(ringback_data,
"silence", 7)) {
1002 const char *p = ringback_data + 7;
1022 ringback_data = NULL;
1032 if (caller_channel) {
1041 if (caller_channel && cancel_key) {
1045 if (dtmf.
digit == *cancel_key) {
1057 if (diff > timelimit) {
1071 if (read_frame && !pass) {
1075 unsigned int pos = 0;
1077 if (ringback.
asis) {
1096 "Failure to read or re-read after seeking to beginning on file [%s]\n", ringback.
fh->
file_path);
1107 }
else if (ringback.
silence) {
1173 const char *
import, *val;
1182 char *argv[64] = { 0 };
1185 for (i = 0; i < argc; i++) {
1207 char *tmp_data = NULL;
1213 inherit_codec(caller_channel, originate_status[0].peer_session);
1227 }
else if (oglobals->
bridge_early_media > -1 &&
zstr(ringback_data) && len == 1 && originate_status[0].peer_session) {
1233 if (read_impl.
impl_id == write_impl.impl_id &&
1243 write_impl.iananame, write_impl.actual_samples_per_second, write_impl.microseconds_per_packet / 1000);
1248 if (!ringback->
asis) {
1257 if (oglobals->
bridge_early_media > -1 &&
zstr(ringback_data) && len == 1 && originate_status[0].peer_session) {
1274 "Raw Codec Activation Success L16@%uhz %d channel %dms\n",
1276 write_frame->
codec = write_codec;
1291 if (
zstr(ringback_data)) {
1298 if (ringback->
asis) {
1299 write_frame->
codec = read_codec;
1302 ringback_data = tmp_data;
1324 ringback->
fh = &ringback->
fhb;
1326 }
else if (!strncasecmp(ringback_data,
"silence", 7)) {
1327 const char *c = ringback_data + 7;
1364 #define MAX_PEERS 128
1409 if (handle->
done != 2) {
1457 const
char *bridgeto,
1458 uint32_t timelimit_sec,
1460 const
char *cid_name_override,
1461 const
char *cid_num_override,
1488 if (
zstr(bridgeto)) {
1517 const char *tmp_var = NULL;
1539 while (data && *data && *data ==
' ') {
1545 while (*data ==
'<') {
1546 char *parsed = NULL;
1557 while (data && *data && *data ==
' ') {
1561 if (ovars && ovars != var_event) {
1562 for (hi = ovars->headers; hi; hi = hi->
next) {
1578 for (i = 0; i < x_argc; i++) {
1580 handles[i].bleg = NULL;
1581 handles[i].cause = 0;
1582 handles[i].cancel_cause = 0;
1583 handles[i].bridgeto = x_argv[i];
1584 handles[i].timelimit_sec = timelimit_sec;
1585 handles[i].table = table;
1586 handles[i].cid_name_override = cid_name_override;
1587 handles[i].cid_num_override = cid_num_override;
1588 handles[i].caller_profile_override = cp;
1590 handles[i].flags = flags;
1601 if (!ringback_data) {
1627 if (cancel_cause && *cancel_cause > 0) {
1631 for (i = 0; i < x_argc; i++) {
1634 if (handles[i].done == 0) {
1636 }
else if (handles[i].done == 1) {
1638 handles[i].done = 2;
1642 handles[i].
done = -1;
1651 if (!running || over == x_argc) {
1669 for (i = 0; i < x_argc; i++) {
1670 if (hp == &handles[i]) {
1674 if (cancel_cause && *cancel_cause > 0) {
1675 handles[i].cancel_cause = *cancel_cause;
1681 for (i = 0; i < x_argc; i++) {
1683 if (hp == &handles[i]) {
1694 *cause = handles[i].cause;
1702 if (channel && rb_data.
thread) {
1725 if (var_event && var_event != ovars) {
1754 int i, x,
ready = 0, answered = 0, ring_ready = 0;
1756 uint32_t datalen = 0;
1772 while (state->
ready) {
1774 memset(mux_data, 0,
sizeof(mux_data));
1816 data = (int16_t *) read_frame->
data;
1817 if (datalen < read_frame->datalen) {
1818 datalen = read_frame->
datalen;
1820 for (x = 0; x < (int) read_frame->
datalen / 2; x++) {
1821 sample = data[x] + mux_data[x];
1823 mux_data[x] = (int16_t) sample;
1829 datalen = read_frame->
datalen;
1836 if (!ready || answered || ring_ready) {
1845 uint16_t flen = (uint16_t)datalen;
1862 if (!session)
continue;
1883 #define peer_eligible(_peer) (_peer && !(switch_channel_test_flag(_peer, CF_TRANSFER) || \
1884 switch_channel_test_flag(_peer, CF_REDIRECT) || \
1885 switch_channel_test_flag(_peer, CF_BRIDGED) || \
1886 switch_channel_get_state(_peer) == CS_RESET || \
1887 !switch_channel_test_flag(_peer, CF_ORIGINATING)))
1903 const
char *bridgeto,
1904 uint32_t timelimit_sec,
1906 const
char *cid_name_override,
1907 const
char *cid_num_override,
1920 char *chan_type = NULL, *chan_data;
1925 int r = 0, i, and_argc = 0, or_argc = 0;
1926 int32_t sleep_ms = 1000,
try = 0, retries = 1;
1934 const char *ringback_data = NULL;
1936 int8_t fail_on_single_reject = 0;
1937 int8_t hangup_on_single_reject = 0;
1938 char *fail_on_single_reject_var = NULL;
1939 char *loop_data = NULL;
1940 uint32_t progress_timelimit_sec = 0;
1941 const char *cid_tmp, *lc;
1944 int local_clobber = 0;
1945 const char *cancel_key = NULL;
1946 const char *holding = NULL;
1947 const char *soft_holding = NULL;
1949 int read_packet = 0;
1950 int check_reject = 1;
1952 const char *ani_override = NULL;
1953 const char *aniii_override = NULL;
1954 const char *ent_aleg_uuid = NULL;
1969 caller_profile_override, ovars, flags, cancel_cause);
1975 oglobals.
file = NULL;
1979 if (caller_profile_override) {
1981 }
else if (session) {
1990 const char *to_var, *bypass_media = NULL, *proxy_media = NULL, *zrtp_passthru = NULL;
2000 timelimit_sec = atoi(to_var);
2007 if (!
zstr(proxy_media)) {
2015 if (!
zstr(zrtp_passthru)) {
2027 msg.
from = __FILE__;
2049 "Channel is already up, delaying proxy mode 'till both legs are answered.\n");
2056 if (timelimit_sec <= 0) {
2069 odata = strdup(bridgeto);
2095 if (caller_channel) {
2100 while (data && *data && *data ==
' ') {
2114 while (*data ==
'<') {
2115 char *parsed = NULL;
2128 while (*data ==
'{') {
2129 char *parsed = NULL;
2141 while (data && *data && *data ==
' ') {
2152 int tmp = atoi(var);
2154 while (tmp && (!cancel_cause || *cancel_cause == 0)) {
2163 const char *cdr_total_var;
2164 const char *cdr_var;
2165 const char *json_cdr_var;
2171 int tmp = atoi(cdr_total_var);
2182 int tmp = atoi(cdr_total_var);
2191 for (; hi; hi = hi->
next) {
2193 if (!strcasecmp((
char *) hi->
name,
"group_confirm_key")) {
2195 }
else if (!strcasecmp((
char *) hi->
name,
"group_confirm_file")) {
2197 }
else if (!strcasecmp((
char *) hi->
name,
"group_confirm_read_timeout")) {
2199 }
else if (!strcasecmp((
char *) hi->
name,
"group_confirm_cancel_timeout")) {
2201 }
else if (!strcasecmp((
char *) hi->
name,
"forked_dial")) {
2203 }
else if (!strcasecmp((
char *) hi->
name,
"fail_on_single_reject")) {
2205 }
else if (!strcasecmp((
char *) hi->
name,
"hangup_on_single_reject")) {
2207 }
else if (!strcasecmp((
char *) hi->
name,
"ignore_early_media")) {
2209 }
else if (!strcasecmp((
char *) hi->
name,
"bridge_early_media")) {
2211 }
else if (!strcasecmp((
char *) hi->
name,
"originate_continue_on_timeout")) {
2213 }
else if (!strcasecmp((
char *) hi->
name,
"ignore_ring_ready")) {
2215 }
else if (!strcasecmp((
char *) hi->
name,
"monitor_early_media_ring")) {
2217 }
else if (!strcasecmp((
char *) hi->
name,
"monitor_early_media_ring_total")) {
2219 }
else if (!strcasecmp((
char *) hi->
name,
"monitor_early_media_fail")) {
2221 }
else if (!strcasecmp((
char *) hi->
name,
"return_ring_ready")) {
2223 }
else if (!strcasecmp((
char *) hi->
name,
"ring_ready")) {
2225 }
else if (!strcasecmp((
char *) hi->
name,
"instant_ringback")) {
2227 }
else if (!strcasecmp((
char *) hi->
name,
"progress_timeout")) {
2229 }
else if (!strcasecmp((
char *) hi->
name,
"language")) {
2252 if (caller_channel) {
2253 ringback_data = NULL;
2260 if (!ringback_data) {
2268 ringback_data = NULL;
2273 if (ringback_data) {
2285 oglobals.
file = strdup(var);
2291 int tmp = atoi(var);
2310 fail_on_single_reject_var = strdup(var);
2314 fail_on_single_reject = 1;
2316 fail_on_single_reject = -1;
2320 if ((!
zstr(oglobals.
file)) && (!strcmp(oglobals.
file,
"undef"))) {
2322 oglobals.
file = NULL;
2340 }
else if (!strcmp(var_val,
"consume")) {
2343 }
else if (!strcmp(var_val,
"ring_ready")) {
2380 int tmp = atoi(var_val);
2382 timelimit_sec = (uint32_t) tmp;
2387 int tmp = atoi(var_val);
2389 progress_timelimit_sec = (uint32_t) tmp;
2395 tmp = atoi(var_val);
2396 if (tmp > 0 && tmp < 101) {
2400 "Invalid originate_retries setting of %d ignored, value must be between 1 and 100\n", tmp);
2406 tmp = atoi(var_val);
2407 if (tmp >= 500 && tmp <= 60000) {
2411 "Invalid originate_retry_sleep_ms setting of %d ignored, value must be between 500 and 60000\n", tmp);
2420 cid_name_override = cid_tmp;
2423 if (cid_name_override) {
2432 cid_num_override = cid_tmp;
2435 if (cid_num_override) {
2451 if (aniii_override) {
2455 if (cid_num_override) {
2459 if (cid_name_override) {
2463 if (!progress_timelimit_sec) {
2464 progress_timelimit_sec = timelimit_sec;
2467 for (
try = 0;
try < retries;
try++) {
2469 loop_data = strdup(data);
2471 or_argc =
switch_separate_string(loop_data,
'|', pipe_names, (
sizeof(pipe_names) /
sizeof(pipe_names[0])));
2473 if ((flags & SOF_NOBLOCK) && or_argc > 1) {
2478 for (r = 0; r < or_argc && (!cancel_cause || *cancel_cause == 0); r++) {
2479 char *p, *end = NULL;
2487 memset(peer_names, 0,
sizeof(peer_names));
2488 peer_session = NULL;
2489 memset(originate_status, 0,
sizeof(originate_status));
2494 peer_channel = NULL;
2508 if (caller_channel) {
2527 if (*(p+1) ==
'^' && *(p + 2) ==
'^') {
2539 if (end && p < end && *p ==
',' && *(p-1) !=
'\\') {
2555 and_argc =
switch_separate_string(pipe_names[r],
',', peer_names, (
sizeof(peer_names) /
sizeof(peer_names[0])));
2557 if ((flags & SOF_NOBLOCK) && and_argc > 1) {
2562 for (i = 0; i < and_argc; i++) {
2563 const char *current_variable;
2564 switch_event_t *local_var_event = NULL, *originate_var_event = NULL;
2568 chan_type = peer_names[i];
2572 while (chan_type && *chan_type && *chan_type ==
' ') {
2578 if (*chan_type ==
'[') {
2583 while (*chan_type ==
'[') {
2584 char *parsed = NULL;
2587 for (p = chan_type + 1; p && p < bend && *p; p++) {
2599 if (chan_type == parsed) {
2609 while (chan_type && *chan_type && *chan_type ==
' ') {
2613 if ((chan_data = strchr(chan_type,
'/')) != 0) {
2630 cid_name_override, cid_num_override, NULL, ani_override, aniii_override, NULL, __FILE__, NULL, chan_data);
2640 if (aniii_override) {
2643 if (cid_name_override) {
2646 if (cid_num_override) {
2656 if (!cid_name_override) {
2659 if (!cid_num_override) {
2666 cid_name_override, cid_num_override, NULL, ani_override, aniii_override, NULL, __FILE__, NULL, chan_data);
2683 if (and_argc > 1 || or_argc > 1) {
2706 if (local_var_event) {
2758 new_profile, &new_session, NULL, myflags, cancel_cause);
2766 if (fail_on_single_reject_var) {
2768 int neg = *fail_on_single_reject_var ==
'!';
2769 int pos = !!
switch_stristr(cause_str, fail_on_single_reject_var);
2777 if (fail_on_single_reject == 1 || pos) {
2778 force_reason = reason;
2798 if (caller_channel) {
2803 if (local_var_event) {
2816 if (local_var_event) {
2822 if (local_clobber) {
2826 for (header = var_event->
headers; header; header = header->
next) {
2833 if (local_var_event) {
2835 for (header = local_var_event->
headers; header; header = header->
next) {
2841 if (!local_clobber) {
2845 for (header = var_event->
headers; header; header = header->
next) {
2851 if (originate_status[i].peer_channel) {
2855 originate_status[i].
tagged = 1;
2871 int val = atoi(vvar);
2881 int val = atoi(vvar);
2890 int val = atoi(vvar);
2896 if (originate_status[i].per_channel_progress_timelimit_sec != 0) {
2900 if (originate_status[i].per_channel_timelimit_sec != 0) {
2906 if (!
zstr(ent_aleg_uuid)) {
2908 a_session = l_session;
2945 if ((flags & SOF_NOBLOCK) && originate_status[i].peer_session) {
2953 if (originate_status[i].per_channel_delay_start) {
2963 uint32_t valid_channels = 0;
2964 for (i = 0; i < and_argc; i++) {
2968 if (!originate_status[i].peer_channel) {
2990 if (elapsed > (time_t) timelimit_sec) {
2997 !oglobals.
progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
3012 if (valid_channels == 0) {
3021 if (caller_channel) {
3024 ringback_data = NULL;
3031 if (ringback_data) {
3036 if (ringback_data) {
3042 if (caller_channel) {
3052 if (cancel_cause && *cancel_cause > 0) {
3054 force_reason = *cancel_cause;
3066 if (!oglobals.
sent_ring && !oglobals.
progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
3074 if ((to = (uint8_t) (elapsed >= (time_t) timelimit_sec)) || (fail_on_single_reject && oglobals.
hups)) {
3077 if (fail_on_single_reject_var) {
3081 for (i = 0; i < and_argc; i++) {
3083 const char *cause_str;
3085 if (!originate_status[i].peer_session) {
3093 neg = *fail_on_single_reject_var ==
'!';
3125 if (caller_channel && cancel_key) {
3129 if (dtmf.
digit == *cancel_key) {
3161 rst =
setup_ringback(&oglobals, originate_status, and_argc, ringback_data, &ringback, &write_frame, &write_codec);
3169 early_state.
ready = 1;
3171 early_state.
ttl = and_argc;
3190 ringback_data = NULL;
3202 if (ringback.
asis) {
3205 if (buflen >
sizeof(uint16_t)) {
3207 if (buflen >= (mlen +
sizeof(uint16_t))) {
3219 }
else if (ringback.
fh) {
3221 unsigned int pos = 0;
3223 if (ringback.
asis) {
3247 write_frame.
samples = (uint32_t) olen;
3262 }
else if (ringback.
silence) {
3297 if (caller_channel) {
3302 holding = soft_holding;
3303 soft_holding = NULL;
3322 }
else if (and_argc == 1) {
3327 for (i = 0; i < and_argc; i++) {
3338 for (i = 0; i < and_argc; i++) {
3355 peer_session = NULL;
3356 peer_channel = NULL;
3362 const char *dest = NULL;
3363 const char *context = NULL;
3364 const char *dialplan = NULL;
3367 if (caller_channel) {
3368 if (
zstr(context)) {
3371 if (
zstr(dialplan)) {
3376 if (
zstr(context)) {
3377 context =
"default";
3380 if (
zstr(context)) {
3388 if (caller_channel) {
3399 }
else if (caller_channel) {
3409 holding_session = NULL;
3419 }
else if (
zstr(soft_holding)) {
3439 caller_channel = NULL;
3461 peer_session = NULL;
3462 peer_channel = NULL;
3465 for (i = 0; i < and_argc; i++) {
3470 if (i != oglobals.
idx) {
3492 if (caller_channel && i == 0) {
3536 if (caller_channel && peer_channel) {
3539 peer_channel = NULL;
3543 if (caller_channel) {
3573 *bleg = peer_session;
3594 if (caller_channel) {
3612 const char *cdr_var = NULL;
3613 const char *json_cdr_var = NULL;
3616 cJSON *json_cdr = NULL;
3620 char buf[128] =
"", buf2[128] =
"";
3622 if (caller_channel) {
3626 if (caller_channel) {
3634 for (i = 0; i < and_argc; i++) {
3635 if (!originate_status[i].peer_channel) {
3644 for (i = 0; i < and_argc; i++) {
3647 if (!originate_status[i].peer_session) {
3676 for (i = 0; i < and_argc; i++) {
3679 if (!originate_status[i].peer_session) {
3693 switch_snprintf(buf,
sizeof(buf),
"%s_%d", json_cdr_var, ++cdr_total);
3713 }
else if (caller_channel) {
3717 for (i = 0; i < and_argc; i++) {
3756 if (caller_channel) {
3782 early_state.
ready = 0;
3789 if (early_state.
buffer) {
3810 for (i = 0; i < and_argc; i++) {
3815 if (!originate_status[i].peer_channel) {
3829 if (bleg && *bleg && *bleg == originate_status[i].peer_session) {
3858 if (fail_on_single_reject && check_reject && !
switch_true(fail_on_single_reject_var)) {
3859 for (i = 0; i < and_argc; i++) {
3861 const char *cause_str;
3863 if (!originate_status[i].down_session) {
3875 neg = *fail_on_single_reject_var ==
'!';
3914 if (bleg && *bleg) {
3917 if (session && caller_channel) {
3942 if (caller_channel) {
3955 if (var_event && var_event != ovars) {
3963 *cause = force_reason;
3966 if (caller_channel) {
3974 if (hangup_on_single_reject) {
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)
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
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.
#define SWITCH_CHANNEL_SESSION_LOG(x)
const char * ringback_data
int monitor_early_media_ring_total
char * switch_xml_toxml(_In_ switch_xml_t xml, _In_ switch_bool_t prn_header)
Converts an switch_xml structure back to xml in html format. Returns a string of html data that \ mus...
#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
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
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_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
#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_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)
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)
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_core_media_bug_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session)
originate_status_t * originate_status
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.
#define SWITCH_ZRTP_PASSTHRU_VARIABLE
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 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.
static int switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
uint32_t switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Test for presence of given flag on a given channel.
switch_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
static char * switch_strchr_strict(const char *in, char find, const char *allowed)
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_thread_join(switch_status_t *retval, switch_thread_t *thd)
switch_status_t switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
_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)
const switch_codec_implementation_t * implementation
if((uint32_t)(unpack->cur-unpack->buf) > unpack->buflen)
switch_byte_t switch_byte_t * buf
#define SWITCH_SOFT_HOLDING_UUID_VARIABLE
#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_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)
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.
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.
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_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_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.
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.
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)
#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.
void switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t orig_channels, uint32_t channels)
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 ...
uint32_t samples_per_packet
uint8_t number_of_channels
uint8_t ignore_ring_ready
struct apr_thread_mutex_t switch_mutex_t
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
#define SWITCH_SIGNAL_BOND_VARIABLE
char * destination_number
void switch_channel_variable_last(switch_channel_t *channel)
Stop iterating over channel variables.
static int check_per_channel_timeouts(originate_global_t *oglobals, originate_status_t *originate_status, int max, time_t start, switch_call_cause_t *force_reason)
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.
struct apr_thread_t switch_thread_t
#define switch_core_session_locate(uuid_str)
Locate a session based on it's uuid.
int switch_channel_state_change_pending(switch_channel_t *channel)
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)
#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_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
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.
struct apr_pool_t switch_memory_pool_t
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.
#define switch_normalize_to_16bit(n)
static int switch_false(const char *expr)
Evaluate the falsefullness of a string expression.
#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_status_t switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
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.
#define switch_channel_set_variable(_channel, _var, _val)
switch_file_handle_t * fh
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_channel_api_on(switch_channel_t *channel, const char *variable_prefix)
void switch_buffer_destroy(switch_buffer_t **buffer)
Destroy the buffer.
void cJSON_Delete(cJSON *c)
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)
SWITCH_BEGIN_EXTERN_C char * switch_mprintf(const char *zFormat,...)
#define SWITCH_READ_ACCEPTABLE(status)
static uint8_t check_channel_status(originate_global_t *oglobals, originate_status_t *originate_status, uint32_t len, switch_call_cause_t *force_reason)
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_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)
Make an outgoing call.
char * cJSON_PrintUnformatted(cJSON *item)
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
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
void switch_channel_handle_cause(switch_channel_t *channel, switch_call_cause_t cause)