Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
052ee0a1
提交
052ee0a1
authored
1月 14, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip
上级
7510bccd
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
92 行增加
和
10 行删除
+92
-10
switch_core_media.c
src/switch_core_media.c
+88
-8
switch_rtp.c
src/switch_rtp.c
+4
-2
没有找到文件。
src/switch_core_media.c
浏览文件 @
052ee0a1
...
@@ -761,6 +761,8 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
...
@@ -761,6 +761,8 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
if
(
!
session
->
media_handle
)
return
0
;
if
(
!
session
->
media_handle
)
return
0
;
engine
=
&
session
->
media_handle
->
engines
[
type
];
engine
=
&
session
->
media_handle
->
engines
[
type
];
if
(
type
==
SWITCH_MEDIA_TYPE_VIDEO
)
printf
(
"XXXXXXXXXXXXXXXXXXXXXXXXX
\n
"
);
if
(
engine
->
ssec
.
remote_crypto_key
&&
switch_rtp_ready
(
engine
->
rtp_session
))
{
if
(
engine
->
ssec
.
remote_crypto_key
&&
switch_rtp_ready
(
engine
->
rtp_session
))
{
/* Compare all the key. The tag may remain the same even if key changed */
/* Compare all the key. The tag may remain the same even if key changed */
if
(
crypto
&&
!
strcmp
(
crypto
,
engine
->
ssec
.
remote_crypto_key
))
{
if
(
crypto
&&
!
strcmp
(
crypto
,
engine
->
ssec
.
remote_crypto_key
))
{
...
@@ -2262,7 +2264,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2262,7 +2264,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
got_audio
=
0
;
got_audio
=
0
;
}
}
}
}
printf
(
"WTF ===M %d %d
\n
"
,
m
->
m_proto
,
m
->
m_type
);
for
(
map
=
m
->
m_rtpmaps
;
map
;
map
=
map
->
rm_next
)
{
for
(
map
=
m
->
m_rtpmaps
;
map
;
map
=
map
->
rm_next
)
{
int32_t
i
;
int32_t
i
;
uint32_t
near_rate
=
0
;
uint32_t
near_rate
=
0
;
...
@@ -2280,8 +2282,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2280,8 +2282,6 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
rm_encoding
=
""
;
rm_encoding
=
""
;
}
}
printf
(
"WTF === AUDIO MMMM! %s
\n
"
,
rm_encoding
);
if
(
!
strcasecmp
(
rm_encoding
,
"telephone-event"
))
{
if
(
!
strcasecmp
(
rm_encoding
,
"telephone-event"
))
{
if
(
!
best_te
||
map
->
rm_rate
==
a_engine
->
codec_params
.
rm_rate
)
{
if
(
!
best_te
||
map
->
rm_rate
==
a_engine
->
codec_params
.
rm_rate
)
{
best_te
=
(
switch_payload_t
)
map
->
rm_pt
;
best_te
=
(
switch_payload_t
)
map
->
rm_pt
;
...
@@ -2529,13 +2529,15 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2529,13 +2529,15 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
for
(
map
=
m
->
m_rtpmaps
;
map
;
map
=
map
->
rm_next
)
{
for
(
map
=
m
->
m_rtpmaps
;
map
;
map
=
map
->
rm_next
)
{
for
(
attr
=
m
->
m_attributes
;
attr
;
attr
=
attr
->
a_next
)
{
for
(
attr
=
m
->
m_attributes
;
attr
;
attr
=
attr
->
a_next
)
{
printf
(
"WTF %s == %s
\n
"
,
attr
->
a_name
,
attr
->
a_value
);
if
(
!
strcasecmp
(
attr
->
a_name
,
"framerate"
)
&&
attr
->
a_value
)
{
if
(
!
strcasecmp
(
attr
->
a_name
,
"framerate"
)
&&
attr
->
a_value
)
{
//framerate = atoi(attr->a_value);
//framerate = atoi(attr->a_value);
}
}
if
(
!
strcasecmp
(
attr
->
a_name
,
"rtcp"
)
&&
attr
->
a_value
)
{
if
(
!
strcasecmp
(
attr
->
a_name
,
"rtcp"
)
&&
attr
->
a_value
)
{
switch_channel_set_variable
(
session
->
channel
,
"sip_remote_video_rtcp_port"
,
attr
->
a_value
);
switch_channel_set_variable
(
session
->
channel
,
"sip_remote_video_rtcp_port"
,
attr
->
a_value
);
}
else
if
(
!
got_crypto
&&
!
strcasecmp
(
attr
->
a_name
,
"crypto"
)
&&
!
zstr
(
attr
->
a_value
))
{
}
else
if
(
!
got_
video_
crypto
&&
!
strcasecmp
(
attr
->
a_name
,
"crypto"
)
&&
!
zstr
(
attr
->
a_value
))
{
int
crypto_tag
;
int
crypto_tag
;
if
(
!
(
smh
->
mparams
->
ndlb
&
SM_NDLB_ALLOW_CRYPTO_IN_AVP
)
&&
if
(
!
(
smh
->
mparams
->
ndlb
&
SM_NDLB_ALLOW_CRYPTO_IN_AVP
)
&&
...
@@ -2556,7 +2558,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
...
@@ -2556,7 +2558,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
}
}
}
}
if
(
got_video_crypto
&&
!
got_video_avp
)
{
if
(
got_video_crypto
&&
!
got_video_avp
)
{
switch_channel_set_variable
(
session
->
channel
,
"rtp_crypto_mandatory"
,
"true"
);
switch_channel_set_variable
(
session
->
channel
,
"rtp_crypto_mandatory"
,
"true"
);
switch_channel_set_variable
(
session
->
channel
,
"rtp_secure_media"
,
"true"
);
switch_channel_set_variable
(
session
->
channel
,
"rtp_secure_media"
,
"true"
);
...
@@ -3894,7 +3896,44 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
...
@@ -3894,7 +3896,44 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
v_engine
->
ssrc
=
ssrc_ul
;
v_engine
->
ssrc
=
ssrc_ul
;
}
}
if
(
v_engine
->
ice_in
.
cands
[
0
].
ready
)
{
gen_ice
(
session
,
SWITCH_MEDIA_TYPE_VIDEO
,
""
,
0
);
switch_rtp_activate_ice
(
v_engine
->
rtp_session
,
v_engine
->
ice_in
.
ufrag
,
v_engine
->
ice_out
.
ufrag
,
v_engine
->
ice_out
.
pwd
,
v_engine
->
ice_in
.
pwd
,
#ifdef GOOGLE_ICE
ICE_GOOGLE_JINGLE
,
0
#else
ICE_VANILLA
|
ICE_CONTROLLED
,
v_engine
->
ice_in
.
cands
[
0
].
priority
#endif
);
if
(
v_engine
->
ice_in
.
cands
[
1
].
ready
)
{
switch_rtp_activate_rtcp_ice
(
v_engine
->
rtp_session
,
v_engine
->
ice_in
.
ufrag
,
v_engine
->
ice_out
.
ufrag
,
v_engine
->
ice_out
.
pwd
,
v_engine
->
ice_in
.
pwd
,
#ifdef GOOGLE_ICE
ICE_GOOGLE_JINGLE
,
0
#else
ICE_VANILLA
|
ICE_CONTROLLED
,
v_engine
->
ice_in
.
cands
[
1
].
priority
#endif
);
}
}
if
((
val
=
switch_channel_get_variable
(
session
->
channel
,
"rtp_manual_video_rtp_bugs"
)))
{
if
((
val
=
switch_channel_get_variable
(
session
->
channel
,
"rtp_manual_video_rtp_bugs"
)))
{
switch_core_media_parse_rtp_bugs
(
&
v_engine
->
rtp_bugs
,
val
);
switch_core_media_parse_rtp_bugs
(
&
v_engine
->
rtp_bugs
,
val
);
...
@@ -4670,11 +4709,52 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -4670,11 +4709,52 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if
(
v_engine
->
ice_out
.
cands
[
0
].
ready
)
{
if
(
v_engine
->
ice_out
.
cands
[
0
].
ready
)
{
char
tmp1
[
11
]
=
""
;
char
tmp2
[
11
]
=
""
;
uint32_t
c1
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
1
);
uint32_t
c2
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65535
+
(
2
^
0
)
*
(
256
-
2
);
uint32_t
c3
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65534
+
(
2
^
0
)
*
(
256
-
1
);
uint32_t
c4
=
(
2
^
24
)
*
126
+
(
2
^
8
)
*
65534
+
(
2
^
0
)
*
(
256
-
2
);
tmp1
[
10
]
=
'\0'
;
tmp2
[
10
]
=
'\0'
;
switch_stun_random_string
(
tmp1
,
10
,
"0123456789"
);
switch_stun_random_string
(
tmp2
,
10
,
"0123456789"
);
ice_out
=
&
v_engine
->
ice_out
;
ice_out
=
&
v_engine
->
ice_out
;
// VID CANDS HERE
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=ice-ufrag:%s
\n
"
,
ice_out
->
ufrag
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=ice-pwd:%s
\n
"
,
ice_out
->
pwd
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 1 %s %u %s %d typ host generation 0
\n
"
,
tmp1
,
ice_out
->
cands
[
0
].
transport
,
c1
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 1 %s %u %s %d typ srflx generation 0
\n
"
,
tmp2
,
ice_out
->
cands
[
0
].
transport
,
c3
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ host generation 0
\n
"
,
tmp1
,
ice_out
->
cands
[
0
].
transport
,
c2
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
1
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=candidate:%s 2 %s %u %s %d typ srflx generation 0
\n
"
,
tmp2
,
ice_out
->
cands
[
0
].
transport
,
c4
,
ice_out
->
cands
[
0
].
con_addr
,
ice_out
->
cands
[
0
].
con_port
+
1
);
#ifdef GOOGLE_ICE
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=ice-options:google-ice
\n
"
);
#endif
}
}
rate
=
v_engine
->
codec_params
.
rm_rate
;
rate
=
v_engine
->
codec_params
.
rm_rate
;
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtpmap:%d %s/%ld
\n
"
,
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=rtpmap:%d %s/%ld
\n
"
,
...
@@ -4752,7 +4832,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
...
@@ -4752,7 +4832,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
}
}
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_SECURE
))
{
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_SECURE
)
&&
!
zstr
(
local_video_crypto_key
)
)
{
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=crypto:%s
\n
"
,
local_video_crypto_key
);
switch_snprintf
(
buf
+
strlen
(
buf
),
SDPBUFLEN
-
strlen
(
buf
),
"a=crypto:%s
\n
"
,
local_video_crypto_key
);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
}
}
...
...
src/switch_rtp.c
浏览文件 @
052ee0a1
...
@@ -1888,7 +1888,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
...
@@ -1888,7 +1888,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
}
}
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating Secure RTP RECV
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating %s Secure RTP RECV
\n
"
,
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
?
"Video"
:
"Audio"
);
rtp_session
->
flags
[
SWITCH_RTP_FLAG_SECURE_RECV
]
=
1
;
rtp_session
->
flags
[
SWITCH_RTP_FLAG_SECURE_RECV
]
=
1
;
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error allocating srtp [%d]
\n
"
,
stat
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error allocating srtp [%d]
\n
"
,
stat
);
...
@@ -1908,7 +1909,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
...
@@ -1908,7 +1909,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
}
}
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating Secure RTP SEND
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_INFO
,
"Activating %s Secure RTP SEND
\n
"
,
rtp_session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
?
"Video"
:
"Audio"
);
rtp_session
->
flags
[
SWITCH_RTP_FLAG_SECURE_SEND
]
=
1
;
rtp_session
->
flags
[
SWITCH_RTP_FLAG_SECURE_SEND
]
=
1
;
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error allocating SRTP [%d]
\n
"
,
stat
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error allocating SRTP [%d]
\n
"
,
stat
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论