Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d764e28c
提交
d764e28c
authored
4月 19, 2013
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-5324 try this- set define-grammar=true to force caching of grammar in play_and_detect_speech
上级
b0cdad5d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
17 行删除
+17
-17
mod_unimrcp.c
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
+16
-16
switch_ivr_async.c
src/switch_ivr_async.c
+1
-1
没有找到文件。
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
浏览文件 @
d764e28c
...
@@ -2329,8 +2329,8 @@ static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, co
...
@@ -2329,8 +2329,8 @@ static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, co
goto
done
;
goto
done
;
}
}
/* if inline, use DEFINE-GRAMMAR to cache it on the server */
/* if inline
or requested via define-grammar param
, use DEFINE-GRAMMAR to cache it on the server */
if
(
type
!=
GRAMMAR_TYPE_URI
)
{
if
(
type
!=
GRAMMAR_TYPE_URI
||
switch_true
(
switch_core_hash_find
(
schannel
->
params
,
"define-grammar"
))
)
{
mrcp_message_t
*
mrcp_message
;
mrcp_message_t
*
mrcp_message
;
mrcp_generic_header_t
*
generic_header
;
mrcp_generic_header_t
*
generic_header
;
const
char
*
mime_type
;
const
char
*
mime_type
;
...
@@ -2653,6 +2653,10 @@ static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp
...
@@ -2653,6 +2653,10 @@ static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp
if
(
id
)
{
if
(
id
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"(%s)
\"
%s
\"
:
\"
%s
\"\n
"
,
schannel
->
name
,
param_name
,
param_val
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"(%s)
\"
%s
\"
:
\"
%s
\"\n
"
,
schannel
->
name
,
param_name
,
param_val
);
recog_channel_set_header
(
schannel
,
id
->
id
,
param_val
,
msg
,
recog_hdr
);
recog_channel_set_header
(
schannel
,
id
->
id
,
param_val
,
msg
,
recog_hdr
);
}
else
if
(
!
strcasecmp
(
param_name
,
"define-grammar"
))
{
// This parameter is used internally only, not in MRCP headers
}
else
if
(
!
strcasecmp
(
param_name
,
"name"
))
{
// This parameter is used internally only, not in MRCP headers
}
else
if
(
!
strcasecmp
(
param_name
,
"start-recognize"
))
{
}
else
if
(
!
strcasecmp
(
param_name
,
"start-recognize"
))
{
// This parameter is used internally only, not in MRCP headers
// This parameter is used internally only, not in MRCP headers
}
else
{
}
else
{
...
@@ -2993,6 +2997,7 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha
...
@@ -2993,6 +2997,7 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha
switch_size_t
grammar_file_size
=
0
,
to_read
=
0
;
switch_size_t
grammar_file_size
=
0
,
to_read
=
0
;
grammar_type_t
type
=
GRAMMAR_TYPE_UNKNOWN
;
grammar_type_t
type
=
GRAMMAR_TYPE_UNKNOWN
;
char
*
filename
=
NULL
;
char
*
filename
=
NULL
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"(%s) grammar = %s, name = %s
\n
"
,
schannel
->
name
,
grammar
,
name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"(%s) grammar = %s, name = %s
\n
"
,
schannel
->
name
,
grammar
,
name
);
grammar
=
skip_initial_whitespace
(
grammar
);
grammar
=
skip_initial_whitespace
(
grammar
);
...
@@ -3013,20 +3018,8 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha
...
@@ -3013,20 +3018,8 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"(%s) Grammar is URI
\n
"
,
schannel
->
name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"(%s) Grammar is URI
\n
"
,
schannel
->
name
);
type
=
GRAMMAR_TYPE_URI
;
type
=
GRAMMAR_TYPE_URI
;
grammar_data
=
grammar
;
grammar_data
=
grammar
;
/* if a name was not given, just use the URI that was passed in */
if
(
zstr
(
name
))
{
name
=
grammar
;
}
}
else
if
(
text_starts_with
(
grammar
,
INLINE_ID
))
{
}
else
if
(
text_starts_with
(
grammar
,
INLINE_ID
))
{
grammar_data
=
grammar
+
strlen
(
INLINE_ID
);
grammar_data
=
grammar
+
strlen
(
INLINE_ID
);
/* name is required for inline grammars */
if
(
zstr
(
name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"(%s) missing grammar name
\n
"
,
schannel
->
name
);
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
}
}
else
{
}
else
{
/* grammar points to file containing the grammar text. We assume the MRCP server can't get to this file
/* grammar points to file containing the grammar text. We assume the MRCP server can't get to this file
* so read the data from the file and cache it */
* so read the data from the file and cache it */
...
@@ -3062,10 +3055,17 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha
...
@@ -3062,10 +3055,17 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha
}
}
grammar_file_data
[
to_read
]
=
'\0'
;
grammar_file_data
[
to_read
]
=
'\0'
;
grammar_data
=
grammar_file_data
;
grammar_data
=
grammar_file_data
;
}
/* if a name was not given, check if defined in a param */
if
(
zstr
(
name
))
{
name
=
switch_core_hash_find
(
schannel
->
params
,
"name"
);
/* if
a name was not given, just use the filename that was passed in
*/
/* if
not defined in param, create one
*/
if
(
zstr
(
name
))
{
if
(
zstr
(
name
))
{
name
=
grammar
;
char
id
[
SWITCH_UUID_FORMATTED_LENGTH
+
1
]
=
{
0
};
switch_uuid_str
(
id
,
sizeof
(
id
));
name
=
switch_core_strdup
(
schannel
->
memory_pool
,
id
);
}
}
}
}
...
...
src/switch_ivr_async.c
浏览文件 @
d764e28c
...
@@ -3624,7 +3624,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se
...
@@ -3624,7 +3624,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se
}
}
/* start speech detection */
/* start speech detection */
if
(
switch_ivr_detect_speech
(
session
,
mod_name
,
grammar
,
grammar
,
NULL
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_ivr_detect_speech
(
session
,
mod_name
,
grammar
,
""
,
NULL
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
goto
done
;
goto
done
;
}
}
recognizing
=
1
;
recognizing
=
1
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论