Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f9aec85b
提交
f9aec85b
authored
4月 12, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-4105 --resolve
上级
ca274650
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
59 行增加
和
6 行删除
+59
-6
mod_spandsp_dsp.c
src/mod/applications/mod_spandsp/mod_spandsp_dsp.c
+59
-6
没有找到文件。
src/mod/applications/mod_spandsp/mod_spandsp_dsp.c
浏览文件 @
f9aec85b
...
...
@@ -43,6 +43,10 @@ typedef struct {
uint32_t
last_digit_end
;
uint32_t
digit_begin
;
uint32_t
min_dup_digit_spacing
;
int
twist
;
int
reverse_twist
;
int
filter_dialtone
;
int
threshold
;
}
switch_inband_dtmf_t
;
static
void
spandsp_dtmf_rx_realtime_callback
(
void
*
user_data
,
int
code
,
int
level
,
int
delay
)
...
...
@@ -74,16 +78,12 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
{
switch_inband_dtmf_t
*
pvt
=
(
switch_inband_dtmf_t
*
)
user_data
;
switch_frame_t
*
frame
=
NULL
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
pvt
->
session
);
switch
(
type
)
{
case
SWITCH_ABC_TYPE_INIT
:
{
const
char
*
min_dup_digit_spacing_str
=
switch_channel_get_variable
(
channel
,
"min_dup_digit_spacing_ms"
);
pvt
->
dtmf_detect
=
dtmf_rx_init
(
NULL
,
NULL
,
NULL
);
dtmf_rx_parms
(
pvt
->
dtmf_detect
,
pvt
->
filter_dialtone
,
pvt
->
twist
,
pvt
->
reverse_twist
,
pvt
->
threshold
);
dtmf_rx_set_realtime_callback
(
pvt
->
dtmf_detect
,
spandsp_dtmf_rx_realtime_callback
,
pvt
);
if
(
!
zstr
(
min_dup_digit_spacing_str
))
{
pvt
->
min_dup_digit_spacing
=
atoi
(
min_dup_digit_spacing_str
)
*
8
;
}
break
;
}
case
SWITCH_ABC_TYPE_CLOSE
:
...
...
@@ -126,6 +126,7 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session)
switch_status_t
status
;
switch_inband_dtmf_t
*
pvt
;
switch_codec_implementation_t
read_impl
=
{
0
};
const
char
*
value
;
switch_core_session_get_read_impl
(
session
,
&
read_impl
);
...
...
@@ -133,8 +134,60 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session)
return
SWITCH_STATUS_MEMERR
;
}
pvt
->
session
=
session
;
pvt
->
session
=
session
;
/* get detector params */
pvt
->
min_dup_digit_spacing
=
0
;
value
=
switch_channel_get_variable
(
channel
,
"min_dup_digit_spacing_ms"
);
if
(
!
zstr
(
value
)
&&
switch_is_number
(
value
))
{
int
val
=
atoi
(
value
)
*
8
;
/* convert from ms to samples */
if
(
val
<
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"min_dup_digit_spacing_ms must be >= 0
\n
"
);
}
else
{
pvt
->
min_dup_digit_spacing
=
val
;
}
}
pvt
->
threshold
=
-
100
;
value
=
switch_channel_get_variable
(
channel
,
"spandsp_dtmf_rx_threshold"
);
if
(
!
zstr
(
value
)
&&
switch_is_number
(
value
))
{
int
val
=
atoi
(
value
);
if
(
val
<
-
99
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"spandsp_dtmf_rx_threshold must be >= -99 dBm0
\n
"
);
}
else
{
pvt
->
threshold
=
val
;
}
}
pvt
->
twist
=
-
1
;
value
=
switch_channel_get_variable
(
channel
,
"spandsp_dtmf_rx_twist"
);
if
(
!
zstr
(
value
)
&&
switch_is_number
(
value
))
{
int
val
=
atoi
(
value
);
if
(
val
<
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"spandsp_dtmf_rx_twist must be >= 0 dB
\n
"
);
}
else
{
pvt
->
twist
=
val
;
}
}
pvt
->
reverse_twist
=
-
1
;
value
=
switch_channel_get_variable
(
channel
,
"spandsp_dtmf_rx_reverse_twist"
);
if
(
!
zstr
(
value
)
&&
switch_is_number
(
value
))
{
int
val
=
atoi
(
value
);
if
(
val
<
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"spandsp_dtmf_rx_reverse_twist must be >= 0 dB
\n
"
);
}
else
{
pvt
->
reverse_twist
=
val
;
}
}
pvt
->
filter_dialtone
=
-
1
;
value
=
switch_channel_get_variable
(
channel
,
"spandsp_dtmf_rx_filter_dialtone"
);
if
(
switch_true
(
value
))
{
pvt
->
filter_dialtone
=
1
;
}
else
if
(
switch_false
(
value
))
{
pvt
->
filter_dialtone
=
0
;
}
if
(
switch_channel_pre_answer
(
channel
)
!=
SWITCH_STATUS_SUCCESS
)
{
return
SWITCH_STATUS_FALSE
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论