Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
cc73aec6
提交
cc73aec6
authored
7月 28, 2010
作者:
Christopher Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated mod_unimrcp to allow speech/asr channels to be named for logging
上级
59e19758
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
23 行删除
+33
-23
mod_unimrcp.c
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
+33
-23
没有找到文件。
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
浏览文件 @
cc73aec6
...
@@ -1510,7 +1510,7 @@ static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char
...
@@ -1510,7 +1510,7 @@ static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char
const
char
*
profile_name
=
sh
->
param
;
const
char
*
profile_name
=
sh
->
param
;
profile_t
*
profile
=
NULL
;
profile_t
*
profile
=
NULL
;
int
speech_channel_number
=
get_next_speech_channel_number
();
int
speech_channel_number
=
get_next_speech_channel_number
();
char
name
[
200
]
=
{
0
}
;
char
*
name
=
NULL
;
switch_hash_index_t
*
hi
=
NULL
;
switch_hash_index_t
*
hi
=
NULL
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
...
@@ -1518,18 +1518,26 @@ static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char
...
@@ -1518,18 +1518,26 @@ static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char
sh
->
speed
,
sh
->
samples
,
sh
->
voice
,
sh
->
engine
,
sh
->
param
);
sh
->
speed
,
sh
->
samples
,
sh
->
voice
,
sh
->
engine
,
sh
->
param
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"voice = %s, rate = %d
\n
"
,
voice_name
,
rate
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"voice = %s, rate = %d
\n
"
,
voice_name
,
rate
);
/* It would be nice if FreeSWITCH let us know which session owns this handle, but it doesn't. So, lets
/* Name the channel */
make our own unique name */
if
(
profile_name
&&
strchr
(
profile_name
,
':'
))
{
switch_snprintf
(
name
,
sizeof
(
name
)
-
1
,
"TTS-%d"
,
speech_channel_number
);
/* Profile has session name appended to it. Pick it out */
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
profile_name
=
switch_core_strdup
(
sh
->
memory_pool
,
profile_name
);
name
=
strchr
(
profile_name
,
':'
);
*
name
=
'\0'
;
name
++
;
name
=
switch_core_sprintf
(
sh
->
memory_pool
,
"%s TTS-%d"
,
name
,
speech_channel_number
);
}
else
{
name
=
switch_core_sprintf
(
sh
->
memory_pool
,
"TTS-%d"
,
speech_channel_number
);
}
/* Allocate the channel */
if
(
speech_channel_create
(
&
schannel
,
name
,
SPEECH_CHANNEL_SYNTHESIZER
,
&
globals
.
synth
,
(
uint16_t
)
rate
,
sh
->
memory_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
speech_channel_create
(
&
schannel
,
name
,
SPEECH_CHANNEL_SYNTHESIZER
,
&
globals
.
synth
,
(
uint16_t
)
rate
,
sh
->
memory_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
goto
done
;
}
}
sh
->
private_info
=
schannel
;
sh
->
private_info
=
schannel
;
/*
try to open an MRCP
channel */
/*
Open the
channel */
if
(
zstr
(
profile_name
))
{
if
(
zstr
(
profile_name
))
{
profile_name
=
globals
.
unimrcp_default_synth_profile
;
profile_name
=
globals
.
unimrcp_default_synth_profile
;
}
}
...
@@ -2697,8 +2705,8 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec
...
@@ -2697,8 +2705,8 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
speech_channel_t
*
schannel
=
NULL
;
speech_channel_t
*
schannel
=
NULL
;
int
speech_channel_number
=
get_next_speech_channel_number
();
int
speech_channel_number
=
get_next_speech_channel_number
();
char
name
[
200
]
=
{
0
}
;
char
*
name
=
""
;
const
char
*
profile_name
=
NULL
;
const
char
*
profile_name
=
!
zstr
(
dest
)
?
dest
:
ah
->
param
;
profile_t
*
profile
=
NULL
;
profile_t
*
profile
=
NULL
;
recognizer_data_t
*
r
=
NULL
;
recognizer_data_t
*
r
=
NULL
;
switch_hash_index_t
*
hi
=
NULL
;
switch_hash_index_t
*
hi
=
NULL
;
...
@@ -2707,37 +2715,39 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec
...
@@ -2707,37 +2715,39 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec
ah
->
name
,
ah
->
codec
,
ah
->
rate
,
ah
->
grammar
,
ah
->
param
);
ah
->
name
,
ah
->
codec
,
ah
->
rate
,
ah
->
grammar
,
ah
->
param
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"codec = %s, rate = %d, dest = %s
\n
"
,
codec
,
rate
,
dest
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"codec = %s, rate = %d, dest = %s
\n
"
,
codec
,
rate
,
dest
);
/* It would be nice if FreeSWITCH let us know which session owns this handle, but it doesn't. So, lets
/* Name the channel */
make our own unique name */
if
(
profile_name
&&
strchr
(
profile_name
,
':'
))
{
switch_snprintf
(
name
,
sizeof
(
name
)
-
1
,
"ASR-%d"
,
speech_channel_number
);
/* Profile has session name appended to it. Pick it out */
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
profile_name
=
switch_core_strdup
(
ah
->
memory_pool
,
profile_name
);
name
=
strchr
(
profile_name
,
':'
);
*
name
=
'\0'
;
name
++
;
name
=
switch_core_sprintf
(
ah
->
memory_pool
,
"%s ASR-%d"
,
name
,
speech_channel_number
);
}
else
{
name
=
switch_core_sprintf
(
ah
->
memory_pool
,
"ASR-%d"
,
name
,
speech_channel_number
);
}
/* Allocate the channel */
if
(
speech_channel_create
(
&
schannel
,
name
,
SPEECH_CHANNEL_RECOGNIZER
,
&
globals
.
recog
,
(
uint16_t
)
rate
,
ah
->
memory_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
speech_channel_create
(
&
schannel
,
name
,
SPEECH_CHANNEL_RECOGNIZER
,
&
globals
.
recog
,
(
uint16_t
)
rate
,
ah
->
memory_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
goto
done
;
}
}
ah
->
private_info
=
schannel
;
ah
->
private_info
=
schannel
;
r
=
(
recognizer_data_t
*
)
switch_core_alloc
(
ah
->
memory_pool
,
sizeof
(
recognizer_data_t
));
r
=
(
recognizer_data_t
*
)
switch_core_alloc
(
ah
->
memory_pool
,
sizeof
(
recognizer_data_t
));
schannel
->
data
=
r
;
schannel
->
data
=
r
;
memset
(
r
,
0
,
sizeof
(
recognizer_data_t
));
memset
(
r
,
0
,
sizeof
(
recognizer_data_t
));
switch_core_hash_init
(
&
r
->
grammars
,
ah
->
memory_pool
);
switch_core_hash_init
(
&
r
->
grammars
,
ah
->
memory_pool
);
/* try to open an MRCP channel */
/* Open the channel */
if
(
!
(
profile_name
=
dest
))
{
if
(
zstr
(
profile_name
))
{
if
(
!
(
profile_name
=
ah
->
param
))
{
profile_name
=
globals
.
unimrcp_default_recog_profile
;
profile_name
=
globals
.
unimrcp_default_recog_profile
;
}
}
}
profile
=
(
profile_t
*
)
switch_core_hash_find
(
globals
.
profiles
,
profile_name
);
profile
=
(
profile_t
*
)
switch_core_hash_find
(
globals
.
profiles
,
profile_name
);
if
(
!
profile
)
{
if
(
!
profile
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"(%s) Can't find profile, %s
\n
"
,
name
,
profile_name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"(%s) Can't find profile, %s
\n
"
,
name
,
profile_name
);
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
goto
done
;
}
}
if
((
status
=
speech_channel_open
(
schannel
,
profile
))
!=
SWITCH_STATUS_SUCCESS
)
{
if
((
status
=
speech_channel_open
(
schannel
,
profile
))
!=
SWITCH_STATUS_SUCCESS
)
{
goto
done
;
goto
done
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论