Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9056af87
提交
9056af87
authored
8月 08, 2018
作者:
Seven Du
提交者:
Mike Jerris
8月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11320 #resolve pass json string as param to ASR module
上级
ae4e48fa
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
36 行增加
和
1 行删除
+36
-1
switch_ivr_async.c
src/switch_ivr_async.c
+36
-1
没有找到文件。
src/switch_ivr_async.c
浏览文件 @
9056af87
...
@@ -4941,6 +4941,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_init(switch_core_sessio
...
@@ -4941,6 +4941,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_init(switch_core_sessio
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
static
void
asr_set_json_text_params
(
switch_core_session_t
*
session
,
switch_asr_handle_t
*
ah
)
{
switch_event_header_t
*
hp
;
switch_event_t
*
event
,
*
cevent
;
const
char
*
variable_prefix
=
"asr_json_param_"
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_core_get_variables
(
&
event
);
switch_channel_get_variables
(
channel
,
&
cevent
);
switch_event_merge
(
event
,
cevent
);
for
(
hp
=
event
->
headers
;
hp
;
hp
=
hp
->
next
)
{
char
*
var
=
hp
->
name
;
char
*
val
=
hp
->
value
;
if
(
!
strncasecmp
(
var
,
variable_prefix
,
strlen
(
variable_prefix
))
&&
!
zstr
(
val
))
{
char
*
json_var
=
var
+
strlen
(
variable_prefix
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"setting json param %s = %s
\n
"
,
json_var
,
val
);
switch_core_asr_text_param
(
ah
,
json_var
,
val
);
}
}
switch_event_destroy
(
&
event
);
switch_event_destroy
(
&
cevent
);
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_detect_speech
(
switch_core_session_t
*
session
,
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_detect_speech
(
switch_core_session_t
*
session
,
const
char
*
mod_name
,
const
char
*
mod_name
,
const
char
*
grammar
,
const
char
*
name
,
const
char
*
dest
,
switch_asr_handle_t
*
ah
)
const
char
*
grammar
,
const
char
*
name
,
const
char
*
dest
,
switch_asr_handle_t
*
ah
)
...
@@ -4949,6 +4976,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
...
@@ -4949,6 +4976,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
switch_status_t
status
;
switch_status_t
status
;
struct
speech_thread_handle
*
sth
=
switch_channel_get_private
(
channel
,
SWITCH_SPEECH_KEY
);
struct
speech_thread_handle
*
sth
=
switch_channel_get_private
(
channel
,
SWITCH_SPEECH_KEY
);
const
char
*
p
;
const
char
*
p
;
int
resume
=
0
;
if
(
!
sth
)
{
if
(
!
sth
)
{
/* No speech thread handle available yet, init speech detection first. */
/* No speech thread handle available yet, init speech detection first. */
...
@@ -4961,15 +4990,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
...
@@ -4961,15 +4990,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
return
SWITCH_STATUS_NOT_INITALIZED
;
return
SWITCH_STATUS_NOT_INITALIZED
;
}
}
}
else
{
}
else
{
switch_ivr_resume_detect_speech
(
session
)
;
resume
=
1
;
}
}
asr_set_json_text_params
(
session
,
sth
->
ah
);
if
(
switch_core_asr_load_grammar
(
sth
->
ah
,
grammar
,
name
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_asr_load_grammar
(
sth
->
ah
,
grammar
,
name
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Error loading Grammar
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Error loading Grammar
\n
"
);
switch_ivr_stop_detect_speech
(
session
);
switch_ivr_stop_detect_speech
(
session
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
if
(
resume
)
{
switch_ivr_resume_detect_speech
(
session
);
}
if
((
p
=
switch_channel_get_variable
(
channel
,
"fire_asr_events"
))
&&
switch_true
(
p
))
{
if
((
p
=
switch_channel_get_variable
(
channel
,
"fire_asr_events"
))
&&
switch_true
(
p
))
{
switch_set_flag
(
sth
->
ah
,
SWITCH_ASR_FLAG_FIRE_EVENTS
);
switch_set_flag
(
sth
->
ah
,
SWITCH_ASR_FLAG_FIRE_EVENTS
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论