Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
44a54271
提交
44a54271
authored
8月 24, 2012
作者:
Kapil Gupta
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding statistics
上级
cd6f4fbf
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
110 行增加
和
22 行删除
+110
-22
media_gateway.c
src/mod/endpoints/mod_media_gateway/media_gateway.c
+3
-0
media_gateway_cli.c
src/mod/endpoints/mod_media_gateway/media_gateway_cli.c
+51
-6
media_gateway_cmd_handler.c
...d/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
+37
-16
mod_media_gateway.h
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h
+19
-0
没有找到文件。
src/mod/endpoints/mod_media_gateway/media_gateway.c
浏览文件 @
44a54271
...
@@ -450,6 +450,8 @@ switch_status_t megaco_context_add_termination(mg_context_t *ctx, mg_termination
...
@@ -450,6 +450,8 @@ switch_status_t megaco_context_add_termination(mg_context_t *ctx, mg_termination
ctx
->
terminations
[
1
]
->
name
,
ctx
->
terminations
[
1
]
->
uuid
);
ctx
->
terminations
[
1
]
->
name
,
ctx
->
terminations
[
1
]
->
uuid
);
switch_ivr_uuid_bridge
(
ctx
->
terminations
[
0
]
->
uuid
,
ctx
->
terminations
[
1
]
->
uuid
);
switch_ivr_uuid_bridge
(
ctx
->
terminations
[
0
]
->
uuid
,
ctx
->
terminations
[
1
]
->
uuid
);
ctx
->
terminations
[
0
]
->
profile
->
mg_stats
->
total_num_of_call_recvd
++
;
}
}
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
...
@@ -638,6 +640,7 @@ switch_status_t megaco_profile_start(const char *profilename)
...
@@ -638,6 +640,7 @@ switch_status_t megaco_profile_start(const char *profilename)
profile
->
next_context_id
++
;
profile
->
next_context_id
++
;
profile
->
inact_tmr
=
0x00
;
profile
->
inact_tmr
=
0x00
;
profile
->
peer_active
=
0x00
;
profile
->
peer_active
=
0x00
;
profile
->
mg_stats
=
switch_core_alloc
(
pool
,
sizeof
(
mg_stats_t
));
profile
->
inact_tmr_task_id
=
0x00
;
profile
->
inact_tmr_task_id
=
0x00
;
switch_thread_rwlock_create
(
&
profile
->
rwlock
,
pool
);
switch_thread_rwlock_create
(
&
profile
->
rwlock
,
pool
);
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_cli.c
浏览文件 @
44a54271
...
@@ -20,6 +20,7 @@ switch_status_t handle_all_term_status_cli_cmd(switch_stream_handle_t *stream, m
...
@@ -20,6 +20,7 @@ switch_status_t handle_all_term_status_cli_cmd(switch_stream_handle_t *stream, m
void
get_peer_xml_buffer
(
char
*
prntBuf
,
MgPeerSta
*
cfm
);
void
get_peer_xml_buffer
(
char
*
prntBuf
,
MgPeerSta
*
cfm
);
void
megaco_cli_print_usage
(
switch_stream_handle_t
*
stream
);
void
megaco_cli_print_usage
(
switch_stream_handle_t
*
stream
);
switch_status_t
handle_show_activecalls_cli_cmd
(
switch_stream_handle_t
*
stream
,
megaco_profile_t
*
mg_profile
);
switch_status_t
handle_show_activecalls_cli_cmd
(
switch_stream_handle_t
*
stream
,
megaco_profile_t
*
mg_profile
);
switch_status_t
handle_show_stats
(
switch_stream_handle_t
*
stream
,
megaco_profile_t
*
mg_profile
);
/******************************************************************************/
/******************************************************************************/
...
@@ -202,6 +203,12 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
...
@@ -202,6 +203,12 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
/* mg <mg-profile> show activecalls */
/* mg <mg-profile> show activecalls */
megaco_profile_release
(
profile
);
megaco_profile_release
(
profile
);
handle_show_activecalls_cli_cmd
(
stream
,
profile
);
handle_show_activecalls_cli_cmd
(
stream
,
profile
);
/*******************************************************************/
}
else
if
(
!
strcasecmp
(
argv
[
3
],
"stats"
)){
/*******************************************************************/
/* mg <mg-profile> show stats */
megaco_profile_release
(
profile
);
handle_show_stats
(
stream
,
profile
);
/*******************************************************************/
/*******************************************************************/
}
else
if
(
!
strcasecmp
(
argv
[
3
],
"alltermstatus"
)){
}
else
if
(
!
strcasecmp
(
argv
[
3
],
"alltermstatus"
)){
/*******************************************************************/
/*******************************************************************/
...
@@ -287,13 +294,13 @@ void megaco_cli_print_usage(switch_stream_handle_t *stream)
...
@@ -287,13 +294,13 @@ void megaco_cli_print_usage(switch_stream_handle_t *stream)
stream
->
write_function
(
stream
,
"Usage: Profile Specific
\n
"
);
stream
->
write_function
(
stream
,
"Usage: Profile Specific
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> start
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> start
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> stop
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> stop
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> status
\n
"
);
//
stream->write_function(stream, "mg profile <profile-name> status \n");
stream
->
write_function
(
stream
,
"mg profile <profile-name> xmlstatus
\n
"
);
//
stream->write_function(stream, "mg profile <profile-name> xmlstatus \n");
stream
->
write_function
(
stream
,
"mg profile <profile-name> peerxmlstatus
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> peerxmlstatus
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> send sc <term-id> <method> <reason>
\n
"
);
//
stream->write_function(stream, "mg profile <profile-name> send sc <term-id> <method> <reason> \n");
stream
->
write_function
(
stream
,
"mg profile <profile-name> send notify <term-id> <digits>
\n
"
);
//
stream->write_function(stream, "mg profile <profile-name> send notify <term-id> <digits> \n");
stream
->
write_function
(
stream
,
"mg profile <profile-name> send ito notify
\n
"
);
//
stream->write_function(stream, "mg profile <profile-name> send ito notify \n");
stream
->
write_function
(
stream
,
"mg profile <profile-name> send cng <term-id>
\n
"
);
//
stream->write_function(stream, "mg profile <profile-name> send cng <term-id> \n");
stream
->
write_function
(
stream
,
"mg profile <profile-name> show activecalls
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> show activecalls
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> show termstatus <term-id>
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> show termstatus <term-id>
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> show alltermstatus
\n
"
);
stream
->
write_function
(
stream
,
"mg profile <profile-name> show alltermstatus
\n
"
);
...
@@ -868,3 +875,41 @@ switch_status_t handle_show_activecalls_cli_cmd(switch_stream_handle_t *stream,
...
@@ -868,3 +875,41 @@ switch_status_t handle_show_activecalls_cli_cmd(switch_stream_handle_t *stream,
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
/******************************************************************************/
switch_status_t
handle_show_stats
(
switch_stream_handle_t
*
stream
,
megaco_profile_t
*
mg_profile
)
{
if
(
!
mg_profile
||
!
mg_profile
->
mg_stats
){
stream
->
write_function
(
stream
,
"-ERR NULL profile/term pointer
\n
"
);
return
SWITCH_STATUS_FALSE
;
}
stream
->
write_function
(
stream
,
"Total Number of Physical ADD received = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_phy_add_recvd
);
stream
->
write_function
(
stream
,
"Total Number of RTP ADD received = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_rtp_add_recvd
);
stream
->
write_function
(
stream
,
"Total Number of SUB received = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_sub_recvd
);
stream
->
write_function
(
stream
,
"Total Number of CALL received = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_call_recvd
);
stream
->
write_function
(
stream
,
"Total Number of ADD failed = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_add_failed
);
stream
->
write_function
(
stream
,
"Total Number of Term Already in context Error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_term_already_in_ctxt_error
);
stream
->
write_function
(
stream
,
"Total Number of choose context failed Error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_choose_ctxt_failed_error
);
stream
->
write_function
(
stream
,
"Total Number of choose term failed Error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_choose_term_failed_error
);
stream
->
write_function
(
stream
,
"Total Number of find term failed Error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_find_term_failed_error
);
stream
->
write_function
(
stream
,
"Total Number of get context failed Error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_get_ctxt_failed_error
);
stream
->
write_function
(
stream
,
"Total Number of un-supported codec error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_un_supported_codec_error
);
stream
->
write_function
(
stream
,
"Total Number of Term addition to context failed error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_add_term_failed_error
);
stream
->
write_function
(
stream
,
"Total Number of Term activation failed error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_term_activation_failed_error
);
stream
->
write_function
(
stream
,
"Total Number of Term not found in context error = %d
\n
"
,
mg_profile
->
mg_stats
->
total_num_of_no_term_ctxt_error
);
return
SWITCH_STATUS_SUCCESS
;
}
/******************************************************************************/
src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
浏览文件 @
44a54271
...
@@ -629,10 +629,11 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -629,10 +629,11 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
mg_ctxt
=
megaco_choose_context
(
mg_profile
);
mg_ctxt
=
megaco_choose_context
(
mg_profile
);
if
(
NULL
==
mg_ctxt
){
if
(
NULL
==
mg_ctxt
){
mg_profile
->
mg_stats
->
total_num_of_choose_ctxt_failed_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" megaco_choose_context failed
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" megaco_choose_context failed
\n
"
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
goto
error
;
goto
error
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" Allocated Context[%p] with context_id[%d]
\n
"
,
(
void
*
)
mg_ctxt
,
mg_ctxt
->
context_id
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" Allocated Context[%p] with context_id[%d]
\n
"
,
(
void
*
)
mg_ctxt
,
mg_ctxt
->
context_id
);
...
@@ -653,6 +654,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -653,6 +654,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" megaco_get_context failed for context-id[%ld]
\n
"
,
inc_cmd
->
contextId
.
val
.
val
);
" megaco_get_context failed for context-id[%ld]
\n
"
,
inc_cmd
->
contextId
.
val
.
val
);
#endif
#endif
mg_profile
->
mg_stats
->
total_num_of_get_ctxt_failed_error
++
;
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
goto
error
;
goto
error
;
...
@@ -665,8 +667,10 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -665,8 +667,10 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
(
MGT_TERMID_CHOOSE
==
termId
->
type
.
val
)){
(
MGT_TERMID_CHOOSE
==
termId
->
type
.
val
)){
term
=
megaco_choose_termination
(
mg_profile
,
mg_profile
->
rtp_termination_id_prefix
);
term
=
megaco_choose_termination
(
mg_profile
,
mg_profile
->
rtp_termination_id_prefix
);
mg_profile
->
mg_stats
->
total_num_of_rtp_add_recvd
++
;
if
(
NULL
==
term
){
if
(
NULL
==
term
){
mg_profile
->
mg_stats
->
total_num_of_choose_term_failed_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" megaco_choose_termination failed
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" megaco_choose_termination failed
\n
"
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
...
@@ -680,8 +684,10 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -680,8 +684,10 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/********************************************************************/
/********************************************************************/
}
else
{
/* Physical termination */
}
else
{
/* Physical termination */
term
=
megaco_find_termination
(
mg_profile
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
term
=
megaco_find_termination
(
mg_profile
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
mg_profile
->
mg_stats
->
total_num_of_phy_add_recvd
++
;
if
(
NULL
==
term
){
if
(
NULL
==
term
){
mg_profile
->
mg_stats
->
total_num_of_find_term_failed_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" megaco_find_termination failed for term-id[%s]
\n
"
,(
char
*
)
termId
->
name
.
lcl
.
val
);
" megaco_find_termination failed for term-id[%s]
\n
"
,(
char
*
)
termId
->
name
.
lcl
.
val
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
...
@@ -697,6 +703,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -697,6 +703,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/* check if termination already is in call */
/* check if termination already is in call */
if
(
term
->
context
){
if
(
term
->
context
){
mg_profile
->
mg_stats
->
total_num_of_term_already_in_ctxt_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" Termination[%p : %s] "
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" Termination[%p : %s] "
"already in context[%p -%d]..rejecting ADD
\n
"
,
"already in context[%p -%d]..rejecting ADD
\n
"
,
(
void
*
)
term
,
term
->
name
,
(
void
*
)
term
->
context
,
term
->
context
->
context_id
);
(
void
*
)
term
,
term
->
name
,
(
void
*
)
term
->
context
,
term
->
context
->
context_id
);
...
@@ -711,6 +718,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -711,6 +718,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/* IF there is any error , return */
/* IF there is any error , return */
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
mg_profile
->
mg_stats
->
total_num_of_un_supported_codec_error
++
;
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
err_code
=
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
;
err_code
=
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
;
goto
error
;
goto
error
;
...
@@ -719,6 +727,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -719,6 +727,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/* associate physical termination to context */
/* associate physical termination to context */
if
(
SWITCH_STATUS_FALSE
==
megaco_context_add_termination
(
mg_ctxt
,
term
)){
if
(
SWITCH_STATUS_FALSE
==
megaco_context_add_termination
(
mg_ctxt
,
term
)){
mg_profile
->
mg_stats
->
total_num_of_add_term_failed_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"megaco_context_add_termination failed
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"megaco_context_add_termination failed
\n
"
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
err_code
=
MGT_MGCO_RSP_CODE_RSRC_ERROR
;
...
@@ -818,6 +827,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -818,6 +827,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/* only for RTP */
/* only for RTP */
if
(
SWITCH_STATUS_FALSE
==
mg_build_sdp
(
&
desc
->
u
.
media
,
inc_med_desc
,
mg_profile
,
term
,
&
rsp
.
u
.
mgCmdRsp
[
0
]
->
memCp
))
{
if
(
SWITCH_STATUS_FALSE
==
mg_build_sdp
(
&
desc
->
u
.
media
,
inc_med_desc
,
mg_profile
,
term
,
&
rsp
.
u
.
mgCmdRsp
[
0
]
->
memCp
))
{
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
mg_profile
->
mg_stats
->
total_num_of_un_supported_codec_error
++
;
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
err_code
=
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
;
err_code
=
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
;
goto
error
;
goto
error
;
...
@@ -846,6 +856,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
...
@@ -846,6 +856,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
return
ret
;
return
ret
;
error:
error:
mg_profile
->
mg_stats
->
total_num_of_add_failed
++
;
if
(
SWITCH_STATUS_SUCCESS
==
if
(
SWITCH_STATUS_SUCCESS
==
mg_build_mgco_err_request
(
&
mgErr
,
txn_id
,
ctxtId
,
err_code
,
&
errTxt
))
{
mg_build_mgco_err_request
(
&
mgErr
,
txn_id
,
ctxtId
,
err_code
,
&
errTxt
))
{
sng_mgco_send_err
(
mg_profile
->
idx
,
mgErr
);
sng_mgco_send_err
(
mg_profile
->
idx
,
mgErr
);
...
@@ -956,6 +967,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
...
@@ -956,6 +967,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
term
=
megaco_find_termination
(
mg_profile
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
term
=
megaco_find_termination
(
mg_profile
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
if
(
NULL
==
term
){
if
(
NULL
==
term
){
mg_profile
->
mg_stats
->
total_num_of_find_term_failed_error
++
;
mg_util_set_term_string
(
&
errTxt
,
termId
);
mg_util_set_term_string
(
&
errTxt
,
termId
);
err_code
=
MGT_MGCO_RSP_CODE_UNKNOWN_TERM_ID
;
err_code
=
MGT_MGCO_RSP_CODE_UNKNOWN_TERM_ID
;
goto
error
;
goto
error
;
...
@@ -970,6 +982,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
...
@@ -970,6 +982,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
/*find context based on received context-id */
/*find context based on received context-id */
mg_ctxt
=
megaco_get_context
(
mg_profile
,
ctxtId
->
val
.
val
);
mg_ctxt
=
megaco_get_context
(
mg_profile
,
ctxtId
->
val
.
val
);
if
(
NULL
==
mg_ctxt
){
if
(
NULL
==
mg_ctxt
){
mg_profile
->
mg_stats
->
total_num_of_get_ctxt_failed_error
++
;
#ifdef BIT_64
#ifdef BIT_64
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Modify request Failed, context[%d] not found
\n
"
,
ctxtId
->
val
.
val
);
"Modify request Failed, context[%d] not found
\n
"
,
ctxtId
->
val
.
val
);
...
@@ -983,6 +996,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
...
@@ -983,6 +996,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
}
}
if
(
SWITCH_STATUS_FALSE
==
megaco_context_is_term_present
(
mg_ctxt
,
term
)){
if
(
SWITCH_STATUS_FALSE
==
megaco_context_is_term_present
(
mg_ctxt
,
term
)){
mg_profile
->
mg_stats
->
total_num_of_no_term_ctxt_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Modify request Failed, requested term not associated with any context
\n
"
);
"Modify request Failed, requested term not associated with any context
\n
"
);
/* ERROR - termination didnt bind with requested context */
/* ERROR - termination didnt bind with requested context */
...
@@ -1012,6 +1026,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
...
@@ -1012,6 +1026,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
/* IF there is any error , return */
/* IF there is any error , return */
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
mg_profile
->
mg_stats
->
total_num_of_un_supported_codec_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Modify request Failed, Unsupported Codec
\n
"
);
"Modify request Failed, Unsupported Codec
\n
"
);
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
...
@@ -1041,6 +1056,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
...
@@ -1041,6 +1056,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
/* SDP updated to termination */
/* SDP updated to termination */
if
(
SWITCH_STATUS_SUCCESS
!=
megaco_activate_termination
(
term
))
{
if
(
SWITCH_STATUS_SUCCESS
!=
megaco_activate_termination
(
term
))
{
mg_profile
->
mg_stats
->
total_num_of_term_activation_failed_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Modify request Failed, Activation of termination failed
\n
"
);
"Modify request Failed, Activation of termination failed
\n
"
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
mg_util_set_err_string
(
&
errTxt
,
" Resource Failure "
);
...
@@ -1193,6 +1209,8 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
...
@@ -1193,6 +1209,8 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
termLst
=
mg_get_term_id_list
(
inc_cmd
);
termLst
=
mg_get_term_id_list
(
inc_cmd
);
termId
=
termLst
->
terms
[
0
];
termId
=
termLst
->
terms
[
0
];
mg_profile
->
mg_stats
->
total_num_of_sub_recvd
++
;
/************************************************************************************************************************************************************/
/************************************************************************************************************************************************************/
/* Validating Subtract request *******************************************/
/* Validating Subtract request *******************************************/
...
@@ -1243,6 +1261,7 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
...
@@ -1243,6 +1261,7 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
/*find context based on received context-id */
/*find context based on received context-id */
mg_ctxt
=
megaco_get_context
(
mg_profile
,
ctxtId
->
val
.
val
);
mg_ctxt
=
megaco_get_context
(
mg_profile
,
ctxtId
->
val
.
val
);
if
(
NULL
==
mg_ctxt
){
if
(
NULL
==
mg_ctxt
){
mg_profile
->
mg_stats
->
total_num_of_get_ctxt_failed_error
++
;
mg_util_set_ctxt_string
(
&
errTxt
,
ctxtId
);
mg_util_set_ctxt_string
(
&
errTxt
,
ctxtId
);
err_code
=
MGT_MGCO_RSP_CODE_UNKNOWN_CTXT
;
err_code
=
MGT_MGCO_RSP_CODE_UNKNOWN_CTXT
;
goto
error
;
goto
error
;
...
@@ -1262,22 +1281,24 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
...
@@ -1262,22 +1281,24 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
term
=
megaco_find_termination
(
mg_profile
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
term
=
megaco_find_termination
(
mg_profile
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
if
(
SWITCH_STATUS_FALSE
==
megaco_context_is_term_present
(
mg_ctxt
,
term
)){
if
(
NULL
==
term
){
mg_profile
->
mg_stats
->
total_num_of_find_term_failed_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Subtract request Failed, termination no associated with any context
\n
"
);
"Subtract request Failed, no termination found for input term string[%s]
\n
"
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
/* ERROR - termination didnt bind with requested context */
mg_util_set_term_string
(
&
errTxt
,
termId
);
mg_util_set_term_string
(
&
errTxt
,
termId
);
err_code
=
MGT_MGCO_RSP_CODE_UNKNOWN_TERM_ID
;
err_code
=
MGT_MGCO_RSP_CODE_NO_TERM_CTXT
;
goto
error
;
goto
error
;
}
}
if
(
NULL
==
term
){
if
(
SWITCH_STATUS_FALSE
==
megaco_context_is_term_present
(
mg_ctxt
,
term
)){
mg_profile
->
mg_stats
->
total_num_of_no_term_ctxt_error
++
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Subtract request Failed, no termination found for input term string[%s]
\n
"
,
(
char
*
)
termId
->
name
.
lcl
.
val
);
"Subtract request Failed, termination no associated with any context
\n
"
);
mg_util_set_term_string
(
&
errTxt
,
termId
);
/* ERROR - termination didnt bind with requested context */
err_code
=
MGT_MGCO_RSP_CODE_UNKNOWN_TERM_ID
;
mg_util_set_term_string
(
&
errTxt
,
termId
);
goto
error
;
err_code
=
MGT_MGCO_RSP_CODE_NO_TERM_CTXT
;
}
goto
error
;
}
/* remove termination from context */
/* remove termination from context */
megaco_context_sub_termination
(
mg_ctxt
,
term
);
megaco_context_sub_termination
(
mg_ctxt
,
term
);
...
...
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h
浏览文件 @
44a54271
...
@@ -61,6 +61,24 @@ typedef struct mg_peer_profile_s{
...
@@ -61,6 +61,24 @@ typedef struct mg_peer_profile_s{
}
mg_peer_profile_t
;
}
mg_peer_profile_t
;
typedef
struct
mg_stats_s
{
uint32_t
total_num_of_phy_add_recvd
;
uint32_t
total_num_of_rtp_add_recvd
;
uint32_t
total_num_of_sub_recvd
;
uint32_t
total_num_of_call_recvd
;
uint32_t
total_num_of_add_failed
;
uint32_t
total_num_of_term_already_in_ctxt_error
;
uint32_t
total_num_of_choose_ctxt_failed_error
;
uint32_t
total_num_of_choose_term_failed_error
;
uint32_t
total_num_of_find_term_failed_error
;
uint32_t
total_num_of_get_ctxt_failed_error
;
uint32_t
total_num_of_un_supported_codec_error
;
uint32_t
total_num_of_add_term_failed_error
;
uint32_t
total_num_of_term_activation_failed_error
;
uint32_t
total_num_of_no_term_ctxt_error
;
}
mg_stats_t
;
typedef
enum
{
typedef
enum
{
MG_TERM_FREE
=
0
,
MG_TERM_FREE
=
0
,
MG_TERM_TDM
,
MG_TERM_TDM
,
...
@@ -217,6 +235,7 @@ struct megaco_profile_s {
...
@@ -217,6 +235,7 @@ struct megaco_profile_s {
uint32_t
rtpid_next
;
uint32_t
rtpid_next
;
mg_termination_t
*
physical_terminations
;
mg_termination_t
*
physical_terminations
;
mg_stats_t
*
mg_stats
;
switch_hash_t
*
terminations
;
switch_hash_t
*
terminations
;
switch_thread_rwlock_t
*
terminations_rwlock
;
switch_thread_rwlock_t
*
terminations_rwlock
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论