Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
233481c3
提交
233481c3
authored
8月 24, 2017
作者:
Andrey Volk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10611: [mod_commands] Add domain_data command to retrieve domain information
上级
eed17a60
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
71 行增加
和
0 行删除
+71
-0
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+71
-0
没有找到文件。
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
233481c3
...
...
@@ -1216,6 +1216,76 @@ SWITCH_STANDARD_API(in_group_function)
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_STANDARD_API
(
domain_data_function
)
{
switch_xml_t
x_domain
=
NULL
,
xml_root
=
NULL
,
x_param
,
x_params
;
int
argc
;
char
*
mydata
=
NULL
,
*
argv
[
3
],
*
key
=
NULL
,
*
type
=
NULL
,
*
domain
,
*
dup_domain
=
NULL
;
char
delim
=
' '
;
const
char
*
container
=
"params"
,
*
elem
=
"param"
;
const
char
*
result
=
NULL
;
switch_event_t
*
params
=
NULL
;
if
(
zstr
(
cmd
)
||
!
(
mydata
=
strdup
(
cmd
)))
{
goto
end
;
}
if
((
argc
=
switch_separate_string
(
mydata
,
delim
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
]))))
<
3
)
{
goto
end
;
}
domain
=
argv
[
0
];
type
=
argv
[
1
];
key
=
argv
[
2
];
if
(
!
domain
)
{
if
((
dup_domain
=
switch_core_get_domain
(
SWITCH_TRUE
)))
{
domain
=
dup_domain
;
}
else
{
domain
=
"cluecon.com"
;
}
}
switch_event_create
(
&
params
,
SWITCH_EVENT_REQUEST_PARAMS
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"domain"
,
domain
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"type"
,
type
);
if
(
key
&&
type
&&
switch_xml_locate_domain
(
domain
,
params
,
&
xml_root
,
&
x_domain
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
!
strcmp
(
type
,
"attr"
))
{
const
char
*
attr
=
switch_xml_attr_soft
(
x_domain
,
key
);
result
=
attr
;
goto
end
;
}
if
(
!
strcmp
(
type
,
"var"
))
{
container
=
"variables"
;
elem
=
"variable"
;
}
if
((
x_params
=
switch_xml_child
(
x_domain
,
container
)))
{
for
(
x_param
=
switch_xml_child
(
x_params
,
elem
);
x_param
;
x_param
=
x_param
->
next
)
{
const
char
*
var
=
switch_xml_attr
(
x_param
,
"name"
);
const
char
*
val
=
switch_xml_attr
(
x_param
,
"value"
);
if
(
var
&&
val
&&
!
strcasecmp
(
var
,
key
))
{
result
=
val
;
}
}
}
}
end
:
if
(
result
)
{
stream
->
write_function
(
stream
,
"%s"
,
result
);
}
switch_safe_free
(
mydata
);
switch_safe_free
(
dup_domain
);
switch_event_destroy
(
&
params
);
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_STANDARD_API
(
user_data_function
)
{
switch_xml_t
x_user
=
NULL
,
x_param
,
x_params
;
...
...
@@ -7264,6 +7334,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API
(
commands_api_interface
,
"console_complete_xml"
,
""
,
console_complete_xml_function
,
"<line>"
);
SWITCH_ADD_API
(
commands_api_interface
,
"create_uuid"
,
"Create a uuid"
,
uuid_function
,
UUID_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"db_cache"
,
"Manage db cache"
,
db_cache_function
,
"status"
);
SWITCH_ADD_API
(
commands_api_interface
,
"domain_data"
,
"Find domain data"
,
domain_data_function
,
"<domain> [var|param|attr] <name>"
);
SWITCH_ADD_API
(
commands_api_interface
,
"domain_exists"
,
"Check if a domain exists"
,
domain_exists_function
,
"<domain>"
);
SWITCH_ADD_API
(
commands_api_interface
,
"echo"
,
"Echo"
,
echo_function
,
"<data>"
);
SWITCH_ADD_API
(
commands_api_interface
,
"event_channel_broadcast"
,
"Broadcast"
,
event_channel_broadcast_api_function
,
"<channel> <json>"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论