Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
658b1f85
提交
658b1f85
authored
2月 22, 2017
作者:
Andrey Volk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10060 [mod_v8] Add startup scripts support.
上级
dcbd39cc
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
51 行增加
和
16 行删除
+51
-16
.gitignore
.gitignore
+4
-1
v8.conf.xml
conf/curl/autoload_configs/v8.conf.xml
+2
-0
v8.conf.xml
conf/insideout/autoload_configs/v8.conf.xml
+2
-0
v8.conf.xml
conf/vanilla/autoload_configs/v8.conf.xml
+2
-0
v8.conf.xml
src/mod/languages/mod_v8/conf/autoload_configs/v8.conf.xml
+2
-0
mod_v8.cpp
src/mod/languages/mod_v8/mod_v8.cpp
+38
-15
mod_v8.h
src/mod/languages/mod_v8/mod_v8.h
+1
-0
没有找到文件。
.gitignore
浏览文件 @
658b1f85
...
...
@@ -239,4 +239,7 @@ libs/libpng/
libs/zlib/
libs/libav/
libs/libx264/
\ No newline at end of file
libs/libx264/
Win32/*.msi
x64/*.msi
\ No newline at end of file
conf/curl/autoload_configs/v8.conf.xml
浏览文件 @
658b1f85
<configuration
name=
"v8.conf"
description=
"Google V8 JavaScript Plug-Ins"
>
<settings>
<!-- <param name="startup-script" value="startup1.js"/> -->
<!-- <param name="startup-script" value="startup2.js"/> -->
<!-- <param name="xml-handler-script" value="directory.js"/> -->
<!-- <param name="xml-handler-bindings" value="directory"/> -->
<!-- <hook event="CUSTOM" subclass="sofia::register" script="catch-event.js"/> -->
...
...
conf/insideout/autoload_configs/v8.conf.xml
浏览文件 @
658b1f85
<configuration
name=
"v8.conf"
description=
"Google V8 JavaScript Plug-Ins"
>
<settings>
<!-- <param name="startup-script" value="startup1.js"/> -->
<!-- <param name="startup-script" value="startup2.js"/> -->
<!-- <param name="xml-handler-script" value="directory.js"/> -->
<!-- <param name="xml-handler-bindings" value="directory"/> -->
<!-- <hook event="CUSTOM" subclass="sofia::register" script="catch-event.js"/> -->
...
...
conf/vanilla/autoload_configs/v8.conf.xml
浏览文件 @
658b1f85
<configuration
name=
"v8.conf"
description=
"Google V8 JavaScript Plug-Ins"
>
<settings>
<!-- <param name="startup-script" value="startup1.js"/> -->
<!-- <param name="startup-script" value="startup2.js"/> -->
<!-- <param name="xml-handler-script" value="directory.js"/> -->
<!-- <param name="xml-handler-bindings" value="directory"/> -->
<!-- <hook event="CUSTOM" subclass="sofia::register" script="catch-event.js"/> -->
...
...
src/mod/languages/mod_v8/conf/autoload_configs/v8.conf.xml
浏览文件 @
658b1f85
<configuration
name=
"v8.conf"
description=
"Google V8 JavaScript Plug-Ins"
>
<settings>
<!-- <param name="startup-script" value="startup1.js"/> -->
<!-- <param name="startup-script" value="startup2.js"/> -->
<!-- <param name="xml-handler-script" value="directory.js"/> -->
<!-- <param name="xml-handler-bindings" value="directory"/> -->
<!-- <hook event="CUSTOM" subclass="sofia::register" script="catch-event.js"/> -->
...
...
src/mod/languages/mod_v8/mod_v8.cpp
浏览文件 @
658b1f85
...
...
@@ -276,7 +276,35 @@ static switch_status_t load_modules(void)
switch_core_hash_init
(
&
module_manager
.
load_hash
);
if
((
xml
=
switch_xml_open_cfg
(
cf
,
&
cfg
,
NULL
)))
{
switch_xml_t
mods
,
ld
,
settings
,
param
,
hook
;
switch_xml_t
mods
,
ld
;
if
((
mods
=
switch_xml_child
(
cfg
,
"modules"
)))
{
for
(
ld
=
switch_xml_child
(
mods
,
"load"
);
ld
;
ld
=
ld
->
next
)
{
const
char
*
val
=
switch_xml_attr_soft
(
ld
,
"module"
);
if
(
!
zstr
(
val
)
&&
strchr
(
val
,
'.'
)
&&
!
strstr
(
val
,
ext
)
&&
!
strstr
(
val
,
EXT
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Invalid extension for %s
\n
"
,
val
);
continue
;
}
v8_load_module
(
SWITCH_GLOBAL_dirs
.
mod_dir
,
val
);
count
++
;
}
}
switch_xml_free
(
xml
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Open of %s failed
\n
"
,
cf
);
}
return
SWITCH_STATUS_SUCCESS
;
}
static
void
load_configuration
(
void
)
{
const
char
*
cf
=
"v8.conf"
;
switch_xml_t
cfg
,
xml
;
if
((
xml
=
switch_xml_open_cfg
(
cf
,
&
cfg
,
NULL
)))
{
switch_xml_t
settings
,
param
,
hook
;
if
((
settings
=
switch_xml_child
(
cfg
,
"settings"
)))
{
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
...
...
@@ -292,6 +320,11 @@ static switch_status_t load_modules(void)
switch_xml_bind_search_function
(
v8_fetch
,
switch_xml_parse_section_string
(
val
),
NULL
);
}
}
else
if
(
!
strcmp
(
var
,
"startup-script"
))
{
if
(
val
)
{
v8_thread_launch
(
val
);
}
}
}
for
(
hook
=
switch_xml_child
(
settings
,
"hook"
);
hook
;
hook
=
hook
->
next
)
{
...
...
@@ -326,24 +359,12 @@ static switch_status_t load_modules(void)
}
}
if
((
mods
=
switch_xml_child
(
cfg
,
"modules"
)))
{
for
(
ld
=
switch_xml_child
(
mods
,
"load"
);
ld
;
ld
=
ld
->
next
)
{
const
char
*
val
=
switch_xml_attr_soft
(
ld
,
"module"
);
if
(
!
zstr
(
val
)
&&
strchr
(
val
,
'.'
)
&&
!
strstr
(
val
,
ext
)
&&
!
strstr
(
val
,
EXT
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Invalid extension for %s
\n
"
,
val
);
continue
;
}
v8_load_module
(
SWITCH_GLOBAL_dirs
.
mod_dir
,
val
);
count
++
;
}
}
switch_xml_free
(
xml
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Open of %s failed
\n
"
,
cf
);
}
return
SWITCH_STATUS_SUCCESS
;
}
static
int
env_init
(
JSMain
*
js
)
...
...
@@ -1007,6 +1028,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_v8_load)
SWITCH_ADD_JSON_API
(
json_api_interface
,
"jsjson"
,
"JSON JS Gateway"
,
json_function
,
""
);
load_configuration
();
/* indicate that the module should continue to be loaded */
return
SWITCH_STATUS_NOUNLOAD
;
}
...
...
src/mod/languages/mod_v8/mod_v8.h
浏览文件 @
658b1f85
...
...
@@ -86,6 +86,7 @@ void v8_remove_event_handler(void *event_handler);
static
switch_xml_t
v8_fetch
(
const
char
*
section
,
const
char
*
tag_name
,
const
char
*
key_name
,
const
char
*
key_value
,
switch_event_t
*
params
,
void
*
user_data
);
static
void
v8_event_handler
(
switch_event_t
*
event
);
void
v8_thread_launch
(
const
char
*
text
);
#endif
/* MOD_V8_H */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论