Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
50e0f019
提交
50e0f019
authored
12月 08, 2016
作者:
Seven Du
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9832 start a single gateway or _all_ gateways
上级
8ab65c8c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
75 行增加
和
7 行删除
+75
-7
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+18
-1
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+1
-0
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+56
-6
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
50e0f019
...
...
@@ -3346,6 +3346,22 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
}
}
goto
done
;
}
else
if
(
!
strcasecmp
(
argv
[
1
],
"startgw"
))
{
if
(
argc
<
3
)
{
stream
->
write_function
(
stream
,
"-ERR missing gw name
\n
"
);
goto
done
;
}
switch_xml_reload
(
&
err
);
stream
->
write_function
(
stream
,
"Reload XML [%s]
\n
"
,
err
);
if
(
config_gateway
(
profile
->
name
,
argv
[
2
])
==
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"+OK start gateway %s complete
\n
"
,
argv
[
2
]);
}
else
{
stream
->
write_function
(
stream
,
"-ERR cannot add gateway %s for profile %s
\n
"
,
argv
[
2
],
profile
->
name
);
}
goto
done
;
}
...
...
@@ -6148,8 +6164,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles stop wait"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles flush_inbound_reg reboot"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles ::[register:unregister all"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles ::[register:unregister:killgw ::sofia::list_profile_gateway"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles ::[register:unregister:killgw
:startgw
::sofia::list_profile_gateway"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles killgw _all_"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles startgw _all_"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles ::[siptrace:capture:watchdog ::[on:off"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles gwlist ::[up:down"
);
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
50e0f019
...
...
@@ -989,6 +989,7 @@ void sofia_presence_event_handler(switch_event_t *event);
void
sofia_presence_cancel
(
void
);
switch_status_t
config_sofia
(
sofia_config_t
reload
,
char
*
profile_name
);
switch_status_t
config_gateway
(
const
char
*
profile_name
,
const
char
*
gateway_name
);
void
sofia_reg_auth_challenge
(
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_dispatch_event_t
*
de
,
sofia_regtype_t
regtype
,
const
char
*
realm
,
int
stale
,
long
exptime
);
auth_res_t
sofia_reg_parse_auth
(
sofia_profile_t
*
profile
,
sip_authorization_t
const
*
authorization
,
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
50e0f019
...
...
@@ -58,7 +58,7 @@ extern su_log_t stun_log[];
extern
su_log_t
su_log_default
[];
static
void
config_sofia_profile_urls
(
sofia_profile_t
*
profile
);
static
void
parse_gateways
(
sofia_profile_t
*
profile
,
switch_xml_t
gateways_tag
);
static
void
parse_gateways
(
sofia_profile_t
*
profile
,
switch_xml_t
gateways_tag
,
const
char
*
gwname
);
static
void
parse_domain_tag
(
sofia_profile_t
*
profile
,
switch_xml_t
x_domain_tag
,
const
char
*
dname
,
const
char
*
parse
,
const
char
*
alias
);
void
sofia_handle_sip_i_reinvite
(
switch_core_session_t
*
session
,
...
...
@@ -2967,7 +2967,7 @@ switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
if
((
xprofile
=
switch_xml_find_child
(
xprofiles
,
"profile"
,
"name"
,
profile
->
name
)))
{
if
((
gateways_tag
=
switch_xml_child
(
xprofile
,
"gateways"
)))
{
parse_gateways
(
profile
,
gateways_tag
);
parse_gateways
(
profile
,
gateways_tag
,
NULL
);
}
if
((
domains_tag
=
switch_xml_child
(
xprofile
,
"domains"
)))
{
...
...
@@ -3643,7 +3643,7 @@ static void parse_gateway_subscriptions(sofia_profile_t *profile, sofia_gateway_
}
}
static
void
parse_gateways
(
sofia_profile_t
*
profile
,
switch_xml_t
gateways_tag
)
static
void
parse_gateways
(
sofia_profile_t
*
profile
,
switch_xml_t
gateways_tag
,
const
char
*
gwname
)
{
switch_xml_t
gateway_tag
,
param
=
NULL
,
x_params
,
gw_subs_tag
;
sofia_gateway_t
*
gp
;
...
...
@@ -3659,6 +3659,11 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
goto
skip
;
}
if
(
gwname
&&
strcmp
(
gwname
,
name
))
{
free
(
pkey
);
goto
skip
;
}
switch_mutex_lock
(
mod_sofia_globals
.
hash_mutex
);
if
((
gp
=
switch_core_hash_find
(
mod_sofia_globals
.
gateway_hash
,
name
))
&&
(
gp
=
switch_core_hash_find
(
mod_sofia_globals
.
gateway_hash
,
pkey
))
&&
!
gp
->
deleted
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Ignoring duplicate gateway '%s'
\n
"
,
name
);
...
...
@@ -4100,7 +4105,7 @@ static void parse_domain_tag(sofia_profile_t *profile, switch_xml_t x_domain_tag
/* Backwards Compatibility */
for
(
ut
=
switch_xml_child
(
x_domain_tag
,
"user"
);
ut
;
ut
=
ut
->
next
)
{
if
(((
gateways_tag
=
switch_xml_child
(
ut
,
"gateways"
))))
{
parse_gateways
(
profile
,
gateways_tag
);
parse_gateways
(
profile
,
gateways_tag
,
NULL
);
}
}
/* New Method with <groups> tags and users are now inside a <users> tag */
...
...
@@ -4109,7 +4114,7 @@ static void parse_domain_tag(sofia_profile_t *profile, switch_xml_t x_domain_tag
for
(
uts
=
switch_xml_child
(
gt
,
"users"
);
uts
;
uts
=
uts
->
next
)
{
for
(
ut
=
switch_xml_child
(
uts
,
"user"
);
ut
;
ut
=
ut
->
next
)
{
if
(((
gateways_tag
=
switch_xml_child
(
ut
,
"gateways"
))))
{
parse_gateways
(
profile
,
gateways_tag
);
parse_gateways
(
profile
,
gateways_tag
,
NULL
);
}
}
}
...
...
@@ -4280,6 +4285,51 @@ switch_status_t sofia_init(void)
return
SWITCH_STATUS_SUCCESS
;
}
switch_status_t
config_gateway
(
const
char
*
profile_name
,
const
char
*
gateway_name
)
{
switch_xml_t
cfg
,
xml
=
NULL
,
xprofiles
,
xprofile
,
gateways_tag
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
sofia_profile_t
*
profile
=
NULL
;
switch_event_t
*
params
=
NULL
;
const
char
*
cf
=
"sofia.conf"
;
if
(
zstr
(
profile_name
)
||
!
(
profile
=
sofia_glue_find_profile
(
profile_name
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Profile [%s] does not exist.
\n
"
,
profile_name
);
status
=
SWITCH_STATUS_FALSE
;
return
status
;
}
switch_event_create
(
&
params
,
SWITCH_EVENT_REQUEST_PARAMS
);
switch_assert
(
params
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"profile"
,
profile_name
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"reconfig"
,
"true"
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"gateway"
,
gateway_name
);
if
(
!
(
xml
=
switch_xml_open_cfg
(
cf
,
&
cfg
,
params
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Open of %s failed
\n
"
,
gateway_name
);
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
}
if
((
xprofiles
=
switch_xml_child
(
cfg
,
"profiles"
)))
{
if
((
xprofile
=
switch_xml_find_child
(
xprofiles
,
"profile"
,
"name"
,
profile
->
name
)))
{
if
((
gateways_tag
=
switch_xml_child
(
xprofile
,
"gateways"
)))
{
parse_gateways
(
profile
,
gateways_tag
,
strcmp
(
gateway_name
,
"_all_"
)
?
gateway_name
:
NULL
);
}
}
}
status
=
SWITCH_STATUS_SUCCESS
;
done:
if
(
profile
)
sofia_glue_release_profile
(
profile
);
if
(
xml
)
switch_xml_free
(
xml
);
switch_event_destroy
(
&
params
);
return
status
;
}
switch_status_t
config_sofia
(
sofia_config_t
reload
,
char
*
profile_name
)
{
...
...
@@ -5923,7 +5973,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
}
if
((
gateways_tag
=
switch_xml_child
(
xprofile
,
"gateways"
)))
{
parse_gateways
(
profile
,
gateways_tag
);
parse_gateways
(
profile
,
gateways_tag
,
NULL
);
}
status
=
SWITCH_STATUS_SUCCESS
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论