Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e95beb8d
提交
e95beb8d
authored
10月 05, 2018
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11442 [core] added fst_play_and_detect_app_test and fst_sched_recv_dtmf
上级
3f512c0a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
51 行增加
和
1 行删除
+51
-1
switch_test.h
src/include/test/switch_test.h
+51
-1
没有找到文件。
src/include/test/switch_test.h
浏览文件 @
e95beb8d
...
...
@@ -443,6 +443,7 @@ static void fst_session_park(switch_core_session_t *session)
* Test Requires:
* switch_ivr_displace_session(input_filename) == SWITCH_STATUS_SUCCESS
* switch_core_session_execute_application(play_and_detect_speech) == SWITCH_STATUS_SUCCESS
* mod_dptools is loaded
*
* Test Checks:
* fst_asr_result != NULL after recognition completes
...
...
@@ -455,9 +456,10 @@ static void fst_session_park(switch_core_session_t *session)
* @param prompt_filename name of prompt to play
* @param input_filename name of file containing input audio for the recognizer
*/
#define fst_play_and_detect_speech_test(recognizer, grammar, prompt_filename, input_filename) \
#define fst_play_and_detect_speech_
app_
test(recognizer, grammar, prompt_filename, input_filename) \
{ \
char *args = NULL; \
fst_requires_module("mod_dptools"); \
switch_channel_set_variable(fst_channel, "detect_speech_result", ""); \
fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "r") == SWITCH_STATUS_SUCCESS); \
args = switch_core_session_sprintf(fst_session, "%s detect:%s %s", prompt_filename, recognizer, grammar); \
...
...
@@ -466,12 +468,60 @@ static void fst_session_park(switch_core_session_t *session)
fst_check(fst_asr_result != NULL); \
}
/**
* Use play_and_detect_speech core function to test recognizer
*
* Test Requires:
* switch_ivr_displace_session(input_filename) == SWITCH_STATUS_SUCCESS
*
* Test Checks:
* fst_asr_result != NULL after recognition completes
*
* Test Output:
* fst_asr_result has the result from detect_speech_result channel variable.
*
* @param recognizer name of recognizer
* @param grammar recognizer grammar
* @param prompt_filename name of prompt to play
* @param input_filename name of file containing input audio for the recognizer
* @param input_args input callback args
*/
#define fst_play_and_detect_speech_test(recognizer, grammar, prompt_filename, input_filename, input_args) \
{ \
char *args = NULL; \
fst_asr_result = NULL; \
fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "r") == SWITCH_STATUS_SUCCESS); \
switch_status_t status = switch_ivr_play_and_detect_speech(fst_session, prompt_filename, recognizer, grammar, (char **)&fst_asr_result, 0, input_args); \
fst_check(fst_asr_result != NULL); \
}
/**
* Define end of play_and_detect_speech recognizer test
*/
#define fst_play_and_detect_speech_test_end() \
}
/**
* Inject DTMF into the session to be detected.
*
* Test Requires:
* switch_api_execute(sched_api) == SWITCH_STATUS_SUCCESS
* mod_commands is loaded
*
* @param when string describing when to send dtmf
* @param digits to send
*/
#define fst_sched_recv_dtmf(when, digits) \
{ \
switch_stream_handle_t stream = { 0 }; \
SWITCH_STANDARD_STREAM(stream); \
fst_requires_module("mod_commands"); \
switch_status_t api_result = switch_api_execute("sched_api", switch_core_session_sprintf(fst_session, "%s none uuid_recv_dtmf %s %s", when, switch_core_session_get_uuid(fst_session), digits), NULL, &stream); \
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_INFO, "Injecting DTMF %s at %s\n", digits, when); \
fst_requires(api_result == SWITCH_STATUS_SUCCESS); \
switch_safe_free(stream.data); \
}
/**
* Parse JSON file and save to varname
*
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论