Module: kamailio Branch: master Commit: 017089c04f2d6876fcb43ea494f287e687efc5d9 URL: https://github.com/kamailio/kamailio/commit/017089c04f2d6876fcb43ea494f287e6...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2023-01-04T10:22:00+01:00
core: new rpc command core.echo_delta
- example of rpc command exported with RPC_EXEC_DELTA flag
---
Modified: src/core/core_cmd.c
---
Diff: https://github.com/kamailio/kamailio/commit/017089c04f2d6876fcb43ea494f287e6... Patch: https://github.com/kamailio/kamailio/commit/017089c04f2d6876fcb43ea494f287e6...
---
diff --git a/src/core/core_cmd.c b/src/core/core_cmd.c index 3c9f08e332..c89111d39e 100644 --- a/src/core/core_cmd.c +++ b/src/core/core_cmd.c @@ -240,7 +240,7 @@ static void system_listMethods(rpc_t* rpc, void* c) int i;
for(i=0; i<rpc_sarray_crt_size; i++){ - if (rpc->add(c, "s", rpc_sarray[i]->name) < 0) return; + if (rpc->add(c, "s", rpc_sarray[i]->r.name) < 0) return; } }
@@ -326,6 +326,20 @@ static void core_echo(rpc_t* rpc, void* c) }
+static const char* core_echo_delta_doc[] = { + "Returns back its parameters with execution delta limit.", /* Documentation string */ + 0 /* Method signature(s) */ +}; + + +static void core_echo_delta(rpc_t* rpc, void* c) +{ + char* string = 0; + while((rpc->scan(c, "*.s", &string)>0)) + rpc->add(c, "s", string); +} + + static const char* core_version_doc[] = { "Returns the version string of the server.", /* Documentation string */ 0 /* Method signature(s) */ @@ -1114,6 +1128,8 @@ static rpc_export_t core_rpc_methods[] = { RET_ARRAY}, {"core.echo", core_echo, core_echo_doc, RET_ARRAY}, + {"core.echo_delta", core_echo_delta, core_echo_delta_doc, + RET_ARRAY|RPC_EXEC_DELTA}, {"core.version", core_version, core_version_doc, 0 }, {"core.flags", core_flags, core_flags_doc,