<p>Hey Guys,</p>

<p>Running on commit <a href="https://github.com/OpenSIPS/opensips/commit/59d7d48291c789d68cd88f7fc5e7c7db674f0ce3" class="commit-link"><tt>59d7d48</tt></a>, branch 2.1, I hit a weird inconsistency in handling the replies to async http_post (using rest_client).</p>

<p>Having this code snippet(cgr_auth is a json variable but not sure that matters much in terms of processing reply, just showing it here to figure out where the log comes from):<br>
<code><br>
route[CGR_AUTH] {<br>
...<br>
xlog("$json(cgr_auth)"); <br>
async(rest_post("http://127.0.0.1:2080/jsonrpc", "$json(cgr_auth)", "application/json", "$json(cgr_auth_reply)", "$var(ct)", "$var(rcode)"), CGR_AUTH_REPLY);<br>
}<br>
route[CGR_AUTH_REPLY] {<br>
    xlog("In CGR_AUTH_REPLY, reply received: $json(cgr_auth_reply)");<br>
...<br>
}<br>
</code><br>
I am capturing syslog and ngrep in the same screen and getting the following output (which shows that first reply is missed, second is luckily processed, but not a pattern since sometimes I miss 6 replies in a row - please see timestamps):</p>

<p>`<br>
root@OsipsDev1:~/cgrates# May  2 22:21:32 OsipsDev1 /usr/sbin/opensips[27197]: { "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }<br>
####<br>
T 2015/05/02 22:21:32.881899 127.0.0.1:38528 -&gt; 127.0.0.1:2080 [AP]<br>
POST /jsonrpc HTTP/1.1.<br>
Host: 127.0.0.1:2080.<br>
Accept: <em>/</em>.<br>
Content-Type: application/json.<br>
Content-Length: 112.<br>
.<br>
{ "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }<br>
##<br>
T 2015/05/02 22:21:32.882474 127.0.0.1:2080 -&gt; 127.0.0.1:38528 [AP]<br>
HTTP/1.1 200 OK.<br>
Content-Type: application/json.<br>
Date: Sat, 02 May 2015 20:21:32 GMT.<br>
Content-Length: 36.<br>
.<br>
{"id":"1","result":-1,"error":null}</p>

<p>#May  2 22:21:54 OsipsDev1 /usr/sbin/opensips[27197]: ERROR:rest_client:start_async_http_req: timeout while connecting to '<a href="http://127.0.0.1:2080/jsonrpc">http://127.0.0.1:2080/jsonrpc</a>' (20 sec)<br>
May  2 22:21:54 OsipsDev1 /usr/sbin/opensips[27197]: In CGR_AUTH_REPLY, reply received: <br>
#<br>
T 2015/05/02 22:22:05.261449 127.0.0.1:38528 -&gt; 127.0.0.1:2080 [AP]<br>
POST /jsonrpc HTTP/1.1.<br>
Host: 127.0.0.1:2080.<br>
Accept: <em>/</em>.<br>
Content-Type: application/json.<br>
Content-Length: 112.<br>
.<br>
{ "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }<br>
May  2 22:22:05 OsipsDev1 /usr/sbin/opensips[27197]: { "id": "1", "method": "ApierV1.GetMaxSessionTime", "params": [ { "Account": "1002", "Destination": "1002" } ] }<br>
#<br>
T 2015/05/02 22:22:05.262231 127.0.0.1:2080 -&gt; 127.0.0.1:38528 [AP]<br>
HTTP/1.1 200 OK.<br>
Content-Type: application/json.<br>
Date: Sat, 02 May 2015 20:22:05 GMT.<br>
Content-Length: 36.<br>
.<br>
{"id":"1","result":-1,"error":null}</p>

<p>#May  2 22:22:05 OsipsDev1 /usr/sbin/opensips[27197]: In CGR_AUTH_REPLY, reply received: {"id":"1","result":-1,"error":null}<br>
`</p>

<p>Thanks in advance for any kind of tip.</p>

<p>DanB</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/493">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciXBDdzLELGNYtYERMxr77GvGP3VQks5oFSovgaJpZM4EOTy5.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/493"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>