Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
45b4ba1a
提交
45b4ba1a
authored
2月 21, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add webrtc_enable_dtls=false (for webrtc) or enable_dtls=true (for normal calls)
上级
45bd5952
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
37 行增加
和
6 行删除
+37
-6
switch_types.h
src/include/switch_types.h
+1
-0
switch_core_media.c
src/switch_core_media.c
+36
-6
没有找到文件。
src/include/switch_types.h
浏览文件 @
45b4ba1a
...
...
@@ -1301,6 +1301,7 @@ typedef enum {
CF_ICE
,
CF_DTLS
,
CF_VERBOSE_SDP
,
CF_DTLS_OK
,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
CF_FLAG_MAX
...
...
src/switch_core_media.c
浏览文件 @
45b4ba1a
...
...
@@ -1805,6 +1805,11 @@ static void generate_local_fingerprint(switch_media_handle_t *smh, switch_media_
}
}
//?
static int dtls_ok(switch_core_session_t *session)
{
return switch_channel_test_flag(session->channel, CF_DTLS_OK);
}
//?
static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_session_t *sdp, sdp_media_t *m)
...
...
@@ -1812,11 +1817,21 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
switch_rtp_engine_t *engine = &smh->engines[type];
sdp_attribute_t *attr;
int i = 0, got_rtcp_mux = 0;
const char *tmp;
engine->ice_in.chosen[0] = 0;
engine->ice_in.chosen[1] = 0;
engine->ice_in.cand_idx = 0;
if (!(tmp = switch_channel_get_variable(smh->session->channel, "webrtc_enable_dtls")) || switch_true(tmp)) {
switch_channel_set_flag(smh->session->channel, CF_DTLS_OK);
}
if (!(tmp = switch_channel_get_variable(smh->session->channel, "enable_dtls")) || switch_true(tmp)) {
switch_channel_set_flag(smh->session->channel, CF_DTLS_OK);
}
if (m) {
attr = m->m_attributes;
} else {
...
...
@@ -1840,7 +1855,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
} else if (!strcasecmp(attr->a_name, "ice-options")) {
engine->ice_in.options = switch_core_session_strdup(smh->session, attr->a_value);
}
else
if
(
switch_rtp_has_dtls
()
&&
!
strcasecmp
(
attr
->
a_name
,
"fingerprint"
)
&&
!
zstr
(
attr
->
a_value
))
{
} else if (switch_rtp_has_dtls() &&
dtls_ok(smh->session) &&
!strcasecmp(attr->a_name, "fingerprint") && !zstr(attr->a_value)) {
char *p;
engine->remote_dtls_fingerprint.type = switch_core_session_strdup(smh->session, attr->a_value);
...
...
@@ -2047,6 +2062,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
SWITCH_DECLARE(void) switch_core_session_set_ice(switch_core_session_t *session)
{
switch_media_handle_t *smh;
const char *tmp;
switch_assert(session);
...
...
@@ -2054,6 +2070,10 @@ SWITCH_DECLARE(void) switch_core_session_set_ice(switch_core_session_t *session)
return;
}
if (!(tmp = switch_channel_get_variable(session->channel, "webrtc_enable_dtls")) || switch_true(tmp)) {
switch_channel_set_flag(session->channel, CF_DTLS_OK);
}
switch_channel_set_flag(session->channel, CF_VERBOSE_SDP);
switch_channel_set_flag(session->channel, CF_WEBRTC);
switch_channel_set_flag(session->channel, CF_ICE);
...
...
@@ -2381,7 +2401,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
} else if (m->m_type == sdp_media_audio && m->m_port && !got_audio) {
sdp_rtpmap_t *map;
if
(
switch_rtp_has_dtls
())
{
if (switch_rtp_has_dtls()
&& dtls_ok(session)
) {
for (attr = m->m_attributes; attr; attr = attr->a_next) {
if (!strcasecmp(attr->a_name, "fingerprint") && !zstr(attr->a_value)) {
...
...
@@ -2773,7 +2793,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
for (map = m->m_rtpmaps; map; map = map->rm_next) {
if
(
switch_rtp_has_dtls
())
{
if (switch_rtp_has_dtls()
&& dtls_ok(session)
) {
for (attr = m->m_attributes; attr; attr = attr->a_next) {
if (!strcasecmp(attr->a_name, "fingerprint") && !zstr(attr->a_value)) {
got_video_crypto = 1;
...
...
@@ -3894,7 +3914,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
}
if
(
!
zstr
(
a_engine
->
local_dtls_fingerprint
.
str
)
&&
switch_rtp_has_dtls
())
{
if (!zstr(a_engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls()
&& dtls_ok(smh->session)
) {
dtls_type_t xtype, dtype = switch_channel_direction(smh->session->channel) == SWITCH_CALL_DIRECTION_INBOUND ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER;
...
...
@@ -4291,7 +4311,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
}
if
(
!
zstr
(
v_engine
->
local_dtls_fingerprint
.
str
)
&&
switch_rtp_has_dtls
())
{
if (!zstr(v_engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls()
&& dtls_ok(smh->session)
) {
dtls_type_t xtype,
dtype = switch_channel_direction(smh->session->channel) == SWITCH_CALL_DIRECTION_INBOUND ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER;
xtype = DTLS_TYPE_RTP;
...
...
@@ -4773,6 +4793,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
const char *local_audio_crypto_key = switch_core_session_local_crypto_key(session, SWITCH_MEDIA_TYPE_AUDIO);
const char *local_sdp_audio_zrtp_hash = switch_core_media_get_zrtp_hash(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_TRUE);
const char *local_sdp_video_zrtp_hash = switch_core_media_get_zrtp_hash(session, SWITCH_MEDIA_TYPE_VIDEO, SWITCH_TRUE);
const char *tmp;
switch_rtp_engine_t *a_engine, *v_engine;
switch_media_handle_t *smh;
ice_t *ice_out;
...
...
@@ -4786,6 +4807,15 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
if (!(tmp = switch_channel_get_variable(smh->session->channel, "enable_dtls")) || switch_true(tmp)) {
switch_channel_set_flag(session->channel, CF_DTLS_OK);
}
if (switch_channel_test_flag(session->channel, CF_WEBRTC)) {
if (!(tmp = switch_channel_get_variable(session->channel, "webrtc_enable_dtls")) || switch_true(tmp)) {
switch_channel_set_flag(session->channel, CF_DTLS_OK);
}
}
if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
...
...
@@ -4797,7 +4827,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
smh->mparams->rtcp_video_interval_msec = "5000";
}
if
(
switch_rtp_has_dtls
()
)
{
if ( switch_rtp_has_dtls()
&& dtls_ok(session)
) {
if (switch_channel_test_flag(session->channel, CF_WEBRTC) ||
switch_true(switch_channel_get_variable(smh->session->channel, "rtp_use_dtls"))) {
switch_channel_set_flag(smh->session->channel, CF_DTLS);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论