SWITCH_DECLARE(switch_status_t) switch_core_media_get_vid_params(switch_core_session_t *session, switch_vid_params_t *vid_params);
SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_session_t *session, switch_file_handle_t *fh, switch_rw_t rw);
SWITCH_DECLARE(switch_bool_t) switch_core_session_in_video_thread(switch_core_session_t *session);
+SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t *session);
SWITCH_END_EXTERN_C
#endif
\return true or false
*/
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t *port);
+SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_xor_mapped_address(switch_stun_packet_attribute_t *attribute, uint32_t cookie, char *ipstr, uint16_t *port);
+
/*!
\brief Extract a username from a packet attribute
stream->write_function(stream, "Dialplan \t%s\n", switch_str_nil(profile->dialplan));
stream->write_function(stream, "Context \t%s\n", switch_str_nil(profile->context));
stream->write_function(stream, "Challenge Realm \t%s\n", zstr(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
+
for (x = 0; x < profile->rtpip_index; x++) {
stream->write_function(stream, "RTP-IP \t%s\n", switch_str_nil(profile->rtpip[x]));
}
+
+ for (x = 0; x < profile->rtpip_index6; x++) {
+ stream->write_function(stream, "RTP-IP \t%s\n", switch_str_nil(profile->rtpip6[x]));
+ }
+
if (profile->extrtpip) {
stream->write_function(stream, "Ext-RTP-IP \t%s\n", profile->extrtpip);
}
for (x = 0; x < profile->rtpip_index; x++) {
stream->write_function(stream, " <rtp-ip>%s</rtp-ip>\n", switch_str_nil(profile->rtpip[x]));
}
+ for (x = 0; x < profile->rtpip_index6; x++) {
+ stream->write_function(stream, " <rtp-ip>%s</rtp-ip>\n", switch_str_nil(profile->rtpip6[x]));
+ }
if (profile->extrtpip) {
stream->write_function(stream, " <ext-rtp-ip>%s</ext-rtp-ip>\n", profile->extrtpip);
}
}
if (!strcmp(profile->rtpip[x], old_ip6)) {
- profile->rtpip[x] = switch_core_strdup(profile->pool, new_ip6);
+ profile->rtpip6[x] = switch_core_strdup(profile->pool, new_ip6);
rb++;
}
}
char *shutdown_type;
char *extrtpip;
char *rtpip[MAX_RTPIP];
+ char *rtpip6[MAX_RTPIP];
char *jb_msec;
switch_payload_t te;
switch_payload_t recv_te;
uint32_t rtpip_index;
uint32_t rtpip_next;
+ uint32_t rtpip_index6;
+ uint32_t rtpip_next6;
char *rtcp_audio_interval_msec;
char *rtcp_video_interval_msec;
profile->ob_failed_calls = 0;
profile->shutdown_type = "false";
profile->rtpip_index = 0;
+ profile->rtpip_index6 = 0;
if (xprofiledomain) {
profile->domain_name = switch_core_strdup(profile->pool, xprofiledomain);
} else {
ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
}
- if (profile->rtpip_index < MAX_RTPIP) {
- profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, ip);
+
+ if (strchr(ip, ':')) {
+ if (profile->rtpip_index < MAX_RTPIP) {
+ profile->rtpip6[profile->rtpip_index6++] = switch_core_strdup(profile->pool, ip);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Max IPs configured for profile %s.\n", profile->name);
+ }
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Max IPs configured for profile %s.\n", profile->name);
+ if (profile->rtpip_index6 < MAX_RTPIP) {
+ profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, ip);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Max IPs configured for profile %s.\n", profile->name);
+ }
}
} else if (!strcasecmp(var, "sip-ip")) {
char *ip = mod_sofia_globals.guess_ip;
profile->sipip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
}
- if (!profile->rtpip[0]) {
+ if (!profile->rtpip[0] && !profile->rtpip6[0]) {
profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
}
profile->sdp_username = switch_core_strdup(profile->pool, "FreeSWITCH");
}
- if (!profile->rtpip[0]) {
+ if (!profile->rtpip[0] && !profile->rtpip6[0]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Setting ip to '127.0.0.1'\n");
profile->rtpip[profile->rtpip_index++] = switch_core_strdup(profile->pool, "127.0.0.1");
}
tech_pvt->profile = profile;
- tech_pvt->mparams.rtpip = switch_core_session_strdup(session, profile->rtpip[profile->rtpip_next++]);
- if (profile->rtpip_next >= profile->rtpip_index) {
- profile->rtpip_next = 0;
+ if (!zstr(profile->rtpip[profile->rtpip_next])) {
+ tech_pvt->mparams.rtpip4 = switch_core_session_strdup(session, profile->rtpip[profile->rtpip_next++]);
+ tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip4;
+
+ if (profile->rtpip_next >= profile->rtpip_index) {
+ profile->rtpip_next = 0;
+ }
+ }
+
+ if (!zstr(profile->rtpip[profile->rtpip_next6])) {
+ tech_pvt->mparams.rtpip6 = switch_core_session_strdup(session, profile->rtpip[profile->rtpip_next6++]);
+
+ if (zstr(tech_pvt->mparams.rtpip)) {
+ tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip6;
+ }
+
+ if (profile->rtpip_next6 >= profile->rtpip_index6) {
+ profile->rtpip_next6 = 0;
+ }
}
profile->inuse++;
};
-static switch_bool_t check_dtls(switch_core_session_t *session);
-
static switch_srtp_crypto_suite_t SUITES[CRYPTO_INVALID] = {
{ "AEAD_AES_256_GCM_8", AEAD_AES_256_GCM_8, 44},
{ "AEAD_AES_128_GCM_8", AEAD_AES_128_GCM_8, 28},
end:
-
switch_channel_clear_flag(session->channel, CF_REINVITE);
switch_core_recovery_track(session);
-
-
return status;
}
return 1;
}
-static switch_bool_t check_dtls(switch_core_session_t *session)
+SWITCH_DECLARE(switch_bool_t) switch_core_media_check_dtls(switch_core_session_t *session)
{
switch_media_handle_t *smh;
switch_rtp_engine_t *a_engine, *v_engine;
return SWITCH_FALSE;
}
- if (switch_channel_down(session->channel)) {
+ if (!switch_channel_media_up(session->channel)) {
return SWITCH_FALSE;
}
}
break;
- case SWITCH_MESSAGE_INDICATE_ANSWER:
- case SWITCH_MESSAGE_INDICATE_PROGRESS:
- case SWITCH_MESSAGE_ANSWER_EVENT:
- case SWITCH_MESSAGE_PROGRESS_EVENT:
- {
- check_dtls(session);
- }
- break;
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
{
if (v_engine->rtp_session) {
}
}
}
+
+ if (state > CS_INIT && switch_channel_media_up(session->channel)) {
+ switch_core_media_check_dtls(session);
+ }
switch (state) {
case CS_NEW: /* Just created, Waiting for first instructions */
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "STUN PACKET TYPE: %s\n",
switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type));
do {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|---: STUN ATTR %s\n",
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|---: STUN ATTR %d %x %s\n", attr->type, attr->type,
switch_stun_value_to_name(SWITCH_STUN_TYPE_ATTRIBUTE, attr->type));
switch (attr->type) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|------: %s:%d\n", ip, port);
}
break;
+ case SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS:
+ if (attr->type) {
+ char ip[16];
+ uint16_t port;
+ switch_stun_packet_attribute_get_xor_mapped_address(attr, packet->header.cookie, ip, &port);
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG8, "|------: %s:%d\n", ip, port);
+ }
+ break;
case SWITCH_STUN_ATTR_USERNAME:
if (attr->type) {
switch_stun_packet_attribute_get_username(attr, username, sizeof(username));
static const struct value_mapping ATTR_TYPES[] = {
{SWITCH_STUN_ATTR_MAPPED_ADDRESS, "MAPPED_ADDRESS"},
+ {SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS, "XOR_MAPPED_ADDRESS"},
{SWITCH_STUN_ATTR_RESPONSE_ADDRESS, "RESPONSE_ADDRESS"},
{SWITCH_STUN_ATTR_CHANGE_REQUEST, "CHANGE_REQUEST"},
{SWITCH_STUN_ATTR_SOURCE_ADDRESS, "SOURCE_ADDRESS"},