206
206
#define MI_RTP_PROXY_NOT_FOUND_LEN (sizeof(MI_RTP_PROXY_NOT_FOUND)-1)
207
207
#define MI_PING_DISABLED "NATping disabled from script"
208
208
#define MI_PING_DISABLED_LEN (sizeof(MI_PING_DISABLED)-1)
209
- #define MI_SET "set "
209
+ #define MI_SET "Set "
210
210
#define MI_SET_LEN (sizeof(MI_SET)-1)
211
+ #define MI_NODE "node"
212
+ #define MI_NODE_LEN (sizeof(MI_NODE)-1)
211
213
#define MI_INDEX "index"
212
214
#define MI_INDEX_LEN (sizeof(MI_INDEX)-1)
213
215
#define MI_DISABLED "disabled"
@@ -999,15 +1001,15 @@ static struct mi_root* mi_enable_rtp_proxy(struct mi_root* cmd_tree,
999
1001
}
1000
1002
1001
1003
1002
- #define add_rtpp_node_int_info (_parent , _name , _name_len , _value , _child ,\
1004
+ #define add_rtpp_node_int_info (_parent , _name , _name_len , _value , _attr ,\
1003
1005
_len , _string , _error )\
1004
1006
do {\
1005
1007
(_string) = int2str((_value), &(_len));\
1006
1008
if((_string) == 0){\
1007
1009
LM_ERR("cannot convert int value\n");\
1008
1010
goto _error;\
1009
1011
}\
1010
- if(((_child ) = add_mi_node_child ((_parent), MI_DUP_VALUE, (_name), \
1012
+ if(((_attr ) = add_mi_attr ((_parent), MI_DUP_VALUE, (_name), \
1011
1013
(_name_len), (_string), (_len)) ) == 0)\
1012
1014
goto _error;\
1013
1015
}while(0);
@@ -1061,7 +1063,7 @@ static struct mi_root* mi_reload_rtpproxies(struct mi_root* cmd_tree, void* para
1061
1063
static struct mi_root * mi_show_rtpproxies (struct mi_root * cmd_tree ,
1062
1064
void * param )
1063
1065
{
1064
- struct mi_node * node , * crt_node , * child ;
1066
+ struct mi_node * node , * crt_node , * set_node ;
1065
1067
struct mi_root * root ;
1066
1068
struct mi_attr * attr ;
1067
1069
struct rtpp_set * rtpp_list ;
@@ -1086,37 +1088,38 @@ static struct mi_root* mi_show_rtpproxies(struct mi_root* cmd_tree,
1086
1088
for (rtpp_list = (* rtpp_set_list )-> rset_first ; rtpp_list != NULL ;
1087
1089
rtpp_list = rtpp_list -> rset_next ){
1088
1090
1091
+ id = int2str (rtpp_list -> id_set , & id_len );
1092
+ if (!id ){
1093
+ LM_ERR ("cannot convert set id\n" );
1094
+ goto error ;
1095
+ }
1096
+
1097
+ if (!(set_node = add_mi_node_child (node , MI_IS_ARRAY |MI_DUP_VALUE , MI_SET , MI_SET_LEN ,
1098
+ id , id_len ))) {
1099
+ LM_ERR ("cannot add the set node to the tree\n" );
1100
+ goto error ;
1101
+ }
1102
+
1089
1103
for (crt_rtpp = rtpp_list -> rn_first ; crt_rtpp != NULL ;
1090
1104
crt_rtpp = crt_rtpp -> rn_next ){
1091
1105
1092
- id = int2str (rtpp_list -> id_set , & id_len );
1093
- if (!id ){
1094
- LM_ERR ("cannot convert set id\n" );
1095
- goto error ;
1096
- }
1097
-
1098
- if (!(crt_node = add_mi_node_child (node , 0 , crt_rtpp -> rn_url .s ,
1099
- crt_rtpp -> rn_url .len , 0 ,0 )) ) {
1106
+ if (!(crt_node = add_mi_node_child (set_node , MI_DUP_VALUE ,
1107
+ MI_NODE , MI_NODE_LEN ,
1108
+ crt_rtpp -> rn_url .s , crt_rtpp -> rn_url .len )) ) {
1100
1109
LM_ERR ("cannot add the child node to the tree\n" );
1101
1110
goto error ;
1102
1111
}
1103
1112
1104
1113
LM_DBG ("adding node name %s \n" ,crt_rtpp -> rn_url .s );
1105
1114
1106
- if ((attr = add_mi_attr (crt_node , MI_DUP_VALUE , MI_SET , MI_SET_LEN ,
1107
- id , id_len ))== 0 ){
1108
- LM_ERR ("cannot add attributes to the node\n" );
1109
- goto error ;
1110
- }
1111
-
1112
1115
add_rtpp_node_int_info (crt_node , MI_INDEX , MI_INDEX_LEN ,
1113
- crt_rtpp -> idx , child , len ,string ,error );
1116
+ crt_rtpp -> idx , attr , len ,string ,error );
1114
1117
add_rtpp_node_int_info (crt_node , MI_DISABLED , MI_DISABLED_LEN ,
1115
- crt_rtpp -> rn_disabled , child , len ,string ,error );
1118
+ crt_rtpp -> rn_disabled , attr , len ,string ,error );
1116
1119
add_rtpp_node_int_info (crt_node , MI_WEIGHT , MI_WEIGHT_LEN ,
1117
- crt_rtpp -> rn_weight , child , len , string ,error );
1120
+ crt_rtpp -> rn_weight , attr , len , string ,error );
1118
1121
add_rtpp_node_int_info (crt_node , MI_RECHECK_TICKS ,MI_RECHECK_T_LEN ,
1119
- crt_rtpp -> rn_recheck_ticks , child , len , string , error );
1122
+ crt_rtpp -> rn_recheck_ticks , attr , len , string , error );
1120
1123
}
1121
1124
}
1122
1125
0 commit comments