Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
ae4e48fa
提交
ae4e48fa
authored
7月 21, 2018
作者:
Seven Du
提交者:
Mike Jerris
8月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11265 #resolve add detectSpeech and playAndDetectSpeech
上级
3f51f3b4
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
93 行增加
和
0 行删除
+93
-0
switch_cpp.h
src/include/switch_cpp.h
+12
-0
mod_java.i
src/mod/languages/mod_java/mod_java.i
+3
-0
freeswitch.i
src/mod/languages/mod_lua/freeswitch.i
+1
-0
my_swigable_cpp.h
src/mod/languages/mod_lua/my_swigable_cpp.h
+4
-0
freeswitch.i
src/mod/languages/mod_managed/freeswitch.i
+1
-0
switch_platform.i
src/mod/languages/mod_managed/switch_platform.i
+3
-0
freeswitch.i
src/mod/languages/mod_perl/freeswitch.i
+1
-0
mod_python.i
src/mod/languages/mod_python/mod_python.i
+3
-0
switch_cpp.cpp
src/switch_cpp.cpp
+65
-0
没有找到文件。
src/include/switch_cpp.h
浏览文件 @
ae4e48fa
...
...
@@ -316,6 +316,10 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
SWITCH_DECLARE
(
char
*
)
read
(
int
min_digits
,
int
max_digits
,
const
char
*
prompt_audio_file
,
int
timeout
,
const
char
*
valid_terminators
,
int
digit_timeout
=
0
);
SWITCH_DECLARE
(
void
)
detectSpeech
(
char
*
arg0
,
char
*
arg1
=
NULL
,
char
*
arg2
=
NULL
,
char
*
arg3
=
NULL
);
/** \brief Play a file into channel and collect dtmfs
*
* See API docs in switch_ivr.h: switch_play_and_get_digits(..)
...
...
@@ -331,6 +335,14 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
char
*
digits_regex
,
const
char
*
var_name
=
NULL
,
int
digit_timeout
=
0
,
const
char
*
transfer_on_failure
=
NULL
);
/** \brief Play a file and detect speech
* See API docs switch_ivr_play_and_detect_speech(...)
*/
SWITCH_DECLARE
(
char
*
)
playAndDetectSpeech
(
char
*
file
,
char
*
engine
,
char
*
grammar
);
/** \brief Play a file that resides on disk into the channel
*
* \param file - the path to the .wav/.mp3 to be played
...
...
src/mod/languages/mod_java/mod_java.i
浏览文件 @
ae4e48fa
...
...
@@ -13,6 +13,9 @@
%newobject CoreSession;
%newobject Event;
%newobject Stream;
%newobject API::execute;
%newobject API::executeString;
%newobject CoreSession::playAndDetectSpeech;
// I thought we were using swig because it's easier than the alternatives :-)
...
...
src/mod/languages/mod_lua/freeswitch.i
浏览文件 @
ae4e48fa
...
...
@@ -42,6 +42,7 @@
%newobject Dbh;
%newobject API::execute;
%newobject API::executeString;
%newobject CoreSession::playAndDetectSpeech;
%include "typemaps.i"
%apply int *OUTPUT { int *len };
...
...
src/mod/languages/mod_lua/my_swigable_cpp.h
浏览文件 @
ae4e48fa
...
...
@@ -128,6 +128,10 @@ class CoreSession {
int
max_digits
,
int
max_tries
,
int
timeout
,
char
*
terminators
,
char
*
audio_files
,
char
*
bad_input_audio_files
,
char
*
dtmf_buf
,
char
*
digits_regex
);
int
playAndDetectSpeech
(
char
*
file
,
char
*
engine
,
char
*
grammar
);
void
detectSpeech
(
char
*
arg0
,
char
*
=
NULL
,
char
*
arg2
=
NULL
,
char
*
arg3
=
NULL
);
int
streamFile
(
char
*
file
,
int
starting_sample_count
=
0
);
...
...
src/mod/languages/mod_managed/freeswitch.i
浏览文件 @
ae4e48fa
...
...
@@ -84,6 +84,7 @@ char * SWIG_csharp_string_callback(const char * str) {
%newobject Stream;
%newobject API::execute;
%newobject API::executeString;
%newobject CoreSession::playAndDetectSpeech;
// Allow bitwise compare on flag fields
%typemap(csclassmodifiers) session_flag_t "[System.Flags] public enum"
...
...
src/mod/languages/mod_managed/switch_platform.i
浏览文件 @
ae4e48fa
...
...
@@ -45,6 +45,9 @@ typedef unsigned long in_addr_t;
%newobject CoreSession;
%newobject Event;
%newobject Stream;
%newobject API::execute;
%newobject API::executeString;
%newobject CoreSession::playAndDetectSpeech;
#define SWITCH_DECLARE(type) type
#define SWITCH_DECLARE_NONSTD(type) type
...
...
src/mod/languages/mod_perl/freeswitch.i
浏览文件 @
ae4e48fa
...
...
@@ -17,6 +17,7 @@
%newobject Stream;
%newobject API::execute;
%newobject API::executeString;
%newobject CoreSession::playAndDetectSpeech;
/** insert the following includes into generated code so it compiles */
%{
...
...
src/mod/languages/mod_python/mod_python.i
浏览文件 @
ae4e48fa
...
...
@@ -14,6 +14,9 @@
%newobject CoreSession;
%newobject Event;
%newobject Stream;
%newobject API::execute;
%newobject API::executeString;
%newobject CoreSession::playAndDetectSpeech;
/** insert the following includes into generated code so it compiles */
%{
...
...
src/switch_cpp.cpp
浏览文件 @
ae4e48fa
...
...
@@ -984,6 +984,71 @@ SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits,
return
dtmf_buf
;
}
SWITCH_DECLARE
(
void
)
CoreSession
::
detectSpeech
(
char
*
arg0
,
char
*
arg1
,
char
*
arg2
,
char
*
arg3
)
{
this_check_void
();
sanity_check_noreturn
;
begin_allow_threads
();
if
(
!
arg0
)
return
;
if
(
!
strcasecmp
(
arg0
,
"grammar"
)
&&
arg1
&&
arg2
)
{
switch_ivr_detect_speech_load_grammar
(
session
,
arg1
,
arg2
);
}
else
if
(
!
strcasecmp
(
arg0
,
"nogrammar"
)
&&
arg1
)
{
switch_ivr_detect_speech_unload_grammar
(
session
,
arg1
);
}
else
if
(
!
strcasecmp
(
arg0
,
"grammaron"
)
&&
arg1
)
{
switch_ivr_detect_speech_enable_grammar
(
session
,
arg1
);
}
else
if
(
!
strcasecmp
(
arg0
,
"grammaroff"
)
&&
arg1
)
{
switch_ivr_detect_speech_disable_grammar
(
session
,
arg1
);
}
else
if
(
!
strcasecmp
(
arg0
,
"grammarsalloff"
))
{
switch_ivr_detect_speech_disable_all_grammars
(
session
);
}
else
if
(
!
strcasecmp
(
arg0
,
"init"
)
&&
arg1
&&
arg2
)
{
switch_ivr_detect_speech_init
(
session
,
arg1
,
arg2
,
NULL
);
}
else
if
(
!
strcasecmp
(
arg0
,
"pause"
))
{
switch_ivr_pause_detect_speech
(
session
);
}
else
if
(
!
strcasecmp
(
arg0
,
"resume"
))
{
switch_ivr_resume_detect_speech
(
session
);
}
else
if
(
!
strcasecmp
(
arg0
,
"stop"
))
{
switch_ivr_stop_detect_speech
(
session
);
}
else
if
(
!
strcasecmp
(
arg0
,
"param"
)
&&
arg1
&&
arg2
)
{
switch_ivr_set_param_detect_speech
(
session
,
arg1
,
arg2
);
}
else
if
(
!
strcasecmp
(
arg0
,
"start-input-timers"
))
{
switch_ivr_detect_speech_start_input_timers
(
session
);
}
else
if
(
!
strcasecmp
(
arg0
,
"start_input_timers"
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"start_input_timers is deprecated, please use start-input-timers instead!
\n
"
);
switch_ivr_detect_speech_start_input_timers
(
session
);
}
else
if
(
arg1
&&
arg2
&&
arg3
)
{
switch_ivr_detect_speech
(
session
,
arg0
,
arg1
,
arg2
,
arg3
,
NULL
);
}
end_allow_threads
();
}
SWITCH_DECLARE
(
char
*
)
CoreSession
::
playAndDetectSpeech
(
char
*
file
,
char
*
engine
,
char
*
grammar
)
{
sanity_check
((
char
*
)
""
);
this_check
((
char
*
)
""
);
begin_allow_threads
();
char
*
result
=
NULL
;
switch_status_t
status
=
switch_ivr_play_and_detect_speech
(
session
,
file
,
engine
,
grammar
,
&
result
,
0
,
NULL
);
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
// good
}
else
if
(
status
==
SWITCH_STATUS_GENERR
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"GRAMMAR ERROR
\n
"
);
}
else
if
(
status
==
SWITCH_STATUS_NOT_INITALIZED
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"ASR INIT ERROR
\n
"
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"ERROR
\n
"
);
}
end_allow_threads
();
return
result
;
// remeber to free me
}
SWITCH_DECLARE
(
void
)
CoreSession
::
say
(
const
char
*
tosay
,
const
char
*
module_name
,
const
char
*
say_type
,
const
char
*
say_method
,
const
char
*
say_gender
)
{
this_check_void
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论