Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e8078d8a
提交
e8078d8a
authored
4月 14, 2014
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod_rayo: clean up module hashes on shutdown
上级
b0c2c6d6
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
100 行增加
和
19 行删除
+100
-19
nlsml.c
src/mod/event_handlers/mod_rayo/nlsml.c
+33
-3
nlsml.h
src/mod/event_handlers/mod_rayo/nlsml.h
+2
-1
rayo_cpa_detector.c
src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c
+12
-1
rayo_input_component.c
src/mod/event_handlers/mod_rayo/rayo_input_component.c
+4
-1
rayo_output_component.c
src/mod/event_handlers/mod_rayo/rayo_output_component.c
+2
-0
srgs.c
src/mod/event_handlers/mod_rayo/srgs.c
+45
-12
srgs.h
src/mod/event_handlers/mod_rayo/srgs.h
+2
-1
没有找到文件。
src/mod/event_handlers/mod_rayo/nlsml.c
浏览文件 @
e8078d8a
...
...
@@ -51,14 +51,15 @@ struct tag_def {
/**
* library configuration
*/
static
struct
{
typedef
struct
{
/** true if initialized */
switch_bool_t
init
;
/** Mapping of tag name to definition */
switch_hash_t
*
tag_defs
;
/** library memory pool */
switch_memory_pool_t
*
pool
;
}
globals
;
}
nlsml_globals
;
static
nlsml_globals
globals
=
{
0
};
/**
* The node in the XML tree
...
...
@@ -88,6 +89,17 @@ struct nlsml_parser {
int
nomatch
;
};
/**
* Tag def destructor
*/
static
void
destroy_tag_def
(
void
*
ptr
)
{
struct
tag_def
*
tag
=
(
struct
tag_def
*
)
ptr
;
if
(
tag
->
children_tags
)
{
switch_core_hash_destroy
(
&
tag
->
children_tags
);
}
}
/**
* Add a definition for a tag
* @param tag the name
...
...
@@ -114,7 +126,7 @@ static struct tag_def *add_tag_def(const char *tag, tag_attribs_fn attribs_fn, t
def
->
attribs_fn
=
attribs_fn
;
def
->
cdata_fn
=
cdata_fn
;
def
->
is_root
=
SWITCH_FALSE
;
switch_core_hash_insert
(
globals
.
tag_defs
,
tag
,
def
);
switch_core_hash_insert
_destructor
(
globals
.
tag_defs
,
tag
,
def
,
destroy_tag_
def
);
return
def
;
}
...
...
@@ -467,6 +479,24 @@ int nlsml_init(void)
return
1
;
}
/**
* Destruction of NLSML parser environment
*/
void
nlsml_destroy
(
void
)
{
if
(
globals
.
init
)
{
if
(
globals
.
tag_defs
)
{
switch_core_hash_destroy
(
&
globals
.
tag_defs
);
globals
.
tag_defs
=
NULL
;
}
if
(
globals
.
pool
)
{
switch_core_destroy_memory_pool
(
&
globals
.
pool
);
globals
.
pool
=
NULL
;
}
globals
.
init
=
SWITCH_FALSE
;
}
}
/* For Emacs:
* Local Variables:
* mode:c
...
...
src/mod/event_handlers/mod_rayo/nlsml.h
浏览文件 @
e8078d8a
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2013, Grasshopper
* Copyright (C) 2013
-2014
, Grasshopper
*
* Version: MPL 1.1
*
...
...
@@ -40,6 +40,7 @@ enum nlsml_match_type {
};
extern
int
nlsml_init
(
void
);
extern
void
nlsml_destroy
(
void
);
enum
nlsml_match_type
nlsml_parse
(
const
char
*
result
,
const
char
*
uuid
);
iks
*
nlsml_normalize
(
const
char
*
result
);
extern
iks
*
nlsml_create_dtmf_match
(
const
char
*
digits
,
const
char
*
interpretation
);
...
...
src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c
浏览文件 @
e8078d8a
...
...
@@ -248,6 +248,17 @@ done:
return
SWITCH_STATUS_SUCCESS
;
}
/**
* Detector definition destructor
*/
static
void
destroy_detector
(
void
*
ptr
)
{
struct
rayo_cpa_detector
*
detector
=
(
struct
rayo_cpa_detector
*
)
ptr
;
if
(
detector
->
signal_type_map
)
{
switch_core_hash_destroy
(
&
detector
->
signal_type_map
);
}
}
/**
* Configure CPA
*/
...
...
@@ -353,7 +364,7 @@ static switch_status_t do_config(switch_memory_pool_t *pool, const char *config_
/* add signal-type to detector mapping */
const
char
*
signal_type_ns
=
switch_core_sprintf
(
pool
,
"%s%s:%s"
,
RAYO_CPA_BASE
,
signal_type
,
RAYO_VERSION
);
event_ok
=
1
;
switch_core_hash_insert
(
globals
.
detectors
,
signal_type_ns
,
detector
);
switch_core_hash_insert
_destructor
(
globals
.
detectors
,
signal_type_ns
,
detector
,
destroy_
detector
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Adding CPA %s => %s
\n
"
,
signal_type_ns
,
detector
->
name
);
}
...
...
src/mod/event_handlers/mod_rayo/rayo_input_component.c
浏览文件 @
e8078d8a
...
...
@@ -890,9 +890,12 @@ switch_status_t rayo_input_component_load(switch_loadable_module_interface_t **m
*/
switch_status_t
rayo_input_component_shutdown
(
void
)
{
srgs_parser_destroy
(
globals
.
parser
);
switch_event_unbind_callback
(
on_detected_speech_event
);
srgs_parser_destroy
(
globals
.
parser
);
srgs_destroy
();
nlsml_destroy
();
rayo_cpa_component_shutdown
();
return
SWITCH_STATUS_SUCCESS
;
...
...
src/mod/event_handlers/mod_rayo/rayo_output_component.c
浏览文件 @
e8078d8a
...
...
@@ -1226,6 +1226,8 @@ switch_status_t rayo_output_component_load(switch_loadable_module_interface_t **
*/
switch_status_t
rayo_output_component_shutdown
(
void
)
{
switch_core_hash_destroy
(
&
fileman_globals
.
hash
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
src/mod/event_handlers/mod_rayo/srgs.c
浏览文件 @
e8078d8a
...
...
@@ -53,14 +53,15 @@ struct tag_def {
/**
* library configuration
*/
static
struct
{
typedef
struct
{
/** true if initialized */
switch_bool_t
init
;
/** Mapping of tag name to definition */
switch_hash_t
*
tag_defs
;
/** library memory pool */
switch_memory_pool_t
*
pool
;
}
globals
;
}
srgs_globals
;
static
srgs_globals
globals
=
{
0
};
/**
* SRGS node types
...
...
@@ -376,6 +377,17 @@ static struct srgs_node *sn_insert_string(switch_memory_pool_t *pool, struct srg
return
child
;
}
/**
* Tag def destructor
*/
static
void
destroy_tag_def
(
void
*
ptr
)
{
struct
tag_def
*
tag
=
(
struct
tag_def
*
)
ptr
;
if
(
tag
->
children_tags
)
{
switch_core_hash_destroy
(
&
tag
->
children_tags
);
}
}
/**
* Add a definition for a tag
* @param tag the name
...
...
@@ -402,7 +414,7 @@ static struct tag_def *add_tag_def(const char *tag, tag_attribs_fn attribs_fn, t
def
->
attribs_fn
=
attribs_fn
;
def
->
cdata_fn
=
cdata_fn
;
def
->
is_root
=
SWITCH_FALSE
;
switch_core_hash_insert
(
globals
.
tag_defs
,
tag
,
def
);
switch_core_hash_insert
_destructor
(
globals
.
tag_defs
,
tag
,
def
,
destroy_tag_
def
);
return
def
;
}
...
...
@@ -871,15 +883,18 @@ void srgs_parser_destroy(struct srgs_parser *parser)
switch_memory_pool_t
*
pool
=
parser
->
pool
;
switch_hash_index_t
*
hi
=
NULL
;
/* clean up all cached grammars */
for
(
hi
=
switch_core_hash_first
(
parser
->
cache
);
hi
;
hi
=
switch_core_hash_next
(
&
hi
))
{
struct
srgs_grammar
*
grammar
=
NULL
;
const
void
*
key
;
void
*
val
;
switch_core_hash_this
(
hi
,
&
key
,
NULL
,
&
val
);
grammar
=
(
struct
srgs_grammar
*
)
val
;
switch_assert
(
grammar
);
srgs_grammar_destroy
(
grammar
);
if
(
parser
->
cache
)
{
/* clean up all cached grammars */
for
(
hi
=
switch_core_hash_first
(
parser
->
cache
);
hi
;
hi
=
switch_core_hash_next
(
&
hi
))
{
struct
srgs_grammar
*
grammar
=
NULL
;
const
void
*
key
;
void
*
val
;
switch_core_hash_this
(
hi
,
&
key
,
NULL
,
&
val
);
grammar
=
(
struct
srgs_grammar
*
)
val
;
switch_assert
(
grammar
);
srgs_grammar_destroy
(
grammar
);
}
switch_core_hash_destroy
(
&
parser
->
cache
);
}
switch_core_destroy_memory_pool
(
&
pool
);
}
...
...
@@ -1629,6 +1644,24 @@ int srgs_init(void)
return
1
;
}
/**
* Destruction of SRGS parser environment
*/
void
srgs_destroy
(
void
)
{
if
(
globals
.
init
)
{
if
(
globals
.
tag_defs
)
{
switch_core_hash_destroy
(
&
globals
.
tag_defs
);
globals
.
tag_defs
=
NULL
;
}
if
(
globals
.
pool
)
{
switch_core_destroy_memory_pool
(
&
globals
.
pool
);
globals
.
pool
=
NULL
;
}
globals
.
init
=
SWITCH_FALSE
;
}
}
/* For Emacs:
* Local Variables:
* mode:c
...
...
src/mod/event_handlers/mod_rayo/srgs.h
浏览文件 @
e8078d8a
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2013, Grasshopper
* Copyright (C) 2013
-2014
, Grasshopper
*
* Version: MPL 1.1
*
...
...
@@ -46,6 +46,7 @@ enum srgs_match_type {
};
extern
int
srgs_init
(
void
);
extern
void
srgs_destroy
(
void
);
extern
struct
srgs_parser
*
srgs_parser_new
(
const
char
*
uuid
);
extern
struct
srgs_grammar
*
srgs_parse
(
struct
srgs_parser
*
parser
,
const
char
*
document
);
extern
const
char
*
srgs_grammar_to_regex
(
struct
srgs_grammar
*
grammar
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论