<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><tt>So you are doing th<tt>e $rc <tt>< 0 check in the
beginning of the resume<tt>_route? If yes, could you treat <tt><tt>ASYNC_SYNC<tt></tt><tt></tt></tt><tt>
</tt></tt>as a success (it actually is!)<tt>, and see if
<tt>your</tt> <tt>output variables <tt>are properly</tt><tt></tt>
populated with the transferred data?<br>
</tt></tt></tt></tt></tt></tt></p>
<pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 14.09.2016 18:58, Ramachandran,
Agalya (Contractor) wrote:<br>
</div>
<blockquote
cite="mid:cfe591c623ea44f78ba23a2d2698d3ac@COPDCEX28.cable.comcast.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle25
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle26
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle27
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle28
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle29
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle30
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle31
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle32
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle33
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle34
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle35
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle36
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:blue">Hi Liviu, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">I understand this
way. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">When we are
getting more calls in opensips, and the TCP port is been
open in that particular time window.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">At that time when
it tries to send HTTP request, start_async_http_req is
called, since is the port is already open, it is assuming
that async is completed.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Am I right?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="color:blue">most of the
call fails</span></b><span style="color:blue"> – meaning
that for first 15 to 20 calls call is successful from end to
end.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">After that for the
rest of the calls, it fails because
<b>ASYNC_SYNC</b> is returned and hits resume_route. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Here $rc is -4
(ASYNC_SYNC), which is $rc < 0, and am sending 403
Forbidden, due to which other calls are failing.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">In the resume
function, I have added some logic after getting the HTTP
response, what should be done for further handling INVITE
request.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">In these failure
calls, it never had a chance to hit the resume function and
hence other calls are failing.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue">Agalya<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
style="color:windowtext"> Liviu Chircu
[<a class="moz-txt-link-freetext" href="mailto:liviu@opensips.org">mailto:liviu@opensips.org</a>]
<br>
<b>Sent:</b> Wednesday, September 14, 2016 4:45 AM<br>
<b>To:</b> Ramachandran, Agalya (Contractor)
<a class="moz-txt-link-rfc2396E" href="mailto:Agalya_Ramachandran@comcast.com"><Agalya_Ramachandran@comcast.com></a>; OpenSIPS users
mailling list <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] FW: Asynchronous
operation for REST queries<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><tt><span style="font-size:10.0pt">If you notice that log,
then the transfer was completed together with the TCP
connect operation, an ideal situation! There is no need to
call the resume function anymore, since we already have
all the data. As soon as we return ASYNC_SYNC, the
resume_route will be called.</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">What do you mean by "most
of the call fails"? Are you missing any data?</span></tt><o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 13.09.2016 21:56, Ramachandran, Agalya
(Contractor) wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:blue">Hi Liviu, </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">One more
observance. Am trying to load test on the main branch
where you have provided your fix.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Am using REST
API as, async. After receiving the response for the HTTP
request, I will process the incoming SIP INVITE.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">If am sending 50
calls at 2 calls per sec from sipp, -in this case it works
perfectly fine.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">If am sending 50
calls at 5 calls per sec from sipp, most of the call
fails.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">If I look at
logs I could able to see that for failure case, it hits
start_async_http_req, but never resume function is called.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">It is printing </span><span
style="color:red">LM_DBG("done, no need for async!\n");
and returns ASYNC_SYNC;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Any idea why for
few calls, it is not acting as async? Particularly if I
increase cps, am seeing this behavior.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Please let me
know if am missing something.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Regards,<br>
Agalya</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
style="color:windowtext">
<a moz-do-not-send="true"
href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
[<a moz-do-not-send="true"
href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Ramachandran, Agalya (Contractor)<br>
<b>Sent:</b> Tuesday, September 13, 2016 2:14 PM<br>
<b>To:</b> Liviu Chircu <a moz-do-not-send="true"
href="mailto:liviu@opensips.org"><liviu@opensips.org></a>;
OpenSIPS users mailling list
<a moz-do-not-send="true"
href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] FW: Asynchronous
operation for REST queries</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Hi Liviu, </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I have
configured “Connection_timeout” value as ‘1’ and ran 2
sipp calls.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">After TCP port
is opened, HTTP request is sent out approx. 95 to 100ms
later. Am attaching the log of the opensips by enabling
debugging log.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I took the code
from master branch and tested it out. If you find
everything OK let me know.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Or if you feel
to test any specific scenario please update me, so that I
can test and share you the results.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">P.S:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">One more
observance.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">In the case of
synchronous, TCP port is opened within 8 ms, whereas in
the case of async TCP port is opening after 100 ms.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Is it the
expected behavior?. </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">What will be
expected time to give this fix in a branch version?
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Log file ~70 MB
if I enable the debug calls for single call and couldn’t
post you that log, since it says limit for email is 40 MB.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Regards,<br>
Agalya</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
style="color:windowtext"> Liviu Chircu [<a
moz-do-not-send="true"
href="mailto:liviu@opensips.org">mailto:liviu@opensips.org</a>]
<br>
<b>Sent:</b> Monday, September 12, 2016 4:06 AM<br>
<b>To:</b> OpenSIPS users mailling list <<a
moz-do-not-send="true"
href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>>;
Ramachandran, Agalya (Contractor) <<a
moz-do-not-send="true"
href="mailto:Agalya_Ramachandran@comcast.com">Agalya_Ramachandran@comcast.com</a>><br>
<b>Subject:</b> Re: FW:[OpenSIPS-Users] Asynchronous
operation for REST queries</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Hi Agalya,</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">The "connection_timeout"
is a configurable module parameter, so tuning it
properly might just solve your problem.</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">If you need more
assistance, please enable debug logging (log_level = 4),
run the query and post the full log output.</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Best regards,</span></tt><o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 09.09.2016 23:04, Ramachandran,
Agalya (Contractor) wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:blue">Hi Liviu, </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I have tested
the patch. Now I see the delay is 2 secs. i.e after 2
secs it sends the HTTP request out.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">I suspect this
2000 ms delay is due to the below field:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:red">long
connection_timeout = 20; </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Can we reduce
this field to 5 or 10, so that it waits only half a
second or second to send the request out.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Let me know
your thoughts on this. </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Am seeing the
below message in logs. Is everything working as you
expected?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:red">rest_client:start_async_http_req:
libcurl TCP connect: we should wait up to 1ms
(timeout=20000ms)!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:blue">Agalya</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
style="color:windowtext"> Liviu Chircu [<a
moz-do-not-send="true"
href="mailto:liviu@opensips.org">mailto:liviu@opensips.org</a>]
<br>
<b>Sent:</b> Thursday, September 08, 2016 7:05 AM<br>
<b>To:</b> Ramachandran, Agalya (Contractor) <a
moz-do-not-send="true"
href="mailto:Agalya_Ramachandran@comcast.com">
<Agalya_Ramachandran@comcast.com></a>;
Bogdan-Andrei Iancu <a moz-do-not-send="true"
href="mailto:bogdan@opensips.org">
<bogdan@opensips.org></a>; OpenSIPS users
mailling list <a moz-do-not-send="true"
href="mailto:users@lists.opensips.org">
<users@lists.opensips.org></a><br>
<b>Subject:</b> Re: FW:[OpenSIPS-Users] Asynchronous
operation for REST queries</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Hi, Agalya!</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Regarding the 10s
delay problem, a fix was pushed to the development
branch [1]. If you are running on 2.1.4 git branch,
could you please pull the latest changes (git pull
--rebase), and test it out? You can import it with:</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">git cherry-pick -x
66c337cc</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">[1]: <a
moz-do-not-send="true"
href="https://github.com/OpenSIPS/opensips/commit/66c337cc89a2b5c3e1bbd78c289371efcda21886">https://github.com/OpenSIPS/opensips/commit/66c337cc89a2b5c3e1bbd78c289371efcda21886</a></span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Best regards,</span></tt><o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
</blockquote>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif"><o:p> </o:p></span></p>
</div>
</blockquote>
<br>
</body>
</html>