Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
439be5d1
提交
439be5d1
authored
4月 05, 2016
作者:
Piotr Gregor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[avmd] FS-9019 Extend syntax description
Add commands to syntax description.
上级
1aa2bf8d
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
37 行增加
和
87 行删除
+37
-87
mod_avmd.c
src/mod/applications/mod_avmd/mod_avmd.c
+37
-87
没有找到文件。
src/mod/applications/mod_avmd/mod_avmd.c
浏览文件 @
439be5d1
...
...
@@ -19,16 +19,14 @@
*
* Contributor(s):
*
* Piotr Gregor <piotrek.gregor gmail.com>:
* Eric des Courtis <eric.des.courtis@benbria.com>
*
* mod_avmd.c -- Advanced Voicemail Detection Module
*
* This module detects voicemail beeps using a generalized approach.
*
* Modifications:
* Piotr Gregor <piotrek.gregor gmail.com>:
* FS-8808, FS-8809, FS-8810, FS-8852, FS-8853, FS-8854, FS-8855,
* FS-8860, FS-8861, FS-8875
* This module detects single frequency tones (used in voicemail to denote
* the moment caller's voice is started to be recorded, aka. beep sounds,
* beeps) using modified DESA-2 algorithm.
*/
#include <switch.h>
...
...
@@ -99,7 +97,7 @@
#endif
/*! Syntax of the API call. */
#define AVMD_SYNTAX "<uuid> <
command
>"
#define AVMD_SYNTAX "<uuid> <
start|stop
>"
/*! Number of expected parameters in api call. */
#define AVMD_PARAMS 2
...
...
@@ -113,10 +111,9 @@
/* Prototypes */
SWITCH_MODULE_SHUTDOWN_FUNCTION
(
mod_avmd_shutdown
);
SWITCH_STANDARD_API
(
avmd_api_main
);
SWITCH_MODULE_LOAD_FUNCTION
(
mod_avmd_load
);
SWITCH_MODULE_DEFINITION
(
mod_avmd
,
mod_avmd_load
,
mod_avmd_shutdown
,
NULL
);
SWITCH_STANDARD_API
(
avmd_api_main
);
SWITCH_STANDARD_APP
(
avmd_start_function
);
/*! Status of the beep detection */
...
...
@@ -216,20 +213,14 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug,
avmd_session
=
(
avmd_session_t
*
)
user_data
;
if
(
avmd_session
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"No avmd session assigned!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"No avmd session assigned!
\n
"
);
return
SWITCH_FALSE
;
}
fs_session
=
avmd_session
->
session
;
if
(
fs_session
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"No FreeSWITCH session assigned!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"No FreeSWITCH session assigned!
\n
"
);
return
SWITCH_FALSE
;
}
...
...
@@ -238,19 +229,13 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug,
case
SWITCH_ABC_TYPE_INIT
:
read_codec
=
switch_core_session_get_read_codec
(
fs_session
);
if
(
read_codec
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
fs_session
),
SWITCH_LOG_WARNING
,
"No codec assigned, default session rate to 8000 samples/s
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
fs_session
),
SWITCH_LOG_WARNING
,
"No codec assigned, default session rate to 8000 samples/s
\n
"
);
avmd_session
->
rate
=
8000
;
}
else
{
if
(
read_codec
->
implementation
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
fs_session
),
SWITCH_LOG_WARNING
,
"No codec implementation assigned, default session rate to 8000 samples/s
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
fs_session
),
SWITCH_LOG_WARNING
,
"No codec implementation assigned, default session rate to 8000 samples/s
\n
"
);
avmd_session
->
rate
=
8000
;
}
else
{
avmd_session
->
rate
=
read_codec
->
implementation
->
samples_per_second
;
...
...
@@ -259,11 +244,8 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug,
avmd_session
->
start_time
=
switch_micro_time_now
();
/* avmd_session->vmd_codec.channels =
* read_codec->implementation->number_of_channels; */
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
fs_session
),
SWITCH_LOG_INFO
,
"Avmd session started, [%u] samples/s
\n
"
,
avmd_session
->
rate
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
fs_session
),
SWITCH_LOG_INFO
,
"Avmd session started, [%u] samples/s
\n
"
,
avmd_session
->
rate
);
break
;
case
SWITCH_ABC_TYPE_READ_REPLACE
:
...
...
@@ -308,9 +290,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load)
return
SWITCH_STATUS_TERM
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Advanced Voicemail detection enabled
\n
"
);
...
...
@@ -321,48 +301,33 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load)
switch
(
ret
)
{
case
-
1
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't access file [%s], error [%s]
\n
"
,
ACOS_TABLE_FILENAME
,
err
);
ACOS_TABLE_FILENAME
,
err
);
break
;
case
-
2
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error creating file [%s], error [%s]
\n
"
,
ACOS_TABLE_FILENAME
,
err
);
ACOS_TABLE_FILENAME
,
err
);
break
;
case
-
3
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Access rights are OK but can't open file [%s], error [%s]
\n
"
,
ACOS_TABLE_FILENAME
,
err
);
ACOS_TABLE_FILENAME
,
err
);
break
;
case
-
4
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Access rights are OK but can't mmap file [%s], error [%s]
\n
"
,
ACOS_TABLE_FILENAME
,
err
);
ACOS_TABLE_FILENAME
,
err
);
break
;
default
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Unknown error [%d] while initializing fast cos table [%s], "
"errno [%s]
\n
"
,
ret
,
ACOS_TABLE_FILENAME
,
err
);
"errno [%s]
\n
"
,
ret
,
ACOS_TABLE_FILENAME
,
err
);
return
SWITCH_STATUS_TERM
;
}
return
SWITCH_STATUS_TERM
;
...
...
@@ -375,15 +340,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load)
);
#endif
SWITCH_ADD_APP
(
app_interface
,
"avmd"
,
"Beep detection"
,
"Advanced detection of voicemail beeps"
,
avmd_start_function
,
"[start] [stop]"
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"avmd"
,
"Beep detection"
,
"Advanced detection of voicemail beeps"
,
avmd_start_function
,
AVMD_SYNTAX
,
SAF_NONE
);
SWITCH_ADD_API
(
api_interface
,
"avmd"
,
"Voicemail beep detection"
,
avmd_api_main
,
AVMD_SYNTAX
);
...
...
@@ -493,18 +452,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown)
if
(
res
!=
0
)
{
switch
(
res
)
{
case
-
1
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed unmap arc cosine table
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed unmap arc cosine table
\n
"
);
break
;
case
-
2
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed closing arc cosine table
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed closing arc cosine table
\n
"
);
break
;
default
:
break
;
...
...
@@ -512,11 +465,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown)
}
#endif
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Advanced Voicemail detection disabled
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Advanced Voicemail detection disabled
\n
"
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论