[sr-dev] git:master:513a1763: dispatcher: print runtime details in rpc command output

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 7 13:06:25 CEST 2018


Module: kamailio
Branch: master
Commit: 513a176394247a3378ee218bf9df611da7296061
URL: https://github.com/kamailio/kamailio/commit/513a176394247a3378ee218bf9df611da7296061

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-06-07T13:05:04+02:00

dispatcher: print runtime details in rpc command output

- contains dialog loads per destination if the call load algorithm is enabled

---

Modified: src/modules/dispatcher/dispatcher.c

---

Diff:  https://github.com/kamailio/kamailio/commit/513a176394247a3378ee218bf9df611da7296061.diff
Patch: https://github.com/kamailio/kamailio/commit/513a176394247a3378ee218bf9df611da7296061.patch

---

diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c
index bcb085c624..72aa94d1e2 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1282,7 +1282,8 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void *rpc_handle)
 	void *sh;
 	void *vh;
 	void *wh;
-	void *lh; // latency stats handle
+	void *lh;
+	void *dh;
 	int j;
 	char c[3];
 	str data = STR_NULL;
@@ -1327,23 +1328,22 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void *rpc_handle)
 			c[1] = 'X';
 
 		if(node->dlist[j].attrs.body.s) {
-			if(rpc->struct_add(vh, "Ssd{", "URI", &node->dlist[j].uri, "FLAGS",
-					   c, "PRIORITY", node->dlist[j].priority, "ATTRS", &wh)
-					< 0) {
+			if(rpc->struct_add(vh, "Ssd{", "URI", &node->dlist[j].uri,
+					"FLAGS", c,
+					"PRIORITY", node->dlist[j].priority,
+					"ATTRS", &wh) < 0) {
 				rpc->fault(ctx, 500, "Internal error creating dest struct");
 				return -1;
 			}
-			if(rpc->struct_add(wh, "SSdddS", "BODY",
-					   &(node->dlist[j].attrs.body), "DUID",
-					   (node->dlist[j].attrs.duid.s)
-							   ? &(node->dlist[j].attrs.duid)
-							   : &data,
-					   "MAXLOAD", node->dlist[j].attrs.maxload, "WEIGHT",
-					   node->dlist[j].attrs.weight, "RWEIGHT",
-					   node->dlist[j].attrs.rweight, "SOCKET",
-					   (node->dlist[j].attrs.socket.s)
-							   ? &(node->dlist[j].attrs.socket)
-							   : &data)
+			if(rpc->struct_add(wh, "SSdddS",
+						"BODY", &(node->dlist[j].attrs.body),
+						"DUID", (node->dlist[j].attrs.duid.s)
+									? &(node->dlist[j].attrs.duid) : &data,
+						"MAXLOAD", node->dlist[j].attrs.maxload,
+						"WEIGHT", node->dlist[j].attrs.weight,
+						"RWEIGHT", node->dlist[j].attrs.rweight,
+						"SOCKET", (node->dlist[j].attrs.socket.s)
+									? &(node->dlist[j].attrs.socket) : &data)
 					< 0) {
 				rpc->fault(ctx, 500, "Internal error creating attrs struct");
 				return -1;
@@ -1371,6 +1371,16 @@ int ds_rpc_print_set(ds_set_t *node, rpc_t *rpc, void *ctx, void *rpc_handle)
 				return -1;
 			}
 		}
+		if (ds_hash_size>0) {
+			if(rpc->struct_add(vh, "{", "RUNTIME", &dh) < 0) {
+				rpc->fault(ctx, 500, "Internal error creating runtime struct");
+				return -1;
+			}
+			if (rpc->struct_add(dh, "d", "DLGLOAD", node->dlist[j].dload) < 0) {
+				rpc->fault(ctx, 500, "Internal error creating runtime attrs");
+				return -1;
+			}
+		}
 	}
 
 	return 0;




More information about the sr-dev mailing list