From d2db2229f83cdf584c1dbb3485c31f01bc3e7dab Mon Sep 17 00:00:00 2001 From: lucian balanceanu Date: Mon, 16 Mar 2015 09:42:09 +0200 Subject: [PATCH] rtpengine: small addition to nh_show_rtpp - if a RTP proxy has been disabled by a mi command a "(permanent)" quote will appear when printing the disabled status. --- modules/rtpengine/doc/rtpengine_admin.xml | 4 +++- modules/rtpengine/rtpengine.c | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml index 576dd80772a..c03bc7dda9a 100644 --- a/modules/rtpengine/doc/rtpengine_admin.xml +++ b/modules/rtpengine/doc/rtpengine_admin.xml @@ -797,7 +797,9 @@ $ &ctltool; fifo nh_enable_rtpp udp:192.168.2.133:8081 0 <function moreinfo="none">nh_show_rtpp</function> Displays all the &rtp; proxies and their information: set and - status (disabled or not, weight and recheck_ticks). + status (disabled or not, weight and recheck_ticks). If a RTP proxy has been disabled by a mi command + a "(permanent)" quote will appear when printing the disabled status. This is to differentiate from + a temporary disable due to the proxy being not found responsive by kamailio. No parameter. diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c index 8b2a5b3ee0f..63fdba56240 100644 --- a/modules/rtpengine/rtpengine.c +++ b/modules/rtpengine/rtpengine.c @@ -109,6 +109,8 @@ MODULE_VERSION #define MI_RTP_PROXY_NOT_FOUND_LEN (sizeof(MI_RTP_PROXY_NOT_FOUND)-1) #define MI_PING_DISABLED "NATping disabled from script" #define MI_PING_DISABLED_LEN (sizeof(MI_PING_DISABLED)-1) +#define MI_DISABLED_PERMANENT "1 (permanent)" +#define MI_DISABLED_PERMANENT_LEN (sizeof(MI_DISABLED_PERMANENT)-1) #define MI_SET "set" #define MI_SET_LEN (sizeof(MI_SET)-1) #define MI_INDEX "index" @@ -760,8 +762,19 @@ static struct mi_root* mi_show_rtpproxies(struct mi_root* cmd_tree, add_rtpp_node_int_info(crt_node, MI_INDEX, MI_INDEX_LEN, crt_rtpp->idx, child, len,string,error); - add_rtpp_node_int_info(crt_node, MI_DISABLED, MI_DISABLED_LEN, - crt_rtpp->rn_disabled, child, len,string,error); + + if (( 1 == crt_rtpp->rn_disabled ) && ( crt_rtpp->rn_recheck_ticks == MI_MAX_RECHECK_TICKS)) { + if( !(child = add_mi_node_child(crt_node, MI_DUP_VALUE, MI_DISABLED, MI_DISABLED_LEN, + MI_DISABLED_PERMANENT, MI_DISABLED_PERMANENT_LEN))) { + LM_ERR("cannot add disabled (permanent) message\n"); + goto error; + } + } + else { + add_rtpp_node_int_info(crt_node, MI_DISABLED, MI_DISABLED_LEN, + crt_rtpp->rn_disabled, child, len,string,error); + } + add_rtpp_node_int_info(crt_node, MI_WEIGHT, MI_WEIGHT_LEN, crt_rtpp->rn_weight, child, len, string,error); add_rtpp_node_int_info(crt_node, MI_RECHECK_TICKS,MI_RECHECK_T_LEN,