Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
097caed4
提交
097caed4
authored
2月 18, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tolerate dtmf where there is no start packet and only end packets
上级
3d3e634f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
3 行删除
+20
-3
switch_rtp.c
src/switch_rtp.c
+20
-3
没有找到文件。
src/switch_rtp.c
浏览文件 @
097caed4
...
...
@@ -126,6 +126,7 @@ struct switch_rtp_rfc2833_data {
unsigned
int
out_digit_dur
;
uint16_t
in_digit_seq
;
uint32_t
in_digit_ts
;
uint32_t
last_in_digit_ts
;
uint32_t
in_digit_sanity
;
uint32_t
in_interleaved
;
uint32_t
timestamp_dtmf
;
...
...
@@ -306,6 +307,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed DTMF payload check.
\n
"
);
rtp_session
->
dtmf_data
.
last_digit
=
0
;
rtp_session
->
dtmf_data
.
in_digit_ts
=
0
;
rtp_session
->
dtmf_data
.
in_digit_sanity
=
0
;
}
end
=
packet
[
1
]
&
0x80
?
1
:
0
;
...
...
@@ -355,6 +357,15 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
}
if
(
end
)
{
if
(
!
rtp_session
->
dtmf_data
.
in_digit_ts
&&
rtp_session
->
dtmf_data
.
last_in_digit_ts
!=
ts
)
{
#ifdef DEBUG_2833
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"start with end packet %d
\n
"
,
ts
);
#endif
rtp_session
->
dtmf_data
.
last_in_digit_ts
=
ts
;
rtp_session
->
dtmf_data
.
in_digit_ts
=
ts
;
rtp_session
->
dtmf_data
.
first_digit
=
key
;
rtp_session
->
dtmf_data
.
in_digit_sanity
=
2000
;
}
if
(
rtp_session
->
dtmf_data
.
in_digit_ts
)
{
switch_dtmf_t
dtmf
=
{
key
,
duration
};
...
...
@@ -395,7 +406,11 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
}
}
else
if
(
!
rtp_session
->
dtmf_data
.
in_digit_ts
)
{
#ifdef DEBUG_2833
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"start %d
\n
"
,
ts
);
#endif
rtp_session
->
dtmf_data
.
in_digit_ts
=
ts
;
rtp_session
->
dtmf_data
.
last_in_digit_ts
=
ts
;
rtp_session
->
dtmf_data
.
first_digit
=
key
;
rtp_session
->
dtmf_data
.
in_digit_sanity
=
2000
;
}
...
...
@@ -2351,7 +2366,7 @@ static void do_flush(switch_rtp_t *rtp_session)
if
(
bytes
>
rtp_header_len
&&
rtp_session
->
recv_te
&&
rtp_session
->
recv_msg
.
header
.
pt
==
rtp_session
->
recv_te
)
{
handle_rfc2833
(
rtp_session
,
bytes
,
&
do_cng
);
#ifdef DEBUG_2833
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"*** RTP packet handled in flush loop
***
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"*** RTP packet handled in flush loop
%d ***
\n
"
,
do_cng
);
#endif
}
...
...
@@ -2691,7 +2706,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if
(
!
rtp_session
->
timer
.
interval
&&
rtp_session
->
read_pollfd
)
{
int
pt
=
poll_sec
*
1000000
;
if
(
rtp_session
->
dtmf_data
.
out_digit_dur
>
0
)
{
if
(
rtp_session
->
dtmf_data
.
out_digit_dur
>
0
||
rtp_session
->
dtmf_data
.
in_digit_sanity
)
{
pt
=
20000
;
}
...
...
@@ -2700,8 +2715,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
poll_status
=
switch_poll
(
rtp_session
->
read_pollfd
,
1
,
&
fdr
,
pt
);
do_2833
(
rtp_session
,
session
);
if
(
rtp_session
->
dtmf_data
.
out_digit_dur
>
0
)
{
do_2833
(
rtp_session
,
session
);
return_cng_frame
(
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论