Module: kamailio Branch: 6.1 Commit: c92362ee8674dc98388674b44d99befd23c04d36 URL: https://github.com/kamailio/kamailio/commit/c92362ee8674dc98388674b44d99befd23c04d36
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-02-25T21:23:21+01:00 cfg_rpc: compliant response for rpc cfg.help - it was overwriting a single string value for jsonrpc and standard rpc response structure, switched to structure with two fields for description and type (cherry picked from commit a8e9cd99b56e455ed8c21d2454f9d3286701b118) --- Modified: src/modules/cfg_rpc/cfg_rpc.c --- Diff: https://github.com/kamailio/kamailio/commit/c92362ee8674dc98388674b44d99befd23c04d36.diff Patch: https://github.com/kamailio/kamailio/commit/c92362ee8674dc98388674b44d99befd23c04d36.patch --- diff --git a/src/modules/cfg_rpc/cfg_rpc.c b/src/modules/cfg_rpc/cfg_rpc.c index 926a5dbcd3b..0c031e4cdc0 100644 --- a/src/modules/cfg_rpc/cfg_rpc.c +++ b/src/modules/cfg_rpc/cfg_rpc.c @@ -457,8 +457,9 @@ static const char *rpc_help_doc[2] = { static void rpc_help(rpc_t *rpc, void *c) { str group, var; - char *ch; + char *ch = NULL; unsigned int input_type; + void *rh = NULL; if(rpc->scan(c, "SS", &group, &var) < 2) return; @@ -467,16 +468,22 @@ static void rpc_help(rpc_t *rpc, void *c) rpc->fault(c, 400, "Failed to get the variable description"); return; } - rpc->add(c, "s", ch); + rpc->add(c, "{", &rh); + if(rh == NULL) { + LM_ERR("failed to add root structure\n"); + rpc->fault(c, 500, "Failed to add root structure"); + return; + } + rpc->struct_add(rh, "s", "desc", ch ? ch : "none"); switch(input_type) { case CFG_INPUT_INT: - rpc->rpl_printf(c, "(parameter type is integer)"); + rpc->struct_add(rh, "s", "type", "integer"); break; case CFG_INPUT_STRING: case CFG_INPUT_STR: - rpc->rpl_printf(c, "(parameter type is string)"); + rpc->struct_add(rh, "s", "type", "string"); break; } } _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
