39 #include <sofia-sip/sdp.h>
40 #include <sofia-sip/su.h>
48 #define MAX_CODEC_CHECK_FRAMES 50//x:mod_sofia.h
49 #define MAX_MISMATCH_FRAMES 5//x:mod_sofia.h
50 #define type2str(type) type == SWITCH_MEDIA_TYPE_VIDEO ? "video" : "audio"
51 #define VIDEO_REFRESH_FREQ 1000000
258 if (!strncasecmp(str, SUITES[i].name, strlen(SUITES[i].name))) {
259 return SUITES[i].
type;
270 return SUITES[type].
name;
277 return SUITES[type].
keylen;
303 return dft ? dft : 1;
318 "Deciding whether to pass zrtp-hash between a-leg and b-leg\n");
322 "CF_ZRTP_PASSTHRU_REQ not set on a-leg, so not propagating zrtp-hash\n");
347 if (!(smh = session->media_handle)) {
369 video_globals.
fps = fps;
409 if (!session->media_handle)
return NULL;
411 engine = &session->media_handle->engines[type];
428 sdp_attribute_t *attr;
429 int got_audio = 0, got_video = 0;
438 for (m = sdp->sdp_media; m; m = m->m_next) {
439 if (got_audio && got_video)
break;
440 if (m->m_port && ((m->m_type == sdp_media_audio && !got_audio)
441 || (m->m_type == sdp_media_video && !got_video))) {
442 for (attr = m->m_attributes; attr; attr = attr->a_next) {
443 if (
zstr(attr->a_name))
continue;
444 if (strcasecmp(attr->a_name,
"zrtp-hash") || !(attr->a_value))
continue;
445 if (m->m_type == sdp_media_audio) {
447 "Found audio zrtp-hash; setting r_sdp_audio_zrtp_hash=%s\n", attr->a_value);
451 }
else if (m->m_type == sdp_media_video) {
453 "Found video zrtp-hash; setting r_sdp_video_zrtp_hash=%s\n", attr->a_value);
469 sdp_attribute_t *attr;
487 if (sdp->sdp_origin) {
493 if (m->m_connections && m->m_connections->c_address) {
495 }
else if (sdp->sdp_connection && sdp->sdp_connection->c_address) {
499 for (attr = m->m_attributes; attr; attr = attr->a_next) {
500 if (!strcasecmp(attr->a_name,
"T38FaxVersion") && attr->a_value) {
502 }
else if (!strcasecmp(attr->a_name,
"T38MaxBitRate") && attr->a_value) {
504 }
else if (!strcasecmp(attr->a_name,
"T38FaxFillBitRemoval")) {
506 }
else if (!strcasecmp(attr->a_name,
"T38FaxTranscodingMMR")) {
508 }
else if (!strcasecmp(attr->a_name,
"T38FaxTranscodingJBIG")) {
510 }
else if (!strcasecmp(attr->a_name,
"T38FaxRateManagement") && attr->a_value) {
512 }
else if (!strcasecmp(attr->a_name,
"T38FaxMaxBuffer") && attr->a_value) {
514 }
else if (!strcasecmp(attr->a_name,
"T38FaxMaxDatagram") && attr->a_value) {
516 }
else if (!strcasecmp(attr->a_name,
"T38FaxUdpEC") && attr->a_value) {
518 }
else if (!strcasecmp(attr->a_name,
"T38VendorInfo") && attr->a_value) {
543 if (!(smh = session->media_handle)) {
575 if (!(smh = session->media_handle)) {
587 sdp_parser_t *parser = NULL;
591 if (!(parser = sdp_parse(NULL, r_sdp, (
int) strlen(r_sdp), 0))) {
595 if (!(sdp = sdp_session(parser))) {
596 sdp_parser_free(parser);
600 for (m = sdp->sdp_media; m; m = m->m_next) {
601 if (m->m_proto == sdp_proto_udptl && m->m_type == sdp_media_image && m->m_port) {
607 sdp_parser_free(parser);
627 if (!(smh = session->media_handle)) {
642 "Audio params are unchanged for %s.\n",
645 const char *err = NULL;
648 "Audio params changed for %s from %s:%d to %s:%d\n",
670 const
char *iananame,
685 if (!(smh = session->media_handle)) {
696 if (!strcasecmp(pmap->
iananame, iananame) && (!rate || (rate == pmap->
rate))) {
714 if (!
zstr(fmtp) && fmtpP) {
746 if (!(smh = session->media_handle)) {
755 exists = (!strcasecmp(name, pmap->
iananame) && pmap->
pt == pt && (!pmap->
rate || rate == pmap->
rate) && (!pmap->
ptime || pmap->
ptime == ptime));
760 if (strcmp(pmap->
rm_fmtp, fmtp)) {
844 const char *preferred = NULL, *fallback = NULL;
849 if (!(smh = session->media_handle)) {
870 return !
zstr(preferred) ? preferred : fallback;
878 const char *vars[] = {
"rtp_last_audio_local_crypto_key",
879 "srtp_remote_audio_crypto_key",
880 "srtp_remote_audio_crypto_tag",
881 "srtp_remote_audio_crypto_type",
882 "srtp_remote_video_crypto_key",
883 "srtp_remote_video_crypto_tag",
884 "srtp_remote_video_crypto_type",
886 "rtp_secure_media_inbound",
887 "rtp_secure_media_outbound",
890 for(i = 0; vars[i] ;i++) {
894 if (!(smh = session->media_handle)) {
906 if (!session->media_handle) {
910 return session->media_handle->engines[type].ssec[session->media_handle->engines[type].crypto_type].local_crypto_key;
1032 unsigned char b64_key[512] =
"";
1074 p = strrchr((
char *) b64_key,
'=');
1076 while (p && *p && *p ==
'=') {
1111 p = strchr(key_str,
' ');
1113 if (p && *p && *(p + 1)) {
1124 if (p && *p && *(p + 1)) {
1126 if (strncasecmp(p,
"inline:", 7)) {
1154 if (!session->media_handle)
return;
1155 engine = &session->media_handle->engines[type];
1157 engine->
type = type;
1165 char *keyvar, *tagvar, *ctypevar;
1171 keyvar =
"srtp_remote_audio_crypto_key";
1172 tagvar =
"srtp_remote_audio_crypto_tag";
1173 ctypevar =
"srtp_remote_audio_crypto_type";
1175 keyvar =
"srtp_remote_video_crypto_key";
1176 tagvar =
"srtp_remote_video_crypto_tag";
1177 ctypevar =
"srtp_remote_video_crypto_type";
1202 const char *varname;
1205 varname =
"rtp_secure_audio_confirmed";
1207 varname =
"rtp_secure_video_confirmed";
1244 const char *var = NULL;
1245 const char *val = NULL;
1246 char *suites = NULL;
1249 int argc = 0, i = 0, j = 0, k = 0;
1260 var =
"rtp_secure_media_inbound";
1262 var =
"rtp_secure_media_outbound";
1266 var =
"rtp_secure_media";
1270 if (!
zstr(val) && (suites = strchr(val,
':'))) {
1286 if (!strcasecmp(val,
"optional")) {
1288 }
else if (
switch_true(val) || !strcasecmp(val,
"mandatory")) {
1292 if (!
switch_false(val) && strcasecmp(val,
"forbidden")) {
1300 for (i = 0; i < argc; i++) {
1304 if (!strcasecmp(fields[i], SUITES[j].name)) {
1326 const
char *varname,
1332 const char *vval = NULL;
1336 if (!(smh = session->media_handle)) {
1348 engine = &session->media_handle->engines[type];
1356 ctype = SUITES[j].
type;
1357 vval = SUITES[j].
name;
1385 if (a && b && !strncasecmp(a, b, 23)) {
1460 if (!(smh = session->media_handle)) {
1484 #define add_stat(_i, _s) \
1485 switch_snprintf(var_name, sizeof(var_name), "rtp_%s_%s", switch_str_nil(prefix), _s) ; \
1486 switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \
1487 switch_channel_set_variable(channel, var_name, var_val)
1489 #define add_stat_double(_i, _s) \
1490 switch_snprintf(var_name, sizeof(var_name), "rtp_%s_%s", switch_str_nil(prefix), _s) ; \
1491 switch_snprintf(var_val, sizeof(var_val), "%0.2f", _i); \
1492 switch_channel_set_variable(channel, var_name, var_val)
1499 char var_name[256] =
"", var_val[35] =
"";
1545 if (!(smh = session->media_handle)) {
1565 if (!session->media_handle) {
1584 if (!(smh = session->media_handle)) {
1629 if (
zstr(params->sdp_username)) {
1630 params->sdp_username =
"FreeSWITCH";
1635 session->media_handle->
session = session;
1664 session->media_handle->mparams = params;
1666 if (!session->media_handle->mparams->video_key_freq) {
1667 session->media_handle->mparams->video_key_freq = 10000000;
1670 if (!session->media_handle->mparams->video_key_first) {
1671 session->media_handle->mparams->video_key_first = 1000000;
1710 smh->media_flags[flag] = 1;
1721 smh->media_flags[i] = flags[i];
1731 smh->media_flags[flag] = 0;
1737 return smh->media_flags[flag];
1748 if (!(smh = session->media_handle)) {
1757 flow = engine->
smode;
1778 return session->media_handle;
1786 if (!session->media_handle) {
1796 return smh->mparams;
1801 const char *abs, *codec_string = NULL;
1802 const char *ocodec = NULL, *val;
1804 char *tmp_codec_string;
1808 if (!(smh = session->media_handle)) {
1836 codec_string = ocodec;
1845 if (codec_string && *codec_string ==
'=') {
1852 codec_string = ocodec;
1855 codec_string = ocodec;
1862 if (!codec_string) {
1863 codec_string =
"PCMU@20i,PCMA@20i,speex@20i";
1894 if (!strcasecmp(input,
"pause")) {
1897 }
else if (!strcasecmp(input,
"resume")) {
1900 }
else if (!strcasecmp(input,
"stop")) {
1903 }
else if (!strncasecmp(input,
"debug:", 6)) {
1905 if (s && !strcmp(s,
"off")) {
1915 if (v_engine->rtp_session) {
1916 if (!strncasecmp(input,
"vbsize:", 7)) {
1917 int frames = 0, max_frames = 0;
1922 if ((s = strchr(s,
':')) && *(s+1) !=
'\0') {
1923 max_frames = atoi(s+1);
1930 }
else if (!strncasecmp(input,
"vdebug:", 7)) {
1933 if (s && !strcmp(s,
"off")) {
1947 jb_msec = atoi(val);
1949 if (strchr(val,
'p') && jb_msec > 0) {
1953 if ((p = strchr(val,
':'))) {
1957 if (strchr(p,
'p') && maxlen > 0) {
1963 if (jb_msec < 0 && jb_msec > -1000) {
1967 if (maxlen < 0 && maxlen > -1000) {
1971 if (jb_msec < 10 || jb_msec > 10000) {
1973 "Invalid Jitterbuffer spec [%d] must be between 10 and 10000\n", jb_msec);
1975 int qlen, maxqlen = 50;
1983 if (maxqlen < qlen) {
1991 SWITCH_LOG_DEBUG,
"Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n",
1992 jb_msec, qlen, maxqlen);
1998 }
else if (!silent) {
2000 SWITCH_LOG_WARNING,
"Error Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen);
2010 int32_t jb_sync_msec = 0;
2011 uint32_t fps = 0, frames = 0;
2012 uint32_t min_frames = 0;
2013 uint32_t max_frames = 0;
2014 uint32_t cur_frames = 0;
2017 int sync_audio = 0, sync_video = 0;
2037 if (!strcasecmp(var,
"disabled")) {
2043 if (tmp && tmp > -50 && tmp < 10000) {
2047 if ((p = strchr(var,
':'))) {
2058 if (cur_frames != min_frames) {
2059 frames = cur_frames;
2062 if (frames < 1) frames = 1;
2067 if (!jb_sync_msec) {
2068 jb_sync_msec = frames * 75;
2072 if (frames != cur_frames) {
2079 SWITCH_LOG_DEBUG1,
"%s %s \"%s\" Sync A/V JB to %dms %u VFrames FPS %u a:%s v:%s\n",
2083 jb_sync_msec, frames, video_globals.
fps, sync_audio ?
"yes" :
"no", sync_video ?
"yes" :
"no");
2101 if (!(smh = session->media_handle)) {
2149 if (!(smh = session->media_handle)) {
2190 memset((*frame)->data, 0, (*frame)->datalen);
2230 int rtp_timeout_sec = 0;
2231 int rtp_hold_timeout_sec = 0;
2249 rtp_timeout_sec = v;
2256 rtp_hold_timeout_sec = v;
2260 if (rtp_timeout_sec) {
2265 if (!rtp_hold_timeout_sec) {
2266 rtp_hold_timeout_sec = rtp_timeout_sec * 10;
2270 if (rtp_hold_timeout_sec) {
2291 memset((*frame)->data, 0, (*frame)->datalen);
2310 snprintf(value,
sizeof(value),
"%.8x", rtcp_frame.
ssrc);
2313 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
ntp_msw);
2316 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
ntp_lsw);
2319 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
timestamp);
2322 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
packet_count);
2325 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
octect_count);
2339 snprintf(header,
sizeof(header),
"Source%u-SSRC", i);
2340 snprintf(value,
sizeof(value),
"%.8x", rtcp_frame.
reports[i].
ssrc);
2342 snprintf(header,
sizeof(header),
"Source%u-Fraction", i);
2345 snprintf(header,
sizeof(header),
"Source%u-Lost", i);
2346 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
reports[i].
lost);
2348 snprintf(header,
sizeof(header),
"Source%u-Loss-Avg", i);
2351 snprintf(header,
sizeof(header),
"Source%u-Highest-Sequence-Number-Received", i);
2354 snprintf(header,
sizeof(header),
"Source%u-Jitter", i);
2355 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
reports[i].
jitter);
2357 snprintf(header,
sizeof(header),
"Source%u-LSR", i);
2358 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
reports[i].
lsr);
2360 snprintf(header,
sizeof(header),
"Source%u-DLSR", i);
2361 snprintf(value,
sizeof(value),
"%u", rtcp_frame.
reports[i].
dlsr);
2432 if (codec_ms > 120) {
2434 "Your phone is trying to send timestamps that suggest an increment of %dms per packet\n"
2435 "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?\n",
2445 "Asynchronous PTIME not supported, changing our end from %d to %d\n",
2491 "alternate payload received (received %d, expecting %d)\n",
2502 "Changing current codec to %s (payload type %d).\n",
2514 "Could not change to payload type %d, ignoring...\n",
2556 int bytes = 0, samples = 0, frames = 0;
2562 if (!(smh = session->media_handle)) {
2597 frames = ((int) frame->datalen / bytes);
2623 if (!local_t38_options) {
2627 local_t38_options->
T38MaxBitRate = t38_options->T38MaxBitRate;
2637 local_t38_options->
remote_port = t38_options->remote_port;
2652 if (!(smh = session->media_handle) || !mimp) {
2683 if (!(engine = &smh->
engines[type]))
return;
2689 uint32_t system_bw = 0;
2690 const char *var = NULL, *bwv;
2727 if (!(smh = session->media_handle)) {
2802 msg.
from = __FILE__;
2834 if (!(smh = session->media_handle)) {
2853 if (session->read_resampler) {
2860 if (session->write_resampler) {
2871 "Changing Codec from %s@%dms@%dhz to %s@%dms@%luhz\n",
3044 if (!(smh = session->media_handle)) {
3067 if (!(smh = session->media_handle)) {
3092 if (!(smh = session->media_handle)) {
3113 if (!(smh = session->media_handle)) {
3160 #pragma warning(push)
3161 #pragma warning(disable:4702)
3191 if (strchr(ip,
':')) {
3219 if (strchr(ip,
':')) {
3232 sdp_attribute_t *attr;
3233 int i = 0, got_rtcp_mux = 0;
3235 int ice_seen = 0, cid = 0, ai = 0;
3250 attr = m->m_attributes;
3252 attr = sdp->sdp_attributes;
3255 for (; attr; attr = attr->a_next) {
3258 int argc = 0, j = 0;
3260 if (
zstr(attr->a_name)) {
3264 if (!strcasecmp(attr->a_name,
"ice-ufrag")) {
3272 }
else if (!strcasecmp(attr->a_name,
"ice-pwd")) {
3276 }
else if (!strcasecmp(attr->a_name,
"ice-options")) {
3278 }
else if (!strcasecmp(attr->a_name,
"setup")) {
3279 if (!strcasecmp(attr->a_value,
"passive") || !strcasecmp(attr->a_value,
"actpass")) {
3285 }
else if (!strcasecmp(attr->a_value,
"active")) {
3321 }
else if (!engine->
remote_ssrc && !strcasecmp(attr->a_name,
"ssrc") && attr->a_value) {
3322 engine->
remote_ssrc = (uint32_t) atol(attr->a_value);
3330 }
else if (!strcasecmp(attr->a_name,
"rtcp-mux")) {
3335 }
else if (!strcasecmp(attr->a_name,
"candidate")) {
3352 cid = fields[1] ? atoi(fields[1]) - 1 : 0;
3354 if (argc < 5 || engine->ice_in.cand_idx[cid] >=
MAX_CAND - 1) {
3359 for (i = 0; i < argc; i++) {
3365 "Drop %s Candidate cid: %d proto: %s type: %s addr: %s:%s (no network path)\n",
3367 cid+1, fields[2], fields[7], fields[4], fields[5]);
3371 "Save %s Candidate cid: %d proto: %s type: %s addr: %s:%s\n",
3373 cid+1, fields[2], fields[7], fields[4], fields[5]);
3386 while(j < argc && fields[j+1]) {
3387 if (!strcasecmp(fields[j],
"typ")) {
3389 }
else if (!strcasecmp(fields[j],
"raddr")) {
3391 }
else if (!strcasecmp(fields[j],
"rport")) {
3393 }
else if (!strcasecmp(fields[j],
"generation")) {
3409 for (cid = 0; cid < 2; cid++) {
3416 "Choose %s candidate, index %d, %s:%d\n", cid ?
"rtcp" :
"rtp", i,
3427 "Choose same candidate, index %d, for rtcp based on rtcp-mux attribute %s:%d\n", engine->
ice_in.
cand_idx[1],
3459 for (i = 0; i < 2; i++) {
3472 "setting remote %s ice addr to index %d %s:%d based on candidate\n",
type2str(type), engine->
ice_in.
chosen[0],
3493 "Setting remote rtcp %s addr to %s:%d based on candidate\n",
type2str(type),
3502 if (m && !got_rtcp_mux) {
3533 "rtcp_video_interval_msec" :
"rtcp_audio_interval_msec"))
3539 if (remote_rtcp_port) {
3540 if (!strcasecmp(val,
"passthru")) {
3545 int interval = atoi(val);
3546 if (interval < 100 || interval > 500000) {
3548 "Invalid rtcp interval spec [%d] must be between 100 and 500000\n", interval);
3589 #pragma warning(pop)
3598 if (!(smh = session->media_handle)) {
3610 #define MAX_MATCHES 30
3620 int j = 0, f = 0, g;
3621 struct matches mtmp[MAX_MATCHES] = { { 0 } };
3622 for(j = 0; j < m_idx; j++) {
3623 *&mtmp[j] = *&matches[j];
3628 for(j = 0; j < m_idx; j++) {
3629 if (mtmp[j].imp == imp) {
3630 *&matches[f++] = *&mtmp[j];
3652 unsigned long best_te_rate = 8000, cng_rate = 8000;
3654 sdp_attribute_t *attr;
3655 int ptime = 0, dptime = 0, maxptime = 0, dmaxptime = 0;
3656 int sendonly = 0, recvonly = 0;
3657 int greedy = 0, x = 0,
skip = 0;
3660 const char *crypto = NULL;
3661 int got_crypto = 0, got_video_crypto = 0, got_audio = 0, saw_audio = 0, got_avp = 0, got_video_avp = 0, got_video_savp = 0, got_savp = 0, got_udptl = 0, got_webrtc = 0;
3663 sdp_parser_t *parser = NULL;
3670 uint32_t near_rate = 0;
3672 sdp_rtpmap_t *mmap = NULL, *near_map = NULL;
3673 struct matches matches[MAX_MATCHES] = { { 0 } };
3674 struct matches near_matches[MAX_MATCHES] = { { 0 } };
3676 uint32_t remote_codec_rate = 0, fmtp_remote_codec_rate = 0;
3683 if (!(smh = session->media_handle)) {
3690 codec_array = smh->
codecs;
3693 if (!(parser = sdp_parse(NULL, r_sdp, (
int) strlen(r_sdp), 0))) {
3697 if (!(sdp = sdp_session(parser))) {
3698 sdp_parser_free(parser);
3720 if (proceed) *proceed = 1;
3726 if (!strcasecmp(val,
"generous")) {
3729 }
else if (!strcasecmp(val,
"greedy")) {
3732 }
else if (!strcasecmp(val,
"scrooge")) {
3744 if (strstr(smh->
origin,
"CiscoSystemsSIP-GW-UserAgent")) {
3751 if (strstr(smh->
origin,
"Sonus_UAC")) {
3754 "Hello,\nI see you have a Sonus!\n"
3755 "FYI, Sonus cannot follow the RFC on the proper way to send DTMF.\n"
3756 "Sadly, my creator had to spend several hours figuring this out so I thought you'd like to know that!\n"
3757 "Don't worry, DTMF will work but you may want to ask them to fix it......\n");
3777 if ((sdp->sdp_connection && sdp->sdp_connection->c_address && !strcmp(sdp->sdp_connection->c_address,
"0.0.0.0"))) {
3782 for (m = sdp->sdp_media; m; m = m->m_next) {
3783 sdp_connection_t *connection;
3790 if (m->m_type == sdp_media_audio) {
3795 maxptime = dmaxptime;
3797 if (m->m_proto == sdp_proto_extended_srtp || m->m_proto == sdp_proto_extended_rtp) {
3802 if (m->m_proto_name && !strcasecmp(m->m_proto_name,
"UDP/TLS/RTP/SAVPF")) {
3806 if (m->m_proto_name && !strcasecmp(m->m_proto_name,
"UDP/RTP/AVPF")) {
3810 if (m->m_proto == sdp_proto_srtp || m->m_proto == sdp_proto_extended_srtp) {
3811 if (m->m_type == sdp_media_audio) {
3816 }
else if (m->m_proto == sdp_proto_rtp) {
3817 if (m->m_type == sdp_media_audio) {
3822 }
else if (m->m_proto == sdp_proto_udptl) {
3826 if (got_udptl && m->m_type == sdp_media_image && m->m_port) {
3844 if (proceed) *proceed = 0;
3849 if (!strcasecmp(var,
"once")) {
3896 const char *err = NULL;
3924 msg->
from = __FILE__;
3936 }
else if (m->m_type == sdp_media_audio && m->m_port && got_audio && got_savp) {
3938 }
else if (m->m_type == sdp_media_audio && m->m_port && !got_audio) {
3944 memset(matches, 0,
sizeof(matches[0]) * MAX_MATCHES);
3945 memset(near_matches, 0,
sizeof(near_matches[0]) * MAX_MATCHES);
3947 if (!sendonly && (m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive)) {
3951 if (!sendonly && m->m_connections && m->m_connections->c_address && !strcmp(m->m_connections->c_address,
"0.0.0.0")) {
3959 switch(a_engine->
rmode) {
3975 for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
3976 if (
zstr(attr->a_name)) {
3981 if (!strncasecmp(attr->a_name,
"ice", 3)) {
3983 }
else if (sendonly < 2 && !strcasecmp(attr->a_name,
"sendonly")) {
3986 }
else if (sendonly < 2 && !strcasecmp(attr->a_name,
"inactive")) {
3989 }
else if (!strcasecmp(attr->a_name,
"recvonly")) {
4001 }
else if (sendonly < 2 && !strcasecmp(attr->a_name,
"sendrecv")) {
4003 }
else if (!strcasecmp(attr->a_name,
"ptime")) {
4004 ptime = dptime = atoi(attr->a_value);
4005 }
else if (!strcasecmp(attr->a_name,
"maxptime")) {
4006 maxptime = dmaxptime = atoi(attr->a_value);
4010 if (sendonly == 2 && ice) {
4015 if (sendonly != 1 && recvonly != 1) {
4022 }
else if (recvonly) {
4049 if (session->bugs) {
4051 "Session is connected to a media bug. "
4052 "Re-Negotiation implicitly disabled.\n");
4072 codec_array = smh->
codecs;
4078 for (attr = m->m_attributes; attr; attr = attr->a_next) {
4080 if (!strcasecmp(attr->a_name,
"fingerprint") && !
zstr(attr->a_value)) {
4086 for (attr = m->m_attributes; attr; attr = attr->a_next) {
4088 if (!strcasecmp(attr->a_name,
"rtcp") && attr->a_value) {
4094 }
else if (!strcasecmp(attr->a_name,
"ptime") && attr->a_value) {
4095 ptime = atoi(attr->a_value);
4096 }
else if (!strcasecmp(attr->a_name,
"maxptime") && attr->a_value) {
4097 maxptime = atoi(attr->a_value);
4098 }
else if (got_crypto < 1 && !strcasecmp(attr->a_name,
"crypto") && !
zstr(attr->a_value)) {
4103 if (m->m_proto != sdp_proto_srtp && !got_webrtc) {
4110 crypto = attr->a_value;
4111 crypto_tag = atoi(crypto);
4118 if (got_crypto == -1 && got_savp && !got_avp && !got_webrtc) {
4124 connection = sdp->sdp_connection;
4125 if (m->m_connections) {
4126 connection = m->m_connections;
4137 for (map = m->m_rtpmaps; map; map = map->rm_next) {
4139 const char *rm_encoding;
4140 uint32_t map_bit_rate = 0;
4142 int map_channels = map->rm_params ? atoi(map->rm_params) : 1;
4144 if (!(rm_encoding = map->rm_encoding)) {
4149 if (!strcasecmp(rm_encoding,
"telephone-event")) {
4152 best_te_rate = map->rm_rate;
4183 if (maxptime && (!codec_ms || codec_ms > maxptime)) {
4184 codec_ms = maxptime;
4193 if (!ptime && !strcasecmp(map->rm_encoding,
"g723")) {
4197 remote_codec_rate = map->rm_rate;
4198 fmtp_remote_codec_rate = 0;
4199 memset(&codec_fmtp, 0,
sizeof(codec_fmtp));
4201 if (
zstr(map->rm_fmtp)) {
4202 if (!strcasecmp(map->rm_encoding,
"ilbc")) {
4204 map_bit_rate = 13330;
4205 }
else if (!strcasecmp(map->rm_encoding,
"isac")) {
4207 map_bit_rate = 32000;
4222 }
else if (!strcasecmp(map->rm_encoding,
"opus")) {
4238 rm_encoding, map->rm_pt, (
int) remote_codec_rate, codec_ms, map_bit_rate, map_channels,
4241 match = (map->rm_pt == imp->
ianacode) ? 1 : 0;
4243 match = (!strcasecmp(rm_encoding, imp->
iananame) &&
4244 ((map->rm_pt < 96 && imp->
ianacode < 96) || (map->rm_pt > 95 && imp->
ianacode > 95)) &&
4246 if (fmtp_remote_codec_rate) {
4247 remote_codec_rate = fmtp_remote_codec_rate;
4251 if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate && strcasecmp(map->rm_encoding,
"ilbc") &&
4252 strcasecmp(map->rm_encoding,
"isac")) {
4257 if (match && remote_codec_rate && codec_rate && remote_codec_rate != codec_rate && (!strcasecmp(map->rm_encoding,
"pcma") ||
4258 !strcasecmp(map->rm_encoding,
"pcmu"))) {
4267 "Bah HUMBUG! Sticking with %s@%uh@%ui\n",
4269 }
else if ((ptime && codec_ms && codec_ms * 1000 != imp->
microseconds_per_packet) || remote_codec_rate != codec_rate) {
4274 "Audio Codec Compare [%s:%d:%u:%d:%u:%d] is saved as a near-match\n",
4278 near_matches[nm_idx].
rate = remote_codec_rate;
4279 near_matches[nm_idx].
imp =
imp;
4280 near_matches[nm_idx].
map =
map;
4287 matches[m_idx].
rate = codec_rate;
4288 matches[m_idx].
imp =
imp;
4289 matches[m_idx].
map =
map;
4293 "Audio Codec Compare [%s:%d:%u:%d:%u:%d] ++++ is saved as a match\n",
4296 if (m_idx >= MAX_MATCHES) {
4304 if (m_idx >= MAX_MATCHES) {
4316 if (!m_idx && nm_idx) {
4319 for(j = 0; j < nm_idx; j++) {
4326 near_rate = near_matches[j].
rate;
4327 near_match = near_matches[j].
imp;
4328 near_map = near_matches[j].
map;
4330 switch_snprintf(tmp,
sizeof(tmp),
"%s@%uh@%ui%dc", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second,
4331 codec_ms, near_match->number_of_channels);
4348 matches[m_idx].
rate = near_rate;
4349 matches[m_idx].
imp = timp;
4350 matches[m_idx].
map = near_map;
4362 greedy_sort(smh, matches, m_idx, codec_array, total_codecs);
4369 for(j = 0; j < m_idx; j++) {
4372 matches[j].map->rm_encoding,
4374 matches[j].
map->rm_fmtp,
4376 matches[j].
map->rm_pt,
4382 mimp = matches[j].
imp;
4383 mmap = matches[j].
map;
4403 pmap->
channels = mmap->rm_params ? atoi(mmap->rm_params) : 1;
4405 if (!strcasecmp((
char *) mmap->rm_encoding,
"opus")) {
4412 if (!
zstr((
char *) mmap->rm_fmtp) &&
switch_stristr(
"stereo=1", (
char *) mmap->rm_fmtp)) {
4448 if (pmap->
pt > pl) {
4494 for (map = m->m_rtpmaps; map; map = map->rm_next) {
4495 const char *rm_encoding;
4497 if (!(rm_encoding = map->rm_encoding)) {
4501 if (!strcasecmp(rm_encoding,
"telephone-event")) {
4504 best_te_rate = map->rm_rate;
4514 cng_rate = map->rm_rate;
4530 best_te_rate = 8000;
4536 "No 2833 in SDP. Liberal DTMF mode adding %d as telephone-event.\n", smh->
mparams->
te);
4581 }
else if (m->m_type == sdp_media_video && m->m_port) {
4583 const char *rm_encoding;
4590 memset(matches, 0,
sizeof(matches[0]) * MAX_MATCHES);
4591 memset(near_matches, 0,
sizeof(near_matches[0]) * MAX_MATCHES);
4596 connection = sdp->sdp_connection;
4597 if (m->m_connections) {
4598 connection = m->m_connections;
4610 sdp_bandwidth_t *bw;
4613 for (bw = m->m_bandwidths; bw; bw = bw->b_next) {
4614 if (bw->b_modifier == sdp_bw_as && !tias) {
4615 v_engine->
sdp_bw = bw->b_value / 1024;
4616 }
else if (bw->b_modifier == sdp_bw_tias) {
4618 v_engine->
sdp_bw = bw->b_value / 1024;
4622 switch(v_engine->
rmode) {
4640 for (map = m->m_rtpmaps; map; map = map->rm_next) {
4643 for (attr = m->m_attributes; attr; attr = attr->a_next) {
4644 if (!strcasecmp(attr->a_name,
"fingerprint") && !
zstr(attr->a_value)) {
4645 got_video_crypto = 1;
4650 for (attr = m->m_attributes; attr; attr = attr->a_next) {
4651 if (!strcasecmp(attr->a_name,
"framerate") && attr->a_value) {
4653 }
else if (!strcasecmp(attr->a_name,
"rtcp-fb")) {
4654 if (!
zstr(attr->a_value)) {
4673 }
else if (!strcasecmp(attr->a_name,
"rtcp") && attr->a_value && !strcmp(attr->a_value,
"1")) {
4679 }
else if (!got_video_crypto && !strcasecmp(attr->a_name,
"crypto") && !
zstr(attr->a_value)) {
4684 if (m->m_proto != sdp_proto_srtp && !got_webrtc) {
4691 crypto = attr->a_value;
4692 crypto_tag = atoi(crypto);
4695 "rtp_has_video_crypto",
4701 if (!(rm_encoding = map->rm_encoding)) {
4705 for (i = 0; i < total_codecs; i++) {
4720 vmatch = (map->rm_pt == imp->
ianacode) ? 1 : 0;
4722 vmatch = strcasecmp(rm_encoding, imp->
iananame) ? 0 : 1;
4726 matches[m_idx].
imp =
imp;
4727 matches[m_idx].
map =
map;
4750 greedy_sort(smh, matches, m_idx, codec_array, total_codecs);
4756 for(j = 0; j < m_idx; j++) {
4759 matches[j].map->rm_encoding,
4761 matches[j].
map->rm_fmtp,
4763 matches[j].
map->rm_pt,
4777 mimp = matches[j].
imp;
4778 map = matches[j].
map;
4856 if (!match && vmatch) match = 1;
4861 sdp_parser_free(parser);
4882 if (!(smh = session->media_handle)) {
4897 const char *msg =
"hold";
4912 msg =
"hold-private";
4934 stream =
"local_stream://moh";
4939 if (!strcasecmp(stream,
"indicate_hold")) {
4971 int media_on_hold_b = 0;
4972 int bypass_after_hold_a = 0;
4973 int bypass_after_hold_b = 0;
4975 if (media_on_hold_a) {
5051 if (!(smh = session->media_handle)) {
5079 unsigned char *
buf = NULL;
5111 fps = video_globals.
fps;
5167 if (!(smh = session->media_handle)) {
5194 if (!(smh = session->media_handle)) {
5216 if (!(smh = session->media_handle)) {
5346 uint32_t loops = 0, xloops = 0, vloops = 0;
5349 unsigned char *
buf = NULL;
5475 }
else if (blank_img) {
5505 if (!(smh = session->media_handle)) {
5544 if (!(smh = session->media_handle)) {
5564 if (!(smh = session->media_handle)) {
5579 if (!(smh = session->media_handle)) {
5601 if (!(smh = session->media_handle)) {
5612 #define RA_PTR_LEN 512
5619 char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL, *pe;
5628 if (!(smh = session->media_handle)) {
5635 if (
zstr(sdp_str)) {
5639 if (
zstr(sdp_str)) {
5654 if (tmp && atoi(tmp)) {
5660 vid_port_ptr = p + 8;
5663 if (!(ip_ptr && port_ptr)) {
5670 while (x <
sizeof(rip) - 1 && p && *p && ((*p >=
'0' && *p <=
'9') || *p ==
'.' || *p ==
':' || (*p >=
'a' && *p <=
'f') || (*p >=
'A' && *p <=
'F'))) {
5680 while (x <
sizeof(rp) - 1 && p && *p && (*p >=
'0' && *p <=
'9')) {
5690 while (x <
sizeof(rvp) - 1 && p && *p && (*p >=
'0' && *p <=
'9')) {
5698 if (!(*rip && *rp)) {
5721 const char *rport = NULL;
5724 if (!remote_rtcp_port) {
5754 const char *rport = NULL;
5761 }
else if (remote_host && ( (strcmp(remote_host,
"0.0.0.0") == 0) ||
5765 "Remote address changed from [%s] to [%s]. Ignoring...\n",
5805 return (smh->mparams->extsipip &&
5819 char *stun_ip = NULL;
5825 if (!(smh = session->media_handle)) {
5833 if (!strncasecmp(sourceip,
"host:", 5)) {
5835 }
else if (!strncasecmp(sourceip,
"stun:", 5)) {
5838 stun_ip = strdup(sourceip + 5);
5840 if ((p = strchr(stun_ip,
':'))) {
5844 if (iport > 0 && iport < 0xFFFF) {
5849 if (
zstr(stun_ip)) {
5854 for (x = 0; x < 5; x++) {
5872 if (myport == *port && !strcmp(*ip, smh->
mparams->
rtpip)) {
5880 *ip = (
char *) sourceip;
5899 if (!(smh = session->media_handle)) {
5917 const char *use_ip = NULL;
5921 char vname[128] =
"";
5925 if (!(smh = session->media_handle)) {
5976 use_ip = lookup_rtpip;
6008 if (!(smh = session->media_handle)) {
6043 if (!(smh = session->media_handle)) {
6054 v_engine->
mh.
up = 0;
6167 if (!(smh = session->media_handle)) {
6221 const char *err = NULL;
6222 const char *val = NULL;
6226 char *timer_name = NULL;
6233 if (!(smh = session->media_handle)) {
6277 memset(flags, 0,
sizeof(flags));
6307 #if __BYTE_ORDER == __LITTLE_ENDIAN
6362 const char *rport = NULL;
6365 if (!remote_rtcp_port) {
6391 if (session && a_engine) {
6401 memset(flags, 0,
sizeof(flags));
6412 "PROXY AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
6427 timer_name = (
char *) var;
6460 uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10);
6462 a_engine->
ssrc = ssrc_ul;
6509 if ((vad_in && inb) || (vad_out && !inb)) {
6549 if (!remote_rtcp_port && rport) {
6553 if (!strcasecmp(val,
"passthru")) {
6556 }
else if (remote_rtcp_port) {
6557 int interval = atoi(val);
6558 if (interval < 100 || interval > 500000) {
6560 "Invalid rtcp interval spec [%d] must be between 100 and 500000\n", interval);
6667 int delayi = atoi(val);
6668 if (delayi < 0) delayi = 0;
6750 const char *rport = NULL;
6755 if (!remote_rtcp_port) {
6781 memset(flags, 0,
sizeof(flags));
6792 "PROXY VIDEO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
6806 timer_name = (
char *) var;
6821 memset(flags, 0,
sizeof(flags));
6840 if (v_engine->
fir) {
6844 if (v_engine->
pli) {
6848 if (v_engine->
nack) {
6852 if (v_engine->
tmmbr) {
6877 if (v_engine->
fir) {
6881 if (v_engine->
pli) {
6890 uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10);
6892 v_engine->
ssrc = ssrc_ul;
6933 if (!strcasecmp(val,
"passthru")) {
6937 int interval = atoi(val);
6938 if (interval < 100 || interval > 500000) {
6940 "Invalid rtcp interval spec [%d] must be between 100 and 500000\n", interval);
6944 "Activating VIDEO RTCP PORT %d interval %d mux %d\n", remote_port, interval, v_engine->
rtcp_mux);
7037 if (session && v_engine) {
7060 return "UDP/TLS/RTP/SAVPF";
7098 int cur_ptime,
const char *append_audio,
const char *sr,
int use_cng,
int cng_type,
switch_event_t *map,
int secure,
7103 int already_did[128] = { 0 };
7104 int ptime = 0, noptime = 0;
7105 const char *local_sdp_audio_zrtp_hash;
7120 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"m=audio %d %s", port,
7127 if (!strcasecmp(imp->
iananame,
"ilbc") || !strcasecmp(imp->
iananame,
"isac") ) {
7141 if (this_ptime != cur_ptime) {
7178 memset(already_did, 0,
sizeof(already_did));
7183 char *fmtp = imp->
fmtp;
7190 if (!strcasecmp(imp->
iananame,
"ilbc") || !strcasecmp(imp->
iananame,
"isac")) {
7200 if (this_ptime != cur_ptime) {
7226 if (smh->
fmtps[i]) {
7227 fmtp = smh->
fmtps[i];
7252 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtpmap:%d telephone-event/%d\r\n",
7255 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtpmap:%d telephone-event/%d\r\na=fmtp:%d 0-16\r\n",
7268 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtcp-mux\r\n");
7269 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtcp:%d IN %s %s\r\n", port, family, ip);
7271 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtcp:%d IN %s %s\r\n", port + 1, family, ip);
7280 uint32_t c1 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 1);
7281 uint32_t c2 = c1 - 1;
7298 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=ssrc:%u msid:%s a0\r\n", a_engine->
ssrc, smh->
msid);
7299 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=ssrc:%u mslabel:%s\r\n", a_engine->
ssrc, smh->
msid);
7300 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=ssrc:%u label:%sa0\r\n", a_engine->
ssrc, smh->
msid);
7303 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=ice-ufrag:%s\r\n", ice_out->
ufrag);
7304 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=ice-pwd:%s\r\n", ice_out->
pwd);
7307 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n",
7316 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
7326 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n",
7335 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
7346 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=ice-options:google-ice\r\n");
7374 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=silenceSupp:off - - - -\r\n");
7379 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"%s%s", append_audio,
end_of(append_audio) ==
'\n' ?
"" :
"\r\n");
7386 if (!noptime && cur_ptime) {
7387 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=ptime:%d\r\n", cur_ptime);
7392 if (local_sdp_audio_zrtp_hash) {
7394 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=zrtp-hash:%s\r\n", local_sdp_audio_zrtp_hash);
7398 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=%s\r\n", sr);
7410 if (!(smh = session->media_handle)) {
7415 if (!strcasecmp(val,
"rfc2833")) {
7417 }
else if (!strcasecmp(val,
"info")) {
7419 }
else if (!strcasecmp(val,
"none")) {
7429 sdp_parser_t *parser = NULL;
7432 if (!(parser = sdp_parse(NULL, r_sdp, (
int) strlen(r_sdp), 0))) {
7436 if (!(sdp = sdp_session(parser))) {
7437 sdp_parser_free(parser);
7444 for (m = sdp->sdp_media; m; m = m->m_next) {
7445 if (m->m_proto == sdp_proto_rtp) {
7448 for (map = m->m_rtpmaps; map; map = map->rm_next) {
7449 if (map->rm_encoding) {
7455 if ((br = strstr(map->rm_fmtp,
"bitrate="))) {
7478 sdp_parser_free(parser);
7491 if (!(smh = session->media_handle)) {
7501 static void add_fb(
char *
buf, uint32_t
buflen,
int pt,
int fir,
int nack,
int pli,
int tmmbr)
7504 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtcp-fb:%d ccm fir\r\n", pt);
7508 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtcp-fb:%d ccm tmmbr\r\n", pt);
7512 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtcp-fb:%d nack\r\n", pt);
7516 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
"a=rtcp-fb:%d nack pli\r\n", pt);
7522 #define SDPBUFLEN 65536
7536 char srbuf[128] =
"";
7537 const char *var_val;
7538 const char *username;
7539 const char *fmtp_out;
7556 uint8_t fir = 0, nack = 0, pli = 0, tmmbr = 0;
7560 if (!(smh = session->media_handle)) {
7650 if (smh->
rates[j] == 0) {
7674 char *orig_fmtp = NULL;
7745 fmtp_out = fmtp_out_var;
7754 if (!force && !ip &&
zstr(sr)
7798 if (!strcasecmp(sr,
"sendonly") || !strcasecmp(sr,
"recvonly") || !strcasecmp(sr,
"sendrecv")) {
7831 family = strchr(ip,
':') ?
"IP6" :
"IP4";
7834 "o=%s %010u %010u IN %s %s\r\n"
7950 if (local_sdp_audio_zrtp_hash) {
7952 local_sdp_audio_zrtp_hash);
7954 local_sdp_audio_zrtp_hash);
7982 uint32_t c1 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 1);
7987 uint32_t c2 = c1 - 1;
7988 uint32_t c3 = c1 - 2;
7989 uint32_t c4 = c1 - 3;
8003 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n",
8012 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
8022 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n",
8033 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 2 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
8066 int cur_ptime = 0, this_ptime = 0, cng_type = 0;
8085 generate_m(session, buf,
SDPBUFLEN, port, family, ip, 0, append_audio, sr, use_cng, cng_type, map, 1, sdp_type);
8086 bp = (buf + strlen(buf));
8095 generate_m(session, bp,
SDPBUFLEN - strlen(buf), port, family, ip, 0, append_audio, sr, use_cng, cng_type, map, 0, sdp_type);
8109 if (!strcasecmp(imp->
iananame,
"ilbc") || !strcasecmp(imp->
iananame,
"isac")) {
8113 if (cur_ptime != this_ptime) {
8117 cur_ptime = this_ptime;
8121 generate_m(session, bp,
SDPBUFLEN - strlen(buf), port, family, ip, cur_ptime, append_audio, sr, use_cng, cng_type, map, 1, sdp_type);
8122 bp = (buf + strlen(buf));
8134 generate_m(session, bp,
SDPBUFLEN - strlen(buf), port, family, ip, cur_ptime, append_audio, sr, use_cng, cng_type, map, 0, sdp_type);
8173 for (loops = 0; loops < 2; loops++) {
8208 int already_did[128] = { 0 };
8271 pass_fmtp = ov_fmtp;
8307 int already_did[128] = { 0 };
8324 if (ianacode < 128) {
8325 if (already_did[ianacode]) {
8328 already_did[ianacode] = 1;
8353 if (!
zstr(ov_fmtp)) {
8354 fmtp = (
char *) ov_fmtp;
8361 if (smh->
fmtps[i]) {
8362 fmtp = smh->
fmtps[i];
8367 if (
zstr(fmtp)) fmtp = (
char *) pass_fmtp;
8370 if (!
zstr(fmtp) && strcasecmp(fmtp,
"_blank_")) {
8428 v_engine->
nack || nack, v_engine->
pli || pli, v_engine->
tmmbr || tmmbr);
8442 int already_did[128] = { 0 };
8473 uint32_t c1 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 1);
8478 uint32_t c2 = c1 - 1;
8479 uint32_t c3 = c1 - 2;
8480 uint32_t c4 = c1 - 3;
8501 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 1 %s %u %s %d typ host generation 0\r\n",
8510 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 1 %s %u %s %d typ srflx raddr %s rport %d generation 0\r\n",
8520 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 2 %s %u %s %d typ host generation 0\r\n",
8530 switch_snprintf(buf + strlen(buf),
SDPBUFLEN - strlen(buf),
"a=candidate:%s 2 %s %u %s %d typ srflx generation 0\r\n",
8561 if (local_sdp_video_zrtp_hash) {
8596 const char *sdp_str;
8602 if (!(smh = session->media_handle)) {
8609 sdp_parser_t *parser;
8612 sdp_connection_t *connection;
8614 if ((parser = sdp_parse(NULL, sdp_str, (
int) strlen(sdp_str), 0))) {
8615 if ((sdp = sdp_session(parser))) {
8616 for (m = sdp->sdp_media; m; m = m->m_next) {
8617 if (m->m_type != sdp_media_audio || !m->m_port) {
8621 connection = sdp->sdp_connection;
8622 if (m->m_connections) {
8623 connection = m->m_connections;
8635 sdp_parser_free(parser);
8645 char buf[2048] =
"";
8646 char max_buf[128] =
"";
8647 char max_data[128] =
"";
8650 const char *family =
"IP4";
8651 const char *username;
8652 const char *bit_removal_on =
"a=T38FaxFillBitRemoval\r\n";
8653 const char *bit_removal_off =
"";
8655 const char *mmr_on =
"a=T38FaxTranscodingMMR\r\n";
8656 const char *mmr_off =
"";
8658 const char *jbig_on =
"a=T38FaxTranscodingJBIG\r\n";
8659 const char *jbig_off =
"";
8667 if (!(smh = session->media_handle)) {
8676 ip = t38_options->local_ip;
8677 port = t38_options->local_port;
8717 family = strchr(ip,
':') ?
"IP6" :
"IP4";
8722 "o=%s %010u %010u IN %s %s\r\n"
8723 "s=%s\r\n" "c=IN %s %s\r\n" "t=0 0\r\n", username, smh->
owner_id, smh->
session_id, family, ip, username, family, ip);
8725 if (t38_options->T38FaxMaxBuffer) {
8726 switch_snprintf(max_buf,
sizeof(max_buf),
"a=T38FaxMaxBuffer:%d\r\n", t38_options->T38FaxMaxBuffer);
8729 if (t38_options->T38FaxMaxDatagram) {
8730 switch_snprintf(max_data,
sizeof(max_data),
"a=T38FaxMaxDatagram:%d\r\n", t38_options->T38FaxMaxDatagram);
8736 if (broken_boolean) {
8737 bit_removal_on =
"a=T38FaxFillBitRemoval:1\r\n";
8738 bit_removal_off =
"a=T38FaxFillBitRemoval:0\r\n";
8740 mmr_on =
"a=T38FaxTranscodingMMR:1\r\n";
8741 mmr_off =
"a=T38FaxTranscodingMMR:0\r\n";
8743 jbig_on =
"a=T38FaxTranscodingJBIG:1\r\n";
8744 jbig_off =
"a=T38FaxTranscodingJBIG:0\r\n";
8750 "m=image %d udptl t38\r\n"
8751 "a=T38FaxVersion:%d\r\n"
8752 "a=T38MaxBitRate:%d\r\n"
8756 "a=T38FaxRateManagement:%s\r\n"
8759 "a=T38FaxUdpEC:%s\r\n",
8762 t38_options->T38FaxVersion,
8763 t38_options->T38MaxBitRate,
8764 t38_options->T38FaxFillBitRemoval ? bit_removal_on : bit_removal_off,
8765 t38_options->T38FaxTranscodingMMR ? mmr_on : mmr_off,
8766 t38_options->T38FaxTranscodingJBIG ? jbig_on : jbig_off,
8767 t38_options->T38FaxRateManagement,
8770 t38_options->T38FaxUdpEC
8777 switch_snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"m=audio 0 RTP/AVP 19\r\n");
8795 char *p, *q, *pe, *qe;
8796 int has_video = 0, has_audio = 0, has_ip = 0;
8797 char port_buf[25] =
"";
8798 char vport_buf[25] =
"";
8807 if (!(smh = session->media_handle)) {
8874 if (a_engine->
local_sdp_ip && !strncmp(
"c=IN IP", p, 7)) {
8878 strncpy(q, strchr(a_engine->
adv_sdp_ip,
':') ?
"6 " :
"4 ", 2);
8884 while (p && *p && ((*p >=
'0' && *p <=
'9') || *p ==
'.' || *p ==
':' || (*p >=
'A' && *p <=
'F') || (*p >=
'a' && *p <=
'f'))) {
8894 }
else if (!strncmp(
"o=", p, 2)) {
8895 char *oe = strchr(p,
'\n');
8899 const char *family =
"IP4";
8900 char o_line[1024] =
"";
8911 family = strchr(smh->
mparams->
sipip,
':') ?
"IP6" :
"IP4";
8924 snprintf(o_line,
sizeof(o_line),
"o=%s %010u %010u IN %s %s\r\n",
8927 strncpy(q, o_line, strlen(o_line));
8928 q += strlen(o_line) - 1;
8932 }
else if (!strncmp(
"s=", p, 2)) {
8933 char *se = strchr(p,
'\n');
8937 char s_line[1024] =
"";
8949 strncpy(q, s_line, strlen(s_line));
8950 q += strlen(s_line) - 1;
8954 }
else if ((!strncmp(
"m=audio ", p, 8) && *(p + 8) !=
'0') || (!strncmp(
"m=image ", p, 8) && *(p + 8) !=
'0')) {
8972 strncpy(q, port_buf, strlen(port_buf));
8973 q += strlen(port_buf);
8980 while (p && *p && (*p >=
'0' && *p <=
'9')) {
8990 }
else if (!strncmp(
"m=video ", p, 8) && *(p + 8) !=
'0') {
9034 strncpy(q, vport_buf, strlen(vport_buf));
9035 q += strlen(vport_buf);
9042 while (p && *p && (*p >=
'0' && *p <=
'9')) {
9055 while (p && *p && *p !=
'\n') {
9097 if (!has_ip && !has_audio) {
9119 if (!(smh = session->media_handle)) {
9133 const char *err, *val;
9138 if (!t38_options || !t38_options->remote_ip) {
9143 if (remote_host && remote_port && remote_port == t38_options->remote_port && !strcmp(remote_host, t38_options->remote_ip)) {
9145 t38_options->remote_ip, t38_options->remote_port);
9154 t38_options->remote_ip, t38_options->remote_port);
9169 msg.
from = __FILE__;
9201 if (!(smh = session->media_handle)) {
9237 if (!(smh = session->media_handle)) {
9263 if (!(smh = session->media_handle)) {
9286 if (!(smh = session->media_handle)) {
9297 switch (msg->message_id) {
9330 if (msg->numeric_arg) {
9349 if (session->bugs && msg->numeric_arg) {
9353 if (msg->numeric_arg) {
9384 uint32_t level = (uint32_t) msg->numeric_arg;
9401 if (!strcasecmp(msg->string_array_arg[0],
"video")) {
9405 if (!strcasecmp(msg->string_array_arg[1],
"write")) {
9415 SCCT_STRING, (
void *)msg->string_array_arg[3], &reply_type, &reply);
9419 SCCT_STRING, (
void *)msg->string_array_arg[3], &reply_type, &reply);
9424 msg->string_array_arg[4] = (
char *)reply;
9433 const char *direction = msg->string_array_arg[0];
9435 if (direction && *direction ==
'v') {
9442 int both = !strcasecmp(direction,
"both");
9445 if (both || !strcasecmp(direction,
"read")) {
9450 if (both || !strcasecmp(direction,
"write")) {
9591 if (session->track_duration) {
9606 const char *ip = NULL, *port = NULL;
9637 if (session->track_duration) {
9658 switch (msg->message_id) {
9663 if (msg->string_arg) {
9665 if (*msg->string_arg ==
'=') {
9687 msg->numeric_arg = 0;
9698 if (msg->numeric_arg) {
9755 if (!(smh = session->media_handle)) {
9771 if (!(smh = session->media_handle)) {
9787 if (!(smh = session->media_handle)) {
9805 if (!(smh = session->media_handle)) {
9823 if (!(smh = session->media_handle)) {
9837 if (!(smh = session->media_handle)) {
9853 if (!(smh = session->media_handle)) {
9869 if (!(smh = session->media_handle)) {
9885 if (!(smh = session->media_handle)) {
9901 if (!(smh = session->media_handle)) {
9919 if (!(smh = session->media_handle)) {
9937 if (!(smh = session->media_handle)) {
9955 if (!(smh = session->media_handle)) {
9970 sdp_parser_t *parser;
9976 if (!(smh = session->media_handle)) {
9981 if ((parser = sdp_parse(NULL, r_sdp, (
int) strlen(r_sdp), 0))) {
9983 if ((sdp = sdp_session(parser))) {
9987 sdp_parser_free(parser);
9995 int codec_ms = ptime;
9996 uint32_t map_bit_rate = 0, map_channels = 1;
9997 char ptstr[20] =
"";
9998 char ratestr[20] =
"";
9999 char bitstr[20] =
"";
10006 map_channels = map->rm_params ? atoi(map->rm_params) : 1;
10009 if (!ptime && !strcasecmp(map->rm_encoding,
"g723")) {
10010 ptime = codec_ms = 30;
10013 if (
zstr(map->rm_fmtp)) {
10014 if (!strcasecmp(map->rm_encoding,
"ilbc")) {
10015 ptime = codec_ms = 30;
10016 map_bit_rate = 13330;
10017 }
else if (!strcasecmp(map->rm_encoding,
"isac")) {
10018 ptime = codec_ms = 30;
10019 map_bit_rate = 32000;
10032 if (map->rm_rate) {
10033 switch_snprintf(ratestr,
sizeof(ratestr),
"@%uh", (
unsigned int) map->rm_rate);
10040 if (map_bit_rate) {
10044 if (map_channels > 1) {
10048 switch_snprintf(buf + strlen(buf), buflen - strlen(buf),
",%s.%s%s%s%s", imp->
modname, map->rm_encoding, ratestr, ptstr, bitstr);
10055 char buf[1024] = { 0 };
10057 sdp_attribute_t *attr;
10058 int ptime = 0, dptime = 0;
10059 sdp_connection_t *connection;
10061 short int match = 0;
10063 int already_did[128] = { 0 };
10064 int num_codecs = 0;
10068 int prefer_sdp = 0;
10083 if (!
zstr(codec_string)) {
10084 char *tmp_codec_string;
10085 if ((tmp_codec_string = strdup(codec_string))) {
10094 if (!channel || !num_codecs) {
10098 for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
10099 if (
zstr(attr->a_name)) {
10102 if (!strcasecmp(attr->a_name,
"ptime")) {
10103 dptime = atoi(attr->a_value);
10111 for (m = sdp->sdp_media; m; m = m->m_next) {
10114 if ((m->m_type == sdp_media_audio || m->m_type == sdp_media_video) && m->m_port) {
10115 for (map = m->m_rtpmaps; map; map = map->rm_next) {
10116 for (attr = m->m_attributes; attr; attr = attr->a_next) {
10117 if (
zstr(attr->a_name)) {
10120 if (!strcasecmp(attr->a_name,
"ptime") && attr->a_value) {
10121 ptime = atoi(attr->a_value);
10134 map->rm_params ? atoi(map->rm_params) : 1,
10140 for (m = sdp->sdp_media; m; m = m->m_next) {
10143 if (m->m_type == sdp_media_image && m->m_port) {
10144 switch_snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
",t38");
10145 }
else if (m->m_type == sdp_media_audio && m->m_port) {
10146 for (attr = m->m_attributes; attr; attr = attr->a_next) {
10147 if (
zstr(attr->a_name)) {
10150 if (!strcasecmp(attr->a_name,
"ptime") && attr->a_value) {
10151 ptime = atoi(attr->a_value);
10155 connection = sdp->sdp_connection;
10156 if (m->m_connections) {
10157 connection = m->m_connections;
10166 for (map = m->m_rtpmaps; map; map = map->rm_next) {
10167 if (map->rm_pt > 127 || already_did[map->rm_pt]) {
10171 for (i = 0; i < num_codecs; i++) {
10175 match = (map->rm_pt == imp->
ianacode) ? 1 : 0;
10177 if (map->rm_encoding) {
10178 match = !strcasecmp(map->rm_encoding, imp->
iananame) &&
10179 ((map->rm_pt < 96 && imp->
ianacode < 96) || (map->rm_pt > 95 && imp->
ianacode > 95));
10194 for (i = 0; i < num_codecs; i++) {
10199 for (map = m->m_rtpmaps; map; map = map->rm_next) {
10200 if (map->rm_pt > 127 || already_did[map->rm_pt]) {
10205 match = (map->rm_pt == imp->
ianacode) ? 1 : 0;
10207 if (map->rm_encoding) {
10208 match = !strcasecmp(map->rm_encoding, imp->
iananame) &&
10209 ((map->rm_pt < 96 && imp->
ianacode < 96) || (map->rm_pt > 95 && imp->
ianacode > 95));
10223 }
else if (m->m_type == sdp_media_video && m->m_port) {
10224 connection = sdp->sdp_connection;
10225 if (m->m_connections) {
10226 connection = m->m_connections;
10233 for (i = 0; i < num_codecs; i++) {
10245 for (map = m->m_rtpmaps; map; map = map->rm_next) {
10246 if (map->rm_pt > 127 || already_did[map->rm_pt]) {
10251 match = (map->rm_pt == imp->
ianacode) ? 1 : 0;
10253 if (map->rm_encoding) {
10254 match = !strcasecmp(map->rm_encoding, imp->
iananame) &&
10255 ((map->rm_pt < 96 && imp->
ianacode < 96) || (map->rm_pt > 95 && imp->
ianacode > 95));
10270 if (buf[0] ==
',') {
10283 if (!(smh = session->media_handle)) {
10287 engine = &smh->
engines[type];
10304 if (!(smh = session->media_handle)) {
10372 const char *r_sdp = NULL;
10381 if (!(smh = session->media_handle)) {
10437 const char *r_port;
10444 if (!(smh = session->media_handle)) {
10528 if (r_ip && r_port) {
10565 if (r_ip && r_port) {
10583 int idx = atoi(tmp);
10630 if (!strcasecmp(name,
"pcmu")) {
10634 if (!strcasecmp(name,
"pcma")) {
10638 if (!strcasecmp(name,
"gsm")) {
10642 if (!strcasecmp(name,
"g722")) {
10646 if (!strcasecmp(name,
"g729")) {
10650 if (!strcasecmp(name,
"dvi4")) {
10654 if (!strcasecmp(name,
"h261")) {
10658 if (!strcasecmp(name,
"h263")) {
10670 if (p <
end_of_p(sdp) && *(p+strlen(name)) ==
'/' && *(p-1) ==
' ') {
10673 while(*p > 47 && *p < 58) {
10690 char *new_sdp = NULL;
10691 int pt = -1, te = -1;
10695 int in_m = 0, m_tally = 0, slash = 0;
10696 int number = 0,
skip = 0;
10697 int remove = !strcasecmp(cmd,
"remove");
10698 int only = !strcasecmp(cmd,
"only");
10699 char *end =
end_of_p((
char *)sdp_str);
10704 if (
remove || only) {
10715 te =
find_pt(sdp_str,
"telephone-event");
10719 len = strlen(sdp_str) + 2;
10720 new_sdp = malloc(len);
10725 while(i && *i && i < end) {
10727 if (*i ==
'm' && *(i+1) ==
'=') {
10733 if (*i ==
'\r' || *i ==
'\n') {
10739 while(*i !=
' ' && i < end) {
10751 while(i < end && ((*i > 47 && *i < 58) || *i ==
' ')) {
10754 tst = (number != pt);
10756 tst = (number == pt || number == te);
10771 tst = (number == pt);
10773 tst = (number != pt && number != te);
10783 while (i < end && !strncasecmp(i,
"a=rtpmap:", 9)) {
10784 const char *t = i + 9;
10789 tst = (number == pt);
10791 tst = (number != pt && number != te);
10794 while(i < end && (*i !=
'\r' && *i !=
'\n')) {
10795 if (!tst) *o++ = *i;
10799 while(i < end && (*i ==
'\r' || *i ==
'\n')) {
10800 if (!tst) *o++ = *i;
10805 while (i < end && !strncasecmp(i,
"a=fmtp:", 7)) {
10806 const char *t = i + 7;
10811 tst = (number == pt);
10813 tst = (number != pt && number != te);
10816 while(i < end && (*i !=
'\r' && *i !=
'\n')) {
10817 if (!tst) *o++ = *i;
10821 while(i < end && (*i ==
'\r' || *i ==
'\n')) {
10822 if (!tst) *o++ = *i;
10848 char *patched_sdp = NULL;
10852 for (x = 0; x < argc; x++) {
10853 char *command = argv[x];
10854 char *arg = strchr(command,
'(');
10865 char *tmp_sdp = NULL;
10875 "%s Filter command %s(%s)\nFROM:\n==========\n%s\nTO:\n==========\n%s\n\n",
10877 command, arg, patched_sdp ? patched_sdp : sdp, tmp_sdp);
10882 patched_sdp = tmp_sdp;
10887 return patched_sdp;
10899 if (!(smh = session->media_handle)) {
10903 if (!(engine = &smh->
engines[mtype])) {
10918 if (!(smh = session->media_handle)) {
10932 msg.
from = __FILE__;
10970 if (!(smh = session->media_handle)) {
10974 if (!(engine = &smh->
engines[mtype])) {
11024 if (session->endpoint_interface->io_routines->write_video_frame) {
11025 if ((status = session->endpoint_interface->io_routines->write_video_frame(session, frame, flags, stream_id)) ==
SWITCH_STATUS_SUCCESS) {
11044 if (!(smh = session->media_handle)) {
11077 if (!(smh = session->media_handle)) {
11142 if (session->bugs) {
11148 for (bp = session->bugs; bp; bp = bp->
next) {
11177 if (bp->
ready && img &&
11181 bug_frame.
img = img;
11214 write_frame = *frame;
11215 frame = &write_frame;
11248 if (frame->datalen == 0)
break;
11275 if (!(smh = session->media_handle)) {
11295 if (video_globals.
synced &&
11319 uint32_t loops = 0;
11324 if (!(smh = session->media_handle)) {
11336 if (session->endpoint_interface->io_routines->read_video_frame) {
11337 if ((status = session->endpoint_interface->io_routines->read_video_frame(session, frame, flags, stream_id)) ==
SWITCH_STATUS_SUCCESS) {
11371 "VIDEO: seq: %d ts: %u len: %4d %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x mark: %d\n",
11372 (*frame)->seq, (*frame)->timestamp, (*frame)->datalen,
11373 *((uint8_t *)(*frame)->data), *((uint8_t *)(*frame)->data + 1),
11374 *((uint8_t *)(*frame)->data + 2), *((uint8_t *)(*frame)->data + 3),
11375 *((uint8_t *)(*frame)->data + 4), *((uint8_t *)(*frame)->data + 5),
11376 *((uint8_t *)(*frame)->data + 6), *((uint8_t *)(*frame)->data + 7),
11377 *((uint8_t *)(*frame)->data + 8), *((uint8_t *)(*frame)->data + 9),
11378 *((uint8_t *)(*frame)->data + 10), (*frame)->m);
11391 (*frame)->img = NULL;
11397 (*frame)->img->w, (*frame)->img->h, (*frame)->img->d_w, (*frame)->img->d_h);
11400 if ((*frame)->img && (*frame)->img->d_w && (*frame)->img->d_h) {
11417 if (!(*frame)->img) {
11437 if (session->bugs) {
11443 for (bp = session->bugs; bp; bp = bp->
next) {
11460 if ((*frame) && (*frame)->img) {
11471 if (bp->
ready && (*frame) && (*frame)->img &&
11517 if (!(smh = session->media_handle)) {
11523 session->video_read_callback = NULL;
11524 session->video_read_user_data = NULL;
11525 }
else if (session->video_read_callback) {
11528 session->video_read_callback = func;
11529 session->video_read_user_data = user_data;
11543 if (!(smh = session->media_handle)) {
11549 if (session->video_read_callback) {
11550 status = session->video_read_callback(session, frame, session->video_read_user_data);
struct switch_video_codec_settings video
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
switch_status_t switch_core_codec_decode_video(switch_codec_t *codec, switch_frame_t *frame)
Decode video data using a codec handle.
#define SWITCH_MAX_CODECS
char * local_sdp_zrtp_hash
switch_core_session_t * session
switch_time_t switch_micro_time_now(void)
Get the current epoch time in microseconds.
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it's state machine to end.
switch_status_t switch_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.
void switch_channel_set_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
uint32_t T38FaxMaxDatagram
switch_status_t switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
switch_status_t switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate, switch_port_t remote_port, switch_bool_t mux)
Activate sending RTCP Sender Reports (SR's)
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 ...
unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]
switch_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool)
switch_frame_t dummy_cng_frame
void switch_ivr_bg_media(const char *uuid, switch_media_flag_t flags, switch_bool_t on, switch_bool_t is3p, uint32_t delay)
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_status_t switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp)
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
switch_rtp_numbers_t inbound
uint8_t switch_rtp_ready(switch_rtp_t *rtp_session)
Test if an RTP session is ready.
switch_status_t switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool)
Request a timer handle using given time module.
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_rtp_crypto_key_type_t
switch_status_t switch_mutex_trylock(switch_mutex_t *lock)
switch_status_t switch_channel_set_variable_name_printf(switch_channel_t *channel, const char *val, const char *fmt,...)
switch_status_t switch_channel_queue_dtmf(_In_ switch_channel_t *channel, _In_ const switch_dtmf_t *dtmf)
Queue DTMF on a given channel.
uint32_t switch_channel_test_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
char * switch_find_end_paren(const char *s, char open, char close)
char * remote_sdp_zrtp_hash
void switch_img_free(switch_image_t **img)
Close an image descriptor.
void(* switch_video_function_t)(switch_core_session_t *session, void *user_data)
const char * switch_channel_get_partner_uuid(switch_channel_t *channel)
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
switch_status_t switch_core_session_set_video_read_callback(switch_core_session_t *session, switch_core_video_thread_callback_func_t func, void *user_data)
void switch_rtp_reset(switch_rtp_t *rtp_session)
uint32_t switch_io_flag_t
char * remote_rtcp_ice_addr
switch_status_t switch_rtp_ack_bitrate(switch_rtp_t *rtp_session, uint32_t bps)
switch_status_t(* switch_core_video_thread_callback_func_t)(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
switch_read_frame_hook_t video_read_frame
#define switch_channel_stop_broadcast(_channel)
switch_status_t switch_core_session_set_video_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec)
Assign the video_read codec to a given session.
#define switch_channel_up(_channel)
switch_bool_t switch_is_leading_number(const char *str)
unsigned long adv_rm_rate
#define switch_channel_presence(_a, _b, _c, _d)
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
switch_size_t largest_jb_size
#define switch_split(_data, _delim, _array)
switch_port_t remote_port
switch_status_t switch_core_session_set_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
switch_status_t switch_ivr_broadcast(const char *uuid, const char *path, switch_media_flag_t flags)
Signal the session to broadcast audio.
switch_status_t switch_core_session_set_video_write_codec(_In_ switch_core_session_t *session, switch_codec_t *codec)
Assign the video_write codec to a given session.
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
Node in which to store custom video_write_frame channel callback hooks.
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
#define SWITCH_LOCAL_VIDEO_IP_VARIABLE
switch_memory_pool_t * pool
Representation of an event.
#define switch_channel_ready(_channel)
struct switch_io_event_hook_video_read_frame * next
struct switch_rtcp_report_block_frame reports[MAX_REPORT_BLOCKS]
switch_status_t switch_core_session_read_lock(_In_ switch_core_session_t *session)
Acquire a read lock on the session.
#define SWITCH_RTP_MAX_BUF_LEN
switch_rtp_crypto_direction_t
switch_media_flow_t smode
switch_status_t switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp_session, switch_bool_t pause)
switch_bool_t T38FaxTranscodingMMR
#define switch_channel_media_ready(_channel)
const char * T38FaxRateManagement
Node in which to store custom read frame channel callback hooks.
dtls_state_t switch_rtp_dtls_state(switch_rtp_t *rtp_session, dtls_type_t type)
switch_status_t switch_core_session_video_read_callback(switch_core_session_t *session, switch_frame_t *frame)
switch_status_t switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky)
Maps a port through the NAT Traversal System.
unsigned int switch_ci_hashfunc_default(const char *char_key, switch_ssize_t *klen)
switch_status_t switch_rtp_set_payload_map(switch_rtp_t *rtp_session, payload_map_t **pmap)
void switch_core_session_lock_codec_read(_In_ switch_core_session_t *session)
switch_video_write_frame_hook_t video_write_frame
switch_codec_settings_t codec_settings
switch_status_t switch_rtp_add_crypto_key(switch_rtp_t *rtp_session, switch_rtp_crypto_direction_t direction, uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen)
void switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs)
switch_status_t switch_core_codec_destroy(switch_codec_t *codec)
Destroy an initalized codec handle.
switch_status_t switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
const char * switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx)
Retrieve a variable from a given channel.
#define switch_core_session_get_name(_s)
struct switch_io_event_hook_video_write_frame * next
uint32_t switch_core_cpu_count(void)
switch_status_t switch_core_session_queue_message(_In_ switch_core_session_t *session, _In_ switch_core_session_message_t *message)
Queue a message on a session.
char * switch_stun_host_lookup(const char *host, switch_memory_pool_t *pool)
switch_bool_t T38FaxTranscodingJBIG
switch_size_t media_bytes
#define SWITCH_LOCAL_VIDEO_PORT_VARIABLE
void switch_rtp_set_telephony_recv_event(switch_rtp_t *rtp_session, switch_payload_t te)
switch_status_t switch_core_media_bug_patch_spy_frame(switch_media_bug_t *bug, switch_image_t *img, switch_rw_t rw)
uint32_t max_missed_hold_packets
Abstract handler to a timer module.
#define SWITCH_DEFAULT_VIDEO_SIZE
switch_size_t dtmf_packet_count
void switch_resample_destroy(switch_audio_resampler_t **resampler)
Destroy an existing resampler handle.
static switch_thread_t * thread
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
struct switch_runtime runtime
static int switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
uint32_t switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Test for presence of given flag on a given channel.
static int32_t switch_parse_bandwidth_string(const char *bwv)
switch_thread_id_t thread_id
switch_secure_settings_t ssec[CRYPTO_INVALID+1]
switch_size_t switch_b64_decode(char *in, char *out, switch_size_t olen)
#define switch_check_network_list_ip(_ip_str, _list_name)
payload_map_t * payload_map
struct apr_thread_cond_t switch_thread_cond_t
switch_status_t switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
Read a frame from a session.
static uint32_t switch_known_bitrate(switch_payload_t payload)
#define SWITCH_ADVERTISED_MEDIA_IP_VARIABLE
A message object designed to allow unlike technologies to exchange data.
switch_image_t * switch_img_alloc(switch_image_t *img, switch_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align)
Open a descriptor, allocating storage for the underlying image.
void switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max)
switch_port_t switch_rtp_get_remote_port(switch_rtp_t *rtp_session)
struct payload_map_s * next
switch_media_handle_t * media_handle
void rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp_flush_t flush)
switch_status_t switch_core_thread_set_cpu_affinity(int cpu)
void switch_core_session_unset_write_codec(_In_ switch_core_session_t *session)
#define SWITCH_LOCAL_MEDIA_PORT_VARIABLE
static int switch_safe_atoi(const char *nptr, int dft)
Turn a string into a number (default if NULL)
switch_status_t switch_rtp_udptl_mode(switch_rtp_t *rtp_session)
void switch_rtp_reset_media_timer(switch_rtp_t *rtp_session)
void switch_rtp_set_telephony_event(switch_rtp_t *rtp_session, switch_payload_t te)
Set the payload type to consider RFC2833 DTMF.
static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice)
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
switch_status_t switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock)
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)
switch_frame_t read_frame
_Ret_ switch_channel_t * switch_core_session_get_channel(_In_ switch_core_session_t *session)
Retrieve a pointer to the channel object associated with a given session.
switch_codec_control_command_t
void switch_rtp_destroy(switch_rtp_t **rtp_session)
Destroy an RTP session.
void switch_core_recovery_track(switch_core_session_t *session)
#define SWITCH_ORIGINATOR_CODEC_VARIABLE
void switch_channel_clear_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]
int switch_core_cert_gen_fingerprint(const char *prefix, dtls_fingerprint_t *fp)
void switch_channel_mark_hold(switch_channel_t *channel, switch_bool_t on)
#define SWITCH_MUTEX_NESTED
#define SWITCH_RTCP_AUDIO_INTERVAL_MSEC
switch_status_t switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session)
switch_jb_t * switch_rtp_get_jitter_buffer(switch_rtp_t *rtp_session)
void switch_core_session_enable_heartbeat(switch_core_session_t *session, uint32_t seconds)
switch_codec_t write_codec
switch_status_t switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flags)
Read data from a given RTP session without copying.
switch_memory_pool_t * pool
switch_codec_control_type_t
const switch_codec_implementation_t * implementation
#define SWITCH_REMOTE_MEDIA_IP_VARIABLE
if((uint32_t)(unpack->cur-unpack->buf) > unpack->buflen)
switch_port_t remote_rtp_ice_port
switch_rtcp_numbers_t rtcp
switch_byte_t switch_byte_t * buf
#define SWITCH_STUN_DEFAULT_PORT
int microseconds_per_packet
#define switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
uint32_t switch_core_media_bug_prune(switch_core_session_t *session)
#define switch_channel_audio_sync(_c)
unsigned int switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen)
Separate a string into an array based on a character delimiter.
switch_channel_t * channel
switch_rtp_t * rtp_session
uint32_t highest_sequence_number_received
void switch_stun_random_string(char *buf, uint16_t len, char *set)
Writes random characters into a buffer.
const char * switch_channel_get_hold_music(switch_channel_t *channel)
switch_timer_interface_t * timer_interface
switch_status_t switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames, uint32_t max_queue_frames, uint32_t samples_per_packet, uint32_t samples_per_second)
Acvite a jitter buffer on an RTP session.
int switch_rtp_has_dtls(void)
#define SWITCH_RTP_MAX_CRYPTO_LEN
switch_codec_t read_codec
switch_frame_flag_t flags
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
switch_media_flow_t rmode
switch_status_t switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen)
switch_status_t switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len)
switch_codec_type_t codec_type
uint32_t switch_channel_test_cap_partner(switch_channel_t *channel, switch_channel_cap_t cap)
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
uint32_t actual_samples_per_second
switch_status_t switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin, const char *password, const char *rpassword, ice_proto_t proto, switch_core_media_ice_type_t type, ice_t *ice_params)
Acvite ICE on an RTP session.
#define switch_channel_get_variable(_c, _v)
#define SWITCH_THREAD_STACKSIZE
#define switch_channel_video_sync(_c)
void switch_rtp_set_flags(switch_rtp_t *rtp_session, switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID])
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.
#define switch_zmalloc(ptr, len)
void switch_img_copy(switch_image_t *img, switch_image_t **new_img)
Copy image to a new image.
payload_map_t * cur_payload_map
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
switch_rtp_numbers_t outbound
void switch_rtp_video_loss(switch_rtp_t *rtp_session)
dtls_fingerprint_t local_dtls_fingerprint
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
switch_status_t switch_rtp_set_remote_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc)
switch_image_t * switch_img_read_png(const char *file_name, switch_img_fmt_t img_fmt)
int switch_loadable_module_get_codecs(const switch_codec_implementation_t **array, int arraylen)
Retrieve the list of loaded codecs into an array.
switch_status_t switch_rtp_set_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc)
#define switch_channel_down_nosig(_channel)
switch_sdp_type_t sdp_type
An abstraction of a data frame.
#define switch_set_flag_locked(obj, flag)
Set a flag on an arbitrary object while locked.
uint32_t switch_default_ptime(const char *name, uint32_t number)
const char * T38VendorInfo
switch_codec_t * switch_core_session_get_video_write_codec(_In_ switch_core_session_t *session)
Retrieve the video_write codec from a given session.
switch_size_t switch_rtp_has_dtmf(switch_rtp_t *rtp_session)
Test for presence of DTMF on a given RTP session.
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.
switch_port_t local_sdp_port
pthread_t switch_thread_id_t
void switch_cond_next(void)
#define switch_core_session_get_partner(_session, _partner)
switch_status_t switch_img_letterbox(switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color)
switch_payload_t agreed_pt
int microseconds_per_packet
char * switch_core_get_variable(_In_z_ const char *varname)
Retrieve a global variable from the core.
switch_status_t switch_nat_del_mapping(switch_port_t port, switch_nat_ip_proto_t proto)
Deletes a NAT mapping.
switch_size_t packet_count
switch_status_t switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, switch_port_t remote_rtcp_port, switch_bool_t change_adv_addr, const char **err)
Assign a remote address to the RTP session.
payload_map_t * pmap_tail
void switch_color_set_rgb(switch_rgb_color_t *color, const char *color_str)
Set RGB color with a string.
switch_status_t switch_core_timer_destroy(switch_timer_t *timer)
Destroy an allocated timer.
uint32_t actual_samples_per_second
#define switch_core_session_receive_message(_session, _message)
void switch_core_session_rwunlock(_In_ switch_core_session_t *session)
Unlock a read or write lock on as given session.
void switch_core_session_video_reset(switch_core_session_t *session)
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
switch_size_t jb_packet_count
#define SWITCH_RTCP_VIDEO_INTERVAL_MSEC
switch_status_t switch_core_codec_encode_video(switch_codec_t *codec, switch_frame_t *frame)
Encode video data using a codec handle.
switch_size_t skip_packet_count
void switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_payload_t pt)
Set the payload type for comfort noise.
void switch_channel_set_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
#define SWITCH_LOCAL_MEDIA_IP_VARIABLE
#define switch_str_nil(s)
Make a null string a blank string instead.
switch_status_t switch_core_timer_next(switch_timer_t *timer)
Wait for one cycle on an existing timer.
switch_status_t switch_core_codec_init_with_bitrate(switch_codec_t *codec, const char *codec_name, const char *fmtp, const char *modname, uint32_t rate, int ms, int channels, uint32_t bitrate, uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool)
int switch_thread_equal(switch_thread_id_t tid1, switch_thread_id_t tid2)
Compare two thread ids.
void switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flag)
Clear an RTP Flag.
const char * switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname)
switch_core_video_thread_callback_func_t video_read_callback
dtls_fingerprint_t remote_dtls_fingerprint
switch_port_t switch_rtp_request_port(const char *ip)
Request a new port to be used for media.
#define SWITCH_R_SDP_VARIABLE
uint32_t samples_per_packet
void switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flag)
Set an RTP Flag.
#define switch_channel_down(_channel)
uint8_t number_of_channels
struct apr_thread_mutex_t switch_mutex_t
int switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, int arraylen, char **prefs, int preflen)
Retrieve the list of loaded codecs into an array based on another array showing the sorted order...
uint32_t samples_per_second
char * switch_rtp_get_remote_host(switch_rtp_t *rtp_session)
switch_status_t
Common return values.
switch_timer_t * switch_rtp_get_media_timer(switch_rtp_t *rtp_session)
void * switch_channel_get_private(switch_channel_t *channel, const char *key)
Retrieve private from a given channel.
#define switch_goto_status(_status, _label)
uint32_t switch_rtp_get_ssrc(switch_rtp_t *rtp_session)
Retrieve the SSRC from a given RTP session.
switch_size_t switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_dtmf_t *dtmf)
Retrieve DTMF digits from a given RTP session.
void switch_rtp_flush(switch_rtp_t *rtp_session)
switch_status_t switch_ivr_unhold(switch_core_session_t *session)
Signal the session with a protocol specific unhold message.
switch_status_t switch_core_session_write_encoded_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
const switch_codec_implementation_t * imp
void switch_core_session_lock_codec_write(_In_ switch_core_session_t *session)
char * remote_rtp_ice_addr
void switch_rtp_break(switch_rtp_t *rtp_session)
void switch_rtp_reset_jb(switch_rtp_t *rtp_session)
void switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
Fill image with color.
An abstraction of a rtcp frame.
switch_payload_t ianacode
struct apr_thread_t switch_thread_t
#define switch_core_session_locate(uuid_str)
Locate a session based on it's uuid.
switch_rtp_flag_t
RTP Related Flags.
#define SWITCH_B_SDP_VARIABLE
void switch_rtp_get_random(void *buf, uint32_t len)
switch_status_t switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf)
Queue RFC2833 DTMF data into an RTP Session.
void switch_rtp_set_default_payload(switch_rtp_t *rtp_session, switch_payload_t payload)
Set the default payload number for a given RTP session.
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
uint32_t encoded_bytes_per_packet
char * cand_acl[SWITCH_MAX_CAND_ACL]
switch_size_t flush_packet_count
switch_port_t adv_sdp_port
switch_status_t switch_rtp_add_dtls(switch_rtp_t *rtp_session, dtls_fingerprint_t *local_fp, dtls_fingerprint_t *remote_fp, dtls_type_t type)
#define switch_event_get_header(_e, _h)
#define SWITCH_REMOTE_VIDEO_PORT_VARIABLE
#define switch_channel_set_flag(_c, _f)
#define SWITCH_IMG_FMT_I420
switch_thread_t * media_thread
#define SWITCH_MEDIA_TYPE_TOTAL
void switch_rtp_clear_flags(switch_rtp_t *rtp_session, switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID])
uint32_t max_missed_packets
int switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame_t *frame)
Write data to a given RTP session.
switch_size_t media_packet_count
switch_rtp_stats_t * switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool)
switch_call_direction_t switch_channel_direction(switch_channel_t *channel)
switch_codec_implementation_t read_impl
#define switch_set_string(_dst, _src)
#define SWITCH_REMOTE_MEDIA_PORT_VARIABLE
switch_rtp_t * switch_rtp_new(const char *rx_host, switch_port_t rx_port, const char *tx_host, switch_port_t tx_port, switch_payload_t payload, uint32_t samples_per_interval, uint32_t ms_per_packet, switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool)
prepare a new RTP session handle and fully initilize it
switch_status_t switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames, uint32_t max_frames)
switch_port_t remote_rtcp_port
switch_status_t switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval)
switch_payload_t agreed_pt
static const char * skip(const char *in)
switch_status_t switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name)
icand_t cands[MAX_CAND][2]
time_t switch_epoch_time_now(time_t *t)
Get the current epoch time.
switch_rtp_bug_flag_t rtp_bugs
switch_status_t switch_core_session_set_write_codec(_In_ switch_core_session_t *session, switch_codec_t *codec)
Assign the write codec to a given session.
#define switch_core_session_alloc(_session, _memory)
Allocate memory from a session's pool.
switch_status_t switch_queue_push(switch_queue_t *queue, void *data)
struct apr_pool_t switch_memory_pool_t
switch_status_t switch_rtp_enable_vad(switch_rtp_t *rtp_session, switch_core_session_t *session, switch_codec_t *codec, switch_vad_flag_t flags)
Enable VAD on an RTP Session.
void switch_rtp_release_port(const char *ip, switch_port_t port)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
void switch_channel_clear_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
static switch_bool_t switch_core_codec_ready(switch_codec_t *codec)
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
const char * switch_stristr(const char *instr, const char *str)
void switch_core_session_unset_read_codec(_In_ switch_core_session_t *session)
uint32_t switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
Test an RTP Flag.
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_bool_t T38FaxFillBitRemoval
switch_port_t remote_sdp_port
void switch_core_session_unlock_codec_write(_In_ switch_core_session_t *session)
static int switch_false(const char *expr)
Evaluate the falsefullness of a string expression.
uint32_t switch_core_media_bug_test_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag)
Test for the existance of a flag on an media bug.
#define switch_channel_up_nosig(_channel)
#define switch_core_session_strdup(_session, _todup)
Copy a string using memory allocation from a session's pool.
switch_thread_id_t switch_thread_self(void)
void switch_event_destroy(switch_event_t **event)
Destroy an event.
switch_port_t remote_rtcp_ice_port
switch_status_t switch_thread_cond_broadcast(switch_thread_cond_t *cond)
switch_port_t proxy_sdp_port
switch_status_t switch_rtp_queue_rfc2833_in(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf)
Queue RFC2833 DTMF data into an RTP Session.
void switch_rtp_kill_socket(switch_rtp_t *rtp_session)
Kill the socket on an existing RTP session.
int switch_core_gen_certs(const char *prefix)
static uint32_t switch_round_to_step(uint32_t num, uint32_t step)
switch_status_t switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint32_t to, switch_channel_t *super_channel)
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
int switch_channel_test_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
#define switch_channel_set_variable(_channel, _var, _val)
void switch_rtp_video_refresh(switch_rtp_t *rtp_session)
switch_time_t switch_time_now(void)
switch_codec_implementation_t write_impl
switch_rtp_crypto_key_type_t crypto_type
switch_status_t switch_channel_api_on(switch_channel_t *channel, const char *variable_prefix)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
switch_status_t switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh)
Signal the session with a protocol specific hold message.
switch_status_t switch_rtp_req_bitrate(switch_rtp_t *rtp_session, uint32_t bps)
#define SWITCH_READ_ACCEPTABLE(status)
switch_status_t switch_stun_lookup(char **ip, switch_port_t *port, char *stunip, switch_port_t stunport, char **err, switch_memory_pool_t *pool)
Perform a stun lookup.
switch_status_t switch_rtcp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_rtcp_frame_t *frame)
Read RTCP data from a given RTP session without copying.
void switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay)
switch_status_t switch_core_session_set_write_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
#define switch_channel_media_up(_channel)
switch_status_t switch_rtp_sync_stats(switch_rtp_t *rtp_session)
#define SWITCH_CHANNEL_CHANNEL_LOG(x)
switch_memory_pool_t * switch_core_session_get_pool(_In_ switch_core_session_t *session)
Retrieve the memory pool from a session.
void switch_core_session_unlock_codec_read(_In_ switch_core_session_t *session)
uint8_t try_hardware_encoder
#define SWITCH_REMOTE_VIDEO_IP_VARIABLE
switch_status_t switch_core_codec_control(switch_codec_t *codec, switch_codec_control_command_t cmd, switch_codec_control_type_t ctype, void *cmd_data, switch_codec_control_type_t atype, void *cmd_arg, switch_codec_control_type_t *rtype, void **ret_data)
send control data using a codec handle
switch_status_t switch_core_session_set_real_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec)
Assign the original read codec to a given session. This is the read codec used by an endpoint...
switch_status_t switch_core_timer_sync(switch_timer_t *timer)
switch_size_t cng_packet_count
switch_rtp_crypto_key_type_t type
switch_rtp_crypto_key_type_t crypto_type