<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>indeed, the format was wrong, I just pushed a patch for it in
master and branch 5.0:</p>
<p> -
<a class="moz-txt-link-freetext" href="https://github.com/kamailio/kamailio/commit/0956257ae6fdc0a801ce109017089ac18018e63b">https://github.com/kamailio/kamailio/commit/0956257ae6fdc0a801ce109017089ac18018e63b</a><br>
</p>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 03.11.17 17:01, Marrold wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAC-Lcd9yfRtOeZpjoNgVMSuj6YxiD1FFJkNDtDABz6r5fLMVMg@mail.gmail.com">
<div dir="ltr">Hi All,<br>
<div><br>
</div>
<div>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. <br>
<br>
Here are the relevant lines from kamailio.cfg -</div>
<div><br>
event_route[xhttp:request] {<br>
if ($hu =~ "^/carrier") {<br>
<div> jsonrpc_exec('{"jsonrpc": "2.0", "method":
"htable.dump", "params" : {"htable": "carrier"}, "id": 1}');</div>
<div> xhttp_reply("200", "OK", "text/html",
"$jsonrpl(body)");<br>
}</div>
<div>}<br>
<br>
</div>
<div>And the output, showing a slot with two items-</div>
<div><br>
<br>
</div>
<div>
<div>{</div>
<div><span style="white-space:pre"> </span>"entry": 5,</div>
<div><span style="white-space:pre"> </span>"size": 2,</div>
<div><span style="white-space:pre"> </span>"slot": {</div>
<div><span style="white-space:pre"> </span>"item": {</div>
<div><span style="white-space:pre"> </span>"name":
"carrierA",</div>
<div><span style="white-space:pre"> </span>"value": "90",</div>
<div><span style="white-space:pre"> </span>"type": "str"</div>
<div><span style="white-space:pre"> </span>},</div>
<div><span style="white-space:pre"> </span>"item": {</div>
<div><span style="white-space:pre"> </span>"name":
"carrierB",</div>
<div><span style="white-space:pre"> </span>"value": "190",</div>
<div><span style="white-space:pre"> </span>"type": "str"</div>
<div><span style="white-space:pre"> </span>}</div>
<div><span style="white-space:pre"> </span>}</div>
<div>}<br>
<br>
And the same from `kamcmd -s unix:/tmp/kamailio_ctl
htable.dump carrier` -<br>
<br>
<div>{</div>
<div><span style="white-space:pre"> </span>entry: 5</div>
<div><span style="white-space:pre"> </span>size: 2</div>
<div><span style="white-space:pre"> </span>slot: {</div>
<div><span style="white-space:pre"> </span>item: {</div>
<div><span style="white-space:pre"> </span>name:
carrierA</div>
<div><span style="white-space:pre"> </span>value: 90</div>
<div><span style="white-space:pre"> </span>type: str</div>
<div><span style="white-space:pre"> </span>}</div>
<div><span style="white-space:pre"> </span>item: {</div>
<div><span style="white-space:pre"> </span>name:
carrierB</div>
<div><span style="white-space:pre"> </span>value: 190</div>
<div><span style="white-space:pre"> </span>type: str</div>
<div><span style="white-space:pre"> </span>}</div>
<div><span style="white-space:pre"> </span>}</div>
<div>}<br>
<br>
Would it be possible to change it to something like the
following -<br>
<br>
<div>{</div>
<div> "entry": 5,</div>
<div> "size": 2,</div>
<div> "slot": [</div>
<div> {</div>
<div> "name": "carrierA",</div>
<div> "value": "90",</div>
<div> "type": "str"</div>
<div> },</div>
<div> {</div>
<div> "name": "carrierB",</div>
<div> "value": "190",</div>
<div> "type": "str"</div>
<div> }</div>
<div> ]</div>
<div>}<br>
<br>
Any other suggestions or work arounds would be
appreciated, </div>
<div><br>
Thanks</div>
</div>
<div>Matthew</div>
<br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>