<p>Hey Guys,</p>
<p>My scenario: using jsonrpc over http to get information from a remote server inside OpenSIPS.</p>
<p>Request and reply will look like this:</p>
<pre><code>T 2015/05/03 10:23:46.296052 127.0.0.1:60767 -> 127.0.0.1:2080 [AP]
POST /jsonrpc HTTP/1.1.
Host: 127.0.0.1:2080.
Accept: */*.
Content-Type: application/json.
Content-Length: 112.
.
{ "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1001", "Destination": "1002" } ] }
May 3 10:23:46 OsipsDev1 /usr/sbin/opensips[2910]: { "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1001", "Destination": "1002" } ] }
#
T 2015/05/03 10:23:46.296983 127.0.0.1:2080 -> 127.0.0.1:60767 [AP]
HTTP/1.1 200 OK.
Content-Type: application/json.
Date: Sun, 03 May 2015 08:23:46 GMT.
Content-Length: 36.
.
{"id":"1","result":-1,"error":null}
</code></pre>
<p>When receiving the answer, I will use the following xlog statement in opensips:</p>
<pre><code>xlog("In CGR_AUTH_REPLY, reply received: $json(cgr_auth_reply), result: $json(cgr_auth_reply/result)");
</code></pre>
<p>The log would be:</p>
<pre><code>#May 3 10:23:46 OsipsDev1 /usr/sbin/opensips[2910]: In CGR_AUTH_REPLY, reply received: {"id":"1","result":-1,"error":null}#012, result: <null>
</code></pre>
<p>As you can see the reply is properly logged as a serialized json but when extracting the attribute which is an integer, it shows as null.</p>
<p>Ta,<br>
DanB</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/494">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciYiVnChqR2m9UhTKNdhB80uidwCCks5oFdRqgaJpZM4EOkUs.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/494"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>