Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
aea974a9
提交
aea974a9
authored
1月 14, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MILESTONE: audio and video working inbound
上级
03e5b366
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
147 行增加
和
96 行删除
+147
-96
switch_core_media.c
src/switch_core_media.c
+128
-90
switch_rtp.c
src/switch_rtp.c
+19
-6
没有找到文件。
src/switch_core_media.c
浏览文件 @
aea974a9
差异被折叠。
点击展开。
src/switch_rtp.c
浏览文件 @
aea974a9
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
#define WRITE_DEC(rtp_session) switch_mutex_unlock(rtp_session->write_mutex); rtp_session->writing--
#define WRITE_DEC(rtp_session) switch_mutex_unlock(rtp_session->write_mutex); rtp_session->writing--
#define RTP_DEFAULT_STUNCOUNT
100
;
#define RTP_DEFAULT_STUNCOUNT
25
;
#define rtp_header_len 12
#define rtp_header_len 12
#define RTP_START_PORT 16384
#define RTP_START_PORT 16384
#define RTP_END_PORT 32768
#define RTP_END_PORT 32768
...
@@ -351,6 +351,11 @@ typedef enum {
...
@@ -351,6 +351,11 @@ typedef enum {
static
void
do_2833
(
switch_rtp_t
*
rtp_session
,
switch_core_session_t
*
session
);
static
void
do_2833
(
switch_rtp_t
*
rtp_session
,
switch_core_session_t
*
session
);
#define rtp_type(rtp_session) rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] ? "video" : "audio"
static
handle_rfc2833_result_t
handle_rfc2833
(
switch_rtp_t
*
rtp_session
,
switch_size_t
bytes
,
int
*
do_cng
)
static
handle_rfc2833_result_t
handle_rfc2833
(
switch_rtp_t
*
rtp_session
,
switch_size_t
bytes
,
int
*
do_cng
)
{
{
...
@@ -794,6 +799,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
...
@@ -794,6 +799,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
ok
=
!
strcmp
(
ice
->
user_ice
,
username
);
ok
=
!
strcmp
(
ice
->
user_ice
,
username
);
}
}
//printf("ICE %s %d\n", rtp_type(rtp_session), ok);
if
((
packet
->
header
.
type
==
SWITCH_STUN_BINDING_REQUEST
)
&&
ok
)
{
if
((
packet
->
header
.
type
==
SWITCH_STUN_BINDING_REQUEST
)
&&
ok
)
{
uint8_t
stunbuf
[
512
];
uint8_t
stunbuf
[
512
];
switch_stun_packet_t
*
rpacket
;
switch_stun_packet_t
*
rpacket
;
...
@@ -891,7 +898,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
...
@@ -891,7 +898,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
switch_event_t
*
fsevent
=
NULL
;
switch_event_t
*
fsevent
=
NULL
;
const
char
*
type
;
const
char
*
type
;
type
=
rtp_
session
->
flags
[
SWITCH_RTP_FLAG_VIDEO
]
?
"video"
:
"audio"
;
type
=
rtp_
type
(
rtp_session
)
switch
(
event
)
{
switch
(
event
)
{
case
ZRTP_EVENT_IS_SECURE
:
case
ZRTP_EVENT_IS_SECURE
:
...
@@ -2450,6 +2457,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
...
@@ -2450,6 +2457,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
{
{
char
ice_user
[
80
];
char
ice_user
[
80
];
char
user_ice
[
80
];
char
user_ice
[
80
];
switch_core_session_t
*
session
=
switch_core_memory_pool_get_data
(
rtp_session
->
pool
,
"__session"
);
if
((
type
&
ICE_VANILLA
))
{
if
((
type
&
ICE_VANILLA
))
{
switch_snprintf
(
ice_user
,
sizeof
(
ice_user
),
"%s:%s"
,
login
,
rlogin
);
switch_snprintf
(
ice_user
,
sizeof
(
ice_user
),
"%s:%s"
,
login
,
rlogin
);
...
@@ -2459,6 +2467,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
...
@@ -2459,6 +2467,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
switch_snprintf
(
user_ice
,
sizeof
(
user_ice
),
"%s%s"
,
rlogin
,
login
);
switch_snprintf
(
user_ice
,
sizeof
(
user_ice
),
"%s%s"
,
rlogin
,
login
);
}
}
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_NOTICE
,
"Activating %s ICE: %s
\n
"
,
rtp_type
(
rtp_session
),
ice_user
);
rtp_session
->
ice
.
ice_user
=
switch_core_strdup
(
rtp_session
->
pool
,
ice_user
);
rtp_session
->
ice
.
ice_user
=
switch_core_strdup
(
rtp_session
->
pool
,
ice_user
);
rtp_session
->
ice
.
user_ice
=
switch_core_strdup
(
rtp_session
->
pool
,
user_ice
);
rtp_session
->
ice
.
user_ice
=
switch_core_strdup
(
rtp_session
->
pool
,
user_ice
);
rtp_session
->
ice
.
type
=
type
;
rtp_session
->
ice
.
type
=
type
;
...
@@ -3208,7 +3219,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -3208,7 +3219,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
#endif
#endif
#ifdef ENABLE_SRTP
#ifdef ENABLE_SRTP
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_SECURE_RECV
]
&&
(
!
rtp_session
->
ice
.
ice_user
||
rtp_session
->
recv_msg
.
header
.
version
==
2
))
{
if
(
rtp_session
->
flags
[
SWITCH_RTP_FLAG_SECURE_RECV
]
&&
rtp_session
->
recv_msg
.
header
.
version
==
2
)
{
//if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && (!rtp_session->ice.ice_user || rtp_session->recv_msg.header.version == 2)) {
int
sbytes
=
(
int
)
*
bytes
;
int
sbytes
=
(
int
)
*
bytes
;
err_status_t
stat
=
0
;
err_status_t
stat
=
0
;
...
@@ -3235,7 +3247,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
...
@@ -3235,7 +3247,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if
(
++
rtp_session
->
srtp_errs
>=
MAX_SRTP_ERRS
)
{
if
(
++
rtp_session
->
srtp_errs
>=
MAX_SRTP_ERRS
)
{
switch_core_session_t
*
session
=
switch_core_memory_pool_get_data
(
rtp_session
->
pool
,
"__session"
);
switch_core_session_t
*
session
=
switch_core_memory_pool_get_data
(
rtp_session
->
pool
,
"__session"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error: SRTP
unprotect failed with code %d%s
\n
"
,
stat
,
"Error: SRTP
%s unprotect failed with code %d%s
\n
"
,
rtp_type
(
rtp_session
)
,
stat
,
stat
==
err_status_replay_fail
?
" (replay check failed)"
:
stat
==
stat
==
err_status_replay_fail
?
" (replay check failed)"
:
stat
==
err_status_auth_fail
?
" (auth check failed)"
:
""
);
err_status_auth_fail
?
" (auth check failed)"
:
""
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
...
@@ -4544,11 +4556,12 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
...
@@ -4544,11 +4556,12 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
send
=
0
;
send
=
0
;
}
}
#if 0
if (rtp_session->ice.ice_user && !rtp_session->ice.ready) {
if (rtp_session->ice.ice_user && !rtp_session->ice.ready) {
send
=
0
;
//
send = 0;
//printf("skip no stun love\n");
//printf("skip no stun love\n");
}
}
#endif
if
(
send
)
{
if
(
send
)
{
send_msg
->
header
.
seq
=
htons
(
++
rtp_session
->
seq
);
send_msg
->
header
.
seq
=
htons
(
++
rtp_session
->
seq
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论