Module: kamailio
Branch: master
Commit: bf3797ce7566fd5d993cbb0b0314f255b66bf662
URL:
https://github.com/kamailio/kamailio/commit/bf3797ce7566fd5d993cbb0b0314f25…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-10-31T17:24:24+01:00
jsonrpcs: kemi function to get the rpc command response
- shortcut to skip the pv get layer, can be useful for large values
---
Modified: src/modules/jsonrpcs/jsonrpcs_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bf3797ce7566fd5d993cbb0b0314f25…
Patch:
https://github.com/kamailio/kamailio/commit/bf3797ce7566fd5d993cbb0b0314f25…
---
diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c b/src/modules/jsonrpcs/jsonrpcs_mod.c
index d939be5d0f..5843d87a5f 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -1515,6 +1515,25 @@ static int ki_jsonrpcs_exec(sip_msg_t *msg, str *scmd)
return jsonrpc_exec_ex(scmd, NULL);
}
+/**
+ *
+ */
+static sr_kemi_xval_t _sr_kemi_jsonrpcs_xval = {0};
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_jsonrpcs_response(sip_msg_t *msg)
+{
+ if(_jsonrpc_plain_reply.rbody.s==NULL) {
+ sr_kemi_xval_null(&_sr_kemi_jsonrpcs_xval, SR_KEMI_XVAL_NULL_EMPTY);
+ return &_sr_kemi_jsonrpcs_xval;
+ }
+ _sr_kemi_jsonrpcs_xval.vtype = SR_KEMIP_STR;
+ _sr_kemi_jsonrpcs_xval.v.s = _jsonrpc_plain_reply.rbody;
+ return &_sr_kemi_jsonrpcs_xval;
+}
+
/**
*
*/
@@ -1530,6 +1549,11 @@ static sr_kemi_t sr_kemi_jsonrpcs_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("jsonrpcs"), str_init("response"),
+ SR_KEMIP_XVAL, ki_jsonrpcs_response,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};