Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
069f5f7d
提交
069f5f7d
authored
3月 18, 2011
作者:
Anthony Minessale
提交者:
Brian West
3月 18, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3075
上级
34bd0e5e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
68 行增加
和
62 行删除
+68
-62
switch_rtp.c
src/switch_rtp.c
+68
-62
没有找到文件。
src/switch_rtp.c
浏览文件 @
069f5f7d
...
...
@@ -2503,6 +2503,74 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
rtp_session
->
last_read_ts
=
ts
;
if
(
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
)
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_UDPTL
))
{
#ifdef ENABLE_ZRTP
/* ZRTP Recv */
if
(
*
bytes
)
{
unsigned
int
sbytes
=
(
int
)
*
bytes
;
zrtp_status_t
stat
=
0
;
stat
=
zrtp_process_srtp
(
rtp_session
->
zrtp_stream
,
(
void
*
)
&
rtp_session
->
recv_msg
,
&
sbytes
);
switch
(
stat
)
{
case
zrtp_status_ok
:
*
bytes
=
sbytes
;
break
;
case
zrtp_status_drop
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection drop with code %d
\n
"
,
stat
);
*
bytes
=
0
;
return
SWITCH_STATUS_SUCCESS
;
case
zrtp_status_fail
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection fail with code %d
\n
"
,
stat
);
return
SWITCH_STATUS_FALSE
;
default
:
break
;
}
}
#endif
if
(
*
bytes
&&
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_RECV
))
{
int
sbytes
=
(
int
)
*
bytes
;
err_status_t
stat
=
0
;
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_RECV_RESET
))
{
switch_clear_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_RECV_RESET
);
srtp_dealloc
(
rtp_session
->
recv_ctx
);
rtp_session
->
recv_ctx
=
NULL
;
if
((
stat
=
srtp_create
(
&
rtp_session
->
recv_ctx
,
&
rtp_session
->
recv_policy
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error! RE-Activating Secure RTP RECV
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"RE-Activating Secure RTP RECV
\n
"
);
rtp_session
->
srtp_errs
=
0
;
}
}
if
(
!
(
*
flags
&
SFF_PLC
))
{
stat
=
srtp_unprotect
(
rtp_session
->
recv_ctx
,
&
rtp_session
->
recv_msg
.
header
,
&
sbytes
);
}
if
(
stat
&&
rtp_session
->
recv_msg
.
header
.
pt
!=
rtp_session
->
recv_te
&&
rtp_session
->
recv_msg
.
header
.
pt
!=
rtp_session
->
cng_pt
)
{
if
(
++
rtp_session
->
srtp_errs
>=
MAX_SRTP_ERRS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: SRTP unprotect failed with code %d%s
\n
"
,
stat
,
stat
==
err_status_replay_fail
?
" (replay check failed)"
:
stat
==
err_status_auth_fail
?
" (auth check failed)"
:
""
);
return
SWITCH_STATUS_FALSE
;
}
else
{
sbytes
=
0
;
}
}
else
{
rtp_session
->
srtp_errs
=
0
;
}
*
bytes
=
sbytes
;
}
}
if
(
rtp_session
->
jb
&&
!
rtp_session
->
pause_jb
&&
rtp_session
->
recv_msg
.
header
.
version
==
2
&&
*
bytes
)
{
if
(
rtp_session
->
recv_msg
.
header
.
m
&&
rtp_session
->
recv_msg
.
header
.
pt
!=
rtp_session
->
recv_te
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_VIDEO
)
&&
!
(
rtp_session
->
rtp_bugs
&
RTP_BUG_IGNORE_MARK_BIT
))
{
...
...
@@ -3061,31 +3129,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if
(
check
||
bytes
)
{
do_2833
(
rtp_session
,
session
);
}
#ifdef ENABLE_ZRTP
/* ZRTP Recv */
if
(
bytes
)
{
unsigned
int
sbytes
=
(
int
)
bytes
;
zrtp_status_t
stat
=
0
;
stat
=
zrtp_process_srtp
(
rtp_session
->
zrtp_stream
,
(
void
*
)
&
rtp_session
->
recv_msg
,
&
sbytes
);
switch
(
stat
)
{
case
zrtp_status_ok
:
bytes
=
sbytes
;
break
;
case
zrtp_status_drop
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection drop with code %d
\n
"
,
stat
);
bytes
=
0
;
goto
do_continue
;
case
zrtp_status_fail
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection fail with code %d
\n
"
,
stat
);
ret
=
-
1
;
goto
end
;
default
:
break
;
}
}
#endif
if
(
bytes
&&
rtp_session
->
recv_msg
.
header
.
version
!=
2
)
{
uint8_t
*
data
=
(
uint8_t
*
)
rtp_session
->
recv_msg
.
body
;
...
...
@@ -3112,43 +3155,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
goto
end
;
}
if
(
bytes
&&
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_RECV
))
{
int
sbytes
=
(
int
)
bytes
;
err_status_t
stat
=
0
;
if
(
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_RECV_RESET
))
{
switch_clear_flag_locked
(
rtp_session
,
SWITCH_RTP_FLAG_SECURE_RECV_RESET
);
srtp_dealloc
(
rtp_session
->
recv_ctx
);
rtp_session
->
recv_ctx
=
NULL
;
if
((
stat
=
srtp_create
(
&
rtp_session
->
recv_ctx
,
&
rtp_session
->
recv_policy
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error! RE-Activating Secure RTP RECV
\n
"
);
ret
=
-
1
;
goto
end
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"RE-Activating Secure RTP RECV
\n
"
);
rtp_session
->
srtp_errs
=
0
;
}
}
stat
=
srtp_unprotect
(
rtp_session
->
recv_ctx
,
&
rtp_session
->
recv_msg
.
header
,
&
sbytes
);
if
(
stat
&&
rtp_session
->
recv_msg
.
header
.
pt
!=
rtp_session
->
recv_te
&&
rtp_session
->
recv_msg
.
header
.
pt
!=
rtp_session
->
cng_pt
)
{
if
(
++
rtp_session
->
srtp_errs
>=
MAX_SRTP_ERRS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: SRTP unprotect failed with code %d%s
\n
"
,
stat
,
stat
==
err_status_replay_fail
?
" (replay check failed)"
:
stat
==
err_status_auth_fail
?
" (auth check failed)"
:
""
);
ret
=
-
1
;
goto
end
;
}
else
{
sbytes
=
0
;
}
}
else
{
rtp_session
->
srtp_errs
=
0
;
}
bytes
=
sbytes
;
}
/* Handle incoming RFC2833 packets */
switch
(
handle_rfc2833
(
rtp_session
,
bytes
,
&
do_cng
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论