Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
49a3672e
提交
49a3672e
authored
9月 14, 2014
作者:
olegstolyar
提交者:
Oleg Stolyar
10月 29, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ability to log commands executed in mod_xml_rpc
上级
bbcd4a86
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
0 行删除
+22
-0
xml_rpc.conf.xml
conf/vanilla/autoload_configs/xml_rpc.conf.xml
+6
-0
mod_xml_rpc.c
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
+16
-0
没有找到文件。
conf/vanilla/autoload_configs/xml_rpc.conf.xml
浏览文件 @
49a3672e
...
@@ -6,5 +6,11 @@
...
@@ -6,5 +6,11 @@
<param
name=
"auth-realm"
value=
"freeswitch"
/>
<param
name=
"auth-realm"
value=
"freeswitch"
/>
<param
name=
"auth-user"
value=
"freeswitch"
/>
<param
name=
"auth-user"
value=
"freeswitch"
/>
<param
name=
"auth-pass"
value=
"works"
/>
<param
name=
"auth-pass"
value=
"works"
/>
<!-- regex pattern to match against commands called against this service.
If a command with arguments matches, it will be logged at INFO level -->
<!--<param name="commands-to-log" value=""/> -->
</settings>
</settings>
</configuration>
</configuration>
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
浏览文件 @
49a3672e
...
@@ -89,6 +89,7 @@ static struct {
...
@@ -89,6 +89,7 @@ static struct {
TServer
abyssServer
;
TServer
abyssServer
;
xmlrpc_registry
*
registryP
;
xmlrpc_registry
*
registryP
;
switch_bool_t
enable_websocket
;
switch_bool_t
enable_websocket
;
char
*
commands_to_log
;
}
globals
;
}
globals
;
SWITCH_DECLARE_GLOBAL_STRING_FUNC
(
set_global_realm
,
globals
.
realm
);
SWITCH_DECLARE_GLOBAL_STRING_FUNC
(
set_global_realm
,
globals
.
realm
);
...
@@ -103,6 +104,8 @@ static switch_status_t do_config(void)
...
@@ -103,6 +104,8 @@ static switch_status_t do_config(void)
char
*
realm
,
*
user
,
*
pass
,
*
default_domain
;
char
*
realm
,
*
user
,
*
pass
,
*
default_domain
;
default_domain
=
realm
=
user
=
pass
=
NULL
;
default_domain
=
realm
=
user
=
pass
=
NULL
;
globals
.
commands_to_log
=
NULL
;
if
(
!
(
xml
=
switch_xml_open_cfg
(
cf
,
&
cfg
,
NULL
)))
{
if
(
!
(
xml
=
switch_xml_open_cfg
(
cf
,
&
cfg
,
NULL
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Open of %s failed
\n
"
,
cf
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Open of %s failed
\n
"
,
cf
);
return
SWITCH_STATUS_TERM
;
return
SWITCH_STATUS_TERM
;
...
@@ -130,6 +133,8 @@ static switch_status_t do_config(void)
...
@@ -130,6 +133,8 @@ static switch_status_t do_config(void)
globals
.
virtual_host
=
switch_true
(
val
);
globals
.
virtual_host
=
switch_true
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"enable-websocket"
))
{
}
else
if
(
!
strcasecmp
(
var
,
"enable-websocket"
))
{
globals
.
enable_websocket
=
switch_true
(
val
);
globals
.
enable_websocket
=
switch_true
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"commands-to-log"
))
{
globals
.
commands_to_log
=
val
;
}
}
}
}
}
}
...
@@ -800,6 +805,7 @@ abyss_bool handler_hook(TSession * r)
...
@@ -800,6 +805,7 @@ abyss_bool handler_hook(TSession * r)
{
{
switch_stream_handle_t
stream
=
{
0
};
switch_stream_handle_t
stream
=
{
0
};
char
*
command
;
char
*
command
;
char
*
full_command
;
int
i
;
int
i
;
char
*
fs_user
=
NULL
,
*
fs_domain
=
NULL
;
char
*
fs_user
=
NULL
,
*
fs_domain
=
NULL
;
char
*
path_info
=
NULL
;
char
*
path_info
=
NULL
;
...
@@ -1054,6 +1060,16 @@ abyss_bool handler_hook(TSession * r)
...
@@ -1054,6 +1060,16 @@ abyss_bool handler_hook(TSession * r)
/* fs api command will write to stream, calling http_stream_write / http_stream_raw_write */
/* fs api command will write to stream, calling http_stream_write / http_stream_raw_write */
/* switch_api_execute will stream INVALID COMMAND before it fails */
/* switch_api_execute will stream INVALID COMMAND before it fails */
switch_api_execute
(
command
,
api_str
,
NULL
,
&
stream
);
switch_api_execute
(
command
,
api_str
,
NULL
,
&
stream
);
if
(
globals
.
commands_to_log
!=
NULL
)
{
full_command
=
switch_mprintf
(
"%s%s%s"
,
command
,
(
api_str
==
NULL
?
""
:
" "
),
api_str
);
if
(
switch_regex_match
(
full_command
,
globals
.
commands_to_log
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Executed HTTP request command: [%s].
\n
"
,
full_command
);
}
switch_safe_free
(
full_command
);
}
r
->
responseStarted
=
TRUE
;
r
->
responseStarted
=
TRUE
;
ResponseStatus
(
r
,
200
);
/* we don't want an assertion failure */
ResponseStatus
(
r
,
200
);
/* we don't want an assertion failure */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论