Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a79a9ea9
提交
a79a9ea9
authored
7月 09, 2014
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-6373
上级
8951d26f
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
2 行删除
+18
-2
mod_avmd.c
src/mod/applications/mod_avmd/mod_avmd.c
+4
-1
switch_ivr_async.c
src/switch_ivr_async.c
+14
-1
没有找到文件。
src/mod/applications/mod_avmd/mod_avmd.c
浏览文件 @
a79a9ea9
...
...
@@ -120,6 +120,7 @@ typedef struct {
double
f
;
/* freq_table_t ft; */
avmd_state_t
state
;
switch_time_t
start_time
;
}
avmd_session_t
;
static
void
avmd_process
(
avmd_session_t
*
session
,
switch_frame_t
*
frame
);
...
...
@@ -183,6 +184,7 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw
case
SWITCH_ABC_TYPE_INIT
:
read_codec
=
switch_core_session_get_read_codec
(
avmd_session
->
session
);
avmd_session
->
rate
=
read_codec
->
implementation
->
samples_per_second
;
avmd_session
->
start_time
=
switch_micro_time_now
();
/* avmd_session->vmd_codec.channels = read_codec->implementation->number_of_channels; */
break
;
...
...
@@ -539,7 +541,8 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame)
/*! If variance is less than threshold then we have detection */
if
(
v
<
VARIANCE_THRESHOLD
){
switch_channel_execute_on
(
switch_core_session_get_channel
(
session
->
session
),
"execute_on_avmd_beep"
);
switch_channel_set_variable_printf
(
channel
,
"avmd_total_time"
,
"%d"
,
(
int
)(
switch_micro_time_now
()
-
session
->
start_time
)
/
1000
);
switch_channel_execute_on
(
channel
,
"execute_on_avmd_beep"
);
/*! Throw an event to FreeSWITCH */
status
=
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
AVMD_EVENT_BEEP
);
...
...
src/switch_ivr_async.c
浏览文件 @
a79a9ea9
...
...
@@ -2999,6 +2999,7 @@ typedef struct {
int
default_sleep
;
int
default_expires
;
int
once
;
switch_time_t
start_time
;
switch_tone_detect_callback_t
callback
;
}
switch_tone_detect_t
;
...
...
@@ -3011,6 +3012,16 @@ typedef struct {
int
detect_fax
;
}
switch_tone_container_t
;
static
void
tone_detect_set_total_time
(
switch_tone_container_t
*
cont
,
int
index
)
{
char
*
total_time
=
switch_mprintf
(
"%d"
,
(
int
)(
switch_micro_time_now
()
-
cont
->
list
[
index
].
start_time
)
/
1000
);
switch_channel_set_variable_name_printf
(
switch_core_session_get_channel
(
cont
->
session
),
total_time
,
"tone_detect_%s_total_time"
,
cont
->
list
[
index
].
key
);
switch_safe_free
(
total_time
);
}
static
switch_status_t
tone_on_dtmf
(
switch_core_session_t
*
session
,
const
switch_dtmf_t
*
dtmf
,
switch_dtmf_direction_t
direction
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
...
...
@@ -3023,6 +3034,7 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch
i
=
cont
->
detect_fax
;
tone_detect_set_total_time
(
cont
,
i
);
if
(
cont
->
list
[
i
].
callback
)
{
cont
->
list
[
i
].
callback
(
cont
->
session
,
cont
->
list
[
i
].
app
,
cont
->
list
[
i
].
data
);
}
else
{
...
...
@@ -3038,7 +3050,6 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch
}
static
switch_bool_t
tone_detect_callback
(
switch_media_bug_t
*
bug
,
void
*
user_data
,
switch_abc_type_t
type
)
{
switch_tone_container_t
*
cont
=
(
switch_tone_container_t
*
)
user_data
;
...
...
@@ -3101,6 +3112,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da
if
(
cont
->
list
[
i
].
hits
>=
cont
->
list
[
i
].
total_hits
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
switch_core_media_bug_get_session
(
bug
)),
SWITCH_LOG_DEBUG
,
"TONE %s DETECTED
\n
"
,
cont
->
list
[
i
].
key
);
tone_detect_set_total_time
(
cont
,
i
);
cont
->
list
[
i
].
up
=
0
;
if
(
cont
->
list
[
i
].
callback
)
{
...
...
@@ -3280,6 +3292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
cont
->
list
[
cont
->
index
].
hits
=
0
;
cont
->
list
[
cont
->
index
].
total_hits
=
hits
;
cont
->
list
[
cont
->
index
].
start_time
=
switch_micro_time_now
();
cont
->
list
[
cont
->
index
].
up
=
1
;
memset
(
&
cont
->
list
[
cont
->
index
].
mt
,
0
,
sizeof
(
cont
->
list
[
cont
->
index
].
mt
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论