Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a7ac2725
提交
a7ac2725
authored
5月 31, 2012
作者:
kapil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding MEGACO Stack STOP/SHUTDOWN code
上级
a3995ad1
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
231 行增加
和
3 行删除
+231
-3
megaco.c
src/mod/endpoints/mod_megaco/megaco.c
+5
-3
megaco_stack.c
src/mod/endpoints/mod_megaco/megaco_stack.c
+225
-0
megaco_stack.h
src/mod/endpoints/mod_megaco/megaco_stack.h
+1
-0
没有找到文件。
src/mod/endpoints/mod_megaco/megaco.c
浏览文件 @
a7ac2725
...
...
@@ -45,7 +45,7 @@ static switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t r
goto
done
;
}
/* iterate through MG Interface list to build
all MG profiles
*/
/* iterate through MG Interface list to build
requested MG profile
*/
for
(
mg_interface
=
switch_xml_child
(
mg_interfaces
,
"sng_mg_interface"
);
mg_interface
;
mg_interface
=
mg_interface
->
next
)
{
const
char
*
name
=
switch_xml_attr_soft
(
mg_interface
,
"name"
);
...
...
@@ -161,9 +161,11 @@ switch_status_t megaco_profile_destroy(megaco_profile_t **profile)
switch_thread_rwlock_wrlock
((
*
profile
)
->
rwlock
);
/* TODO: Kapil: Insert stack per-interface shutdown code here */
/* stop MEGACP stack */
if
(
SWITCH_STATUS_FALSE
==
sng_mgco_stop
((
*
profile
)
->
name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error stopping MEGACO Stack for profile %s
\n
"
,
(
*
profile
)
->
name
);
}
switch_thread_rwlock_unlock
((
*
profile
)
->
rwlock
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Stopped profile: %s
\n
"
,
(
*
profile
)
->
name
);
...
...
src/mod/endpoints/mod_megaco/megaco_stack.c
浏览文件 @
a7ac2725
...
...
@@ -29,6 +29,11 @@ int mgco_mg_tsap_enable_cntrl(int idx);
int
mgco_mg_ssap_cntrl
(
int
idx
);
int
mgco_mu_ssap_cntrl
(
int
idx
);
int
mgco_mg_tpt_server
(
int
idx
);
int
sng_mgco_tucl_shutdown
();
int
sng_mgco_mg_shutdown
();
int
sng_mgco_mg_ssap_stop
(
int
sapId
);
int
sng_mgco_mg_tpt_server_stop
(
int
idx
);
int
sng_mgco_mg_app_ssap_stop
(
int
idx
);
switch_status_t
sng_mgco_stack_gen_cfg
();
...
...
@@ -86,6 +91,12 @@ switch_status_t sng_mgco_init(sng_isup_event_interface_t* event)
/*****************************************************************************************************************/
switch_status_t
sng_mgco_stack_shutdown
()
{
/* shutdown MG */
sng_mgco_mg_shutdown
();
/* shutdown TUCL */
sng_mgco_tucl_shutdown
();
/* free MEGACO Application */
sng_isup_free_mu
();
...
...
@@ -258,6 +269,159 @@ switch_status_t sng_mgco_start(const char* profilename)
}
/*****************************************************************************************************************/
switch_status_t
sng_mgco_stop
(
const
char
*
profilename
)
{
int
idx
=
0x00
;
sng_mg_cfg_t
*
mgCfg
=
NULL
;
switch_assert
(
profilename
);
GET_MG_CFG_IDX
(
profilename
,
idx
);
if
(
!
idx
||
(
idx
==
MAX_MG_PROFILES
)){
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" No MG configuration found against profilename[%s]
\n
"
,
profilename
);
return
SWITCH_STATUS_FALSE
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" Stopping MG stack for idx[%d] against profilename[%s]
\n
"
,
idx
,
profilename
);
mgCfg
=
&
megaco_globals
.
g_mg_cfg
.
mgCfg
[
idx
];
/* MG STOP is as good as deleting that perticular mg(virtual mg instance) data from megaco stack */
/* currently we are not supporting enable/disable MG stack */
if
(
sng_mgco_mg_ssap_stop
(
mgCfg
->
id
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" sng_mgco_mg_ssap_stop FAILED
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" sng_mgco_mg_ssap_stop SUCCESS
\n
"
);
}
if
(
sng_mgco_mg_tpt_server_stop
(
idx
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" sng_mgco_mg_tpt_server_stop FAILED
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" sng_mgco_mg_tpt_server_stop SUCCESS
\n
"
);
}
if
(
sng_mgco_mg_app_ssap_stop
(
idx
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" sng_mgco_mg_app_ssap_stop FAILED
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" sng_mgco_mg_app_ssap_stop SUCCESS
\n
"
);
}
return
SWITCH_STATUS_SUCCESS
;
}
/*****************************************************************************************************************/
int
sng_mgco_mg_app_ssap_stop
(
int
idx
)
{
MuMngmt
mgMngmt
;
Pst
pst
;
/* Post for layer manager */
MuCntrl
*
cntrl
;
memset
(
&
mgMngmt
,
0
,
sizeof
(
mgMngmt
));
cntrl
=
&
(
mgMngmt
.
t
.
cntrl
);
/* initalize the post structure */
smPstInit
(
&
pst
);
/* insert the destination Entity */
pst
.
dstEnt
=
ENTMU
;
/*fill in the specific fields of the header */
mgMngmt
.
hdr
.
msgType
=
TCNTRL
;
mgMngmt
.
hdr
.
entId
.
ent
=
ENTMG
;
mgMngmt
.
hdr
.
entId
.
inst
=
S_INST
;
mgMngmt
.
hdr
.
elmId
.
elmnt
=
STSSAP
;
mgMngmt
.
hdr
.
elmId
.
elmntInst1
=
GET_MU_SAP_ID
(
idx
);
cntrl
->
action
=
ADEL
;
cntrl
->
subAction
=
SAELMNT
;
return
(
sng_cntrl_mu
(
&
pst
,
&
mgMngmt
));
}
/*****************************************************************************************************************/
int
sng_mgco_mg_ssap_stop
(
int
sapId
)
{
Pst
pst
;
MgMngmt
cntrl
;
memset
((
U8
*
)
&
pst
,
0
,
sizeof
(
Pst
));
memset
((
U8
*
)
&
cntrl
,
0
,
sizeof
(
MgCntrl
));
smPstInit
(
&
pst
);
pst
.
dstEnt
=
ENTMG
;
/* prepare header */
cntrl
.
hdr
.
msgType
=
TCNTRL
;
/* message type */
cntrl
.
hdr
.
entId
.
ent
=
ENTMG
;
/* entity */
cntrl
.
hdr
.
entId
.
inst
=
0
;
/* instance */
cntrl
.
hdr
.
elmId
.
elmnt
=
STSSAP
;
/* SSAP */
cntrl
.
hdr
.
elmId
.
elmntInst1
=
sapId
;
/* sap id */
cntrl
.
hdr
.
response
.
selector
=
0
;
cntrl
.
hdr
.
response
.
prior
=
PRIOR0
;
cntrl
.
hdr
.
response
.
route
=
RTESPEC
;
cntrl
.
hdr
.
response
.
mem
.
region
=
S_REG
;
cntrl
.
hdr
.
response
.
mem
.
pool
=
S_POOL
;
cntrl
.
t
.
cntrl
.
action
=
ADEL
;
cntrl
.
t
.
cntrl
.
subAction
=
SAELMNT
;
cntrl
.
t
.
cntrl
.
spId
=
sapId
;
return
(
sng_cntrl_mg
(
&
pst
,
&
cntrl
));
}
/*****************************************************************************************************************/
int
sng_mgco_mg_tpt_server_stop
(
int
idx
)
{
MgMngmt
mgMngmt
;
Pst
pst
;
/* Post for layer manager */
MgCntrl
*
cntrl
;
MgTptCntrl
*
tptCntrl
=
&
mgMngmt
.
t
.
cntrl
.
s
.
tptCntrl
;
CmInetIpAddr
ipAddr
=
0
;
sng_mg_cfg_t
*
mgCfg
=
&
megaco_globals
.
g_mg_cfg
.
mgCfg
[
idx
];
cntrl
=
&
(
mgMngmt
.
t
.
cntrl
);
memset
(
&
mgMngmt
,
0
,
sizeof
(
mgMngmt
));
/* initalize the post structure */
smPstInit
(
&
pst
);
/* insert the destination Entity */
pst
.
dstEnt
=
ENTMG
;
tptCntrl
->
transportType
=
GET_TPT_TYPE
(
idx
);
tptCntrl
->
serverAddr
.
type
=
CM_INET_IPV4ADDR_TYPE
;
tptCntrl
->
serverAddr
.
u
.
ipv4TptAddr
.
port
=
mgCfg
->
port
;
if
(
ROK
==
cmInetAddr
((
S8
*
)
mgCfg
->
my_ipaddr
,
&
ipAddr
))
{
tptCntrl
->
serverAddr
.
u
.
ipv4TptAddr
.
address
=
ntohl
(
ipAddr
);
}
/*fill in the specific fields of the header */
mgMngmt
.
hdr
.
msgType
=
TCNTRL
;
mgMngmt
.
hdr
.
entId
.
ent
=
ENTMG
;
mgMngmt
.
hdr
.
entId
.
inst
=
S_INST
;
mgMngmt
.
hdr
.
elmId
.
elmnt
=
STSERVER
;
cntrl
->
action
=
ADEL
;
cntrl
->
subAction
=
SAELMNT
;
return
(
sng_cntrl_mg
(
&
pst
,
&
mgMngmt
));
}
/*****************************************************************************************************************/
int
mgco_mg_tsap_bind_cntrl
(
int
idx
)
{
MgMngmt
mgMngmt
;
...
...
@@ -962,3 +1126,64 @@ int mgco_mg_tpt_server_config(int idx)
}
/******************************************************************************/
int
sng_mgco_tucl_shutdown
()
{
Pst
pst
;
HiMngmt
cntrl
;
memset
((
U8
*
)
&
pst
,
0
,
sizeof
(
Pst
));
memset
((
U8
*
)
&
cntrl
,
0
,
sizeof
(
HiMngmt
));
smPstInit
(
&
pst
);
pst
.
dstEnt
=
ENTHI
;
/* prepare header */
cntrl
.
hdr
.
msgType
=
TCNTRL
;
/* message type */
cntrl
.
hdr
.
entId
.
ent
=
ENTHI
;
/* entity */
cntrl
.
hdr
.
entId
.
inst
=
0
;
/* instance */
cntrl
.
hdr
.
elmId
.
elmnt
=
STGEN
;
/* General */
cntrl
.
hdr
.
response
.
selector
=
0
;
cntrl
.
hdr
.
response
.
prior
=
PRIOR0
;
cntrl
.
hdr
.
response
.
route
=
RTESPEC
;
cntrl
.
hdr
.
response
.
mem
.
region
=
S_REG
;
cntrl
.
hdr
.
response
.
mem
.
pool
=
S_POOL
;
cntrl
.
t
.
cntrl
.
action
=
ASHUTDOWN
;
return
(
sng_cntrl_tucl
(
&
pst
,
&
cntrl
));
}
/******************************************************************************/
int
sng_mgco_mg_shutdown
()
{
Pst
pst
;
MgMngmt
cntrl
;
memset
((
U8
*
)
&
pst
,
0
,
sizeof
(
Pst
));
memset
((
U8
*
)
&
cntrl
,
0
,
sizeof
(
MgCntrl
));
smPstInit
(
&
pst
);
pst
.
dstEnt
=
ENTMG
;
/* prepare header */
cntrl
.
hdr
.
msgType
=
TCNTRL
;
/* message type */
cntrl
.
hdr
.
entId
.
ent
=
ENTMG
;
/* entity */
cntrl
.
hdr
.
entId
.
inst
=
0
;
/* instance */
cntrl
.
hdr
.
elmId
.
elmnt
=
STGEN
;
/* General */
cntrl
.
hdr
.
response
.
selector
=
0
;
cntrl
.
hdr
.
response
.
prior
=
PRIOR0
;
cntrl
.
hdr
.
response
.
route
=
RTESPEC
;
cntrl
.
hdr
.
response
.
mem
.
region
=
S_REG
;
cntrl
.
hdr
.
response
.
mem
.
pool
=
S_POOL
;
cntrl
.
t
.
cntrl
.
action
=
ASHUTDOWN
;
cntrl
.
t
.
cntrl
.
subAction
=
SAELMNT
;
return
(
sng_cntrl_mg
(
&
pst
,
&
cntrl
));
}
/******************************************************************************/
src/mod/endpoints/mod_megaco/megaco_stack.h
浏览文件 @
a7ac2725
...
...
@@ -108,6 +108,7 @@ void handle_tucl_alarm(Pst *pst, HiMngmt *sta);
switch_status_t
sng_mgco_init
(
sng_isup_event_interface_t
*
event
);
switch_status_t
sng_mgco_cfg
(
const
char
*
profilename
);
switch_status_t
sng_mgco_start
(
const
char
*
profilename
);
switch_status_t
sng_mgco_stop
(
const
char
*
profilename
);
switch_status_t
sng_mgco_stack_shutdown
(
void
);
/*****************************************************************************************************/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论