Hello,
indeed, the format was wrong, I just pushed a patch for it in master and branch 5.0:
-
https://github.com/kamailio/kamailio/commit/0956257ae6fdc0a801ce109017089ac18018e63b
Hi All,
I am currently trying to retrieve the contents of a htable using the JSONRPC-S module over HTTP, however I have observed if a slot contains multiple values, the JSON returned has duplicate keys which could be considered invalid.
Here are the relevant lines from kamailio.cfg -
event_route[xhttp:request] {
if ($hu =~ "^/carrier") {
jsonrpc_exec('{"jsonrpc": "2.0", "method": "htable.dump", "params" : {"htable": "carrier"}, "id": 1}');xhttp_reply("200", "OK", "text/html", "$jsonrpl(body)");
}}
And the output, showing a slot with two items-
{"entry": 5,"size": 2,"slot": {"item": {"name": "carrierA","value": "90","type": "str"},"item": {"name": "carrierB","value": "190","type": "str"}}}
And the same from `kamcmd -s unix:/tmp/kamailio_ctl htable.dump carrier` -
{entry: 5size: 2slot: {item: {name: carrierAvalue: 90type: str}item: {name: carrierBvalue: 190type: str}}}
Would it be possible to change it to something like the following -
{"entry": 5,"size": 2,"slot": [{"name": "carrierA","value": "90","type": "str"},{"name": "carrierB","value": "190","type": "str"}]}
Any other suggestions or work arounds would be appreciated,
ThanksMatthew
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com Kamailio World Conference - www.kamailioworld.com