[OpenSIPS-Users] FW: Asynchronous operation for REST queries

Ramachandran, Agalya (Contractor) Agalya_Ramachandran at comcast.com
Fri Aug 26 20:29:03 CEST 2016


Hi Liviu,

Here is the dump from the time when the socket is opened and when the request sent out.
Highlighted in RED color. Any clue for this 10 sec delay?

17:29:56.430379 IP6 sturn-test.novalocal.44797 > destination.rtc.sys.comcast.net.webcache: Flags [S], seq 3356294440, win 28800, options [mss 1440,sackOK,TS val 3588300781 ecr 0,nop,wscale 7], length 0
        0x0000:  6000 0000 0028 0640 2001 0558 fc0b 0100  `....(. at ...X<mailto:. at ...X>....
        0x0010:  f816 3eff fed5 0bfe 2001 0558 fc11 0000  ..>........X....
        0x0020:  f816 3eff fe11 d5aa aefd 1f90 c80c fd28  ..>............(
        0x0030:  0000 0000 a002 7080 90bb 0000 0204 05a0  ......p.........
        0x0040:  0402 080a d5e1 1fed 0000 0000 0103 0307  ................
17:29:56.436526 IP6 destination.rtc.sys.comcast.net.webcache > sturn-test.novalocal.44797: Flags [S.], seq 4065018495, ack 3356294441, win 28560, options [mss 1440,sackOK,TS val 1771678349 ecr 3588300781,nop,wscale 9], length 0
        0x0000:  6000 0000 0028 063a 2001 0558 fc11 0000  `....(.:...X....
        0x0010:  f816 3eff fe11 d5aa 2001 0558 fc0b 0100  ..>........X....
        0x0020:  f816 3eff fed5 0bfe 1f90 aefd f24b 427f  ..>..........KB.
        0x0030:  c80c fd29 a012 6f90 755f 0000 0204 05a0  ...)..o.u_......
        0x0040:  0402 080a 6999 aa8d d5e1 1fed 0103 0309  ....i...........
17:29:56.436575 IP6 sturn-test.novalocal.44797 > destination.rtc.sys.comcast.net.webcache: Flags [.], ack 1, win 225, options [nop,nop,TS val 3588300787 ecr 1771678349], length 0
        0x0000:  6000 0000 0020 0640 2001 0558 fc0b 0100  `...... at ...X....
        0x0010:  f816 3eff fed5 0bfe 2001 0558 fc11 0000  ..>........X....
        0x0020:  f816 3eff fe11 d5aa aefd 1f90 c80c fd29  ..>............)
        0x0030:  f24b 4280 8010 00e1 90b3 0000 0101 080a  .KB.............
        0x0040:  d5e1 1ff3 6999 aa8d                      ....i...

17:30:06.667279 IP6 sturn-test.novalocal.44797 > destination.rtc.sys.comcast.net.webcache: Flags [P.], seq 1:681, ack 1, win 225, options [nop,nop,TS val 3588311018 ecr 1771678349], length 680
PUT./RTCGSessionManager/rest/tel/session/createroom?uid=pp&custguid=1-32750 at XX.YYY.231.239..HTTP/1.1..Host:.tr-sm-as-a-001.rtc.sys.comcast.net:8080..Accept:.*/*..Conten<mailto:PUT./RTCGSessionManager/rest/tel/session/createroom?uid=pp&custguid=1-32750 at XX.YYY.231.239..HTTP/1.1..Host:.tr-sm-as-a-001.rtc.sys.comcast.net:8080..Accept:.*/*..Conten> t-Type:.application/json..Uid:.pp..serviceId:.tel..custguid:.1-32750 at 96.119.231. 239...x-tracking-id:.820..X-Trace:.trace-id=1-32750 at 96.119.231.239...x-server-name:.RTCGSM..x-client-name:.IMS
x-source-id:.OpenSIP..user-agent:.OpenSIPv1.11.3..device-id:.1-32750 at XX.YYY.231. 239...Content-Length:.211....{"participantsInfo" :["2155551212"],"callType":"audio","instanceId": "1-32750 at XX.YYY. 231.239.<mailto:1-32750 at XX.YYY.%20231.239.>","fromUID":"pp","fromTN":"pp","isOpenSipRequest":true," displayName":"Call.From.IMS","deviceType":"Android/iOS/STB/IMS"}

17:30:06.672819 IP6 destination.rtc.sys.comcast.net.webcache > sturn-test.novalocal.44797: Flags [.], ack 681, win 59, options [nop,nop,TS val 1771688585 ecr 3588311018], length 0
        0x0000:  6000 0000 0020 063a 2001 0558 fc11 0000  `......:...X....
        0x0010:  f816 3eff fe11 d5aa 2001 0558 fc0b 0100  ..>........X....
        0x0020:  f816 3eff fed5 0bfe 1f90 aefd f24b 4280  ..>..........KB.
        0x0030:  c80c ffd1 8010 003b c0cd 0000 0101 080a  .......;........
        0x0040:  6999 d289 d5e1 47ea                      i.....G.
17:30:06.778978 IP6 destination.rtc.sys.comcast.net.webcache > sturn-test.novalocal.44797: Flags [P.], seq 1:358, ack 681, win 59, options [nop,nop,TS val 1771688691 ecr 3588311018], length 357
        0x0000:  6000 0000 0185 063a 2001 0558 fc11 0000  `......:...X....
        0x0010:  f816 3eff fe11 d5aa 2001 0558 fc0b 0100  ..>........X....
        0x0020:  f816 3eff fed5 0bfe 1f90 aefd f24b 4280  ..>..........KB.
        0x0030:  c80c ffd1 8018 003b 8583 0000 0101 080a  .......;........
        0x0040:  6999 d2f3 d5e1 47ea 4854 5450 2f31 2e31  i.....G.HTTP/1.1
        0x0050:  2032 3030 204f 4b0d 0a53 6572 7665 723a  .200.OK..Server:

...

Regards,
Agalya
From: Ramachandran, Agalya (Contractor)
Sent: Friday, August 26, 2016 12:01 PM
To: 'Liviu Chircu' <liviu at opensips.org>
Subject: RE: FW: [OpenSIPS-Users] Asynchronous operation for REST queries

Hi Liviu,

As I already emailed you, to contribute the source code there is some approval process in our organization.
If that goes though I can contribute the REST PUT code.

But I have a question in async operation in opensips.
When a async mode REST API is called either POST/PUT, I see that opensips waits for 10 sec of time and then only it sends out the HTTP request out to the network.
Why there is a huge wait time of 10sec?

When I tried to debug, I found it is looping inside the below for loop for long time in rest_methods.c  file, (but all that looping are taking same seconds, later 10 sec am getting HTTP response)
for (i = 0; i < busy_wait; i += check_time) {.....}

Wondering and interested to know about this delay time.
Please bear some of your time:). Thanks in advance.

Regards,
Agalya

From: Liviu Chircu [mailto:liviu at opensips.org]
Sent: Thursday, August 18, 2016 10:14 AM
To: Ramachandran, Agalya (Contractor) <Agalya_Ramachandran at comcast.com<mailto:Agalya_Ramachandran at comcast.com>>
Subject: Re: FW: [OpenSIPS-Users] Asynchronous operation for REST queries


Hi Agalya,

I am very busy these days and cannot afford to troubleshoot random problems with libcurl usage. Do you intend to open source the PUT function by making a Pull Request, after we fix it? If yes, it will definitely go up in my priority queue.

Liviu Chircu

OpenSIPS Developer

http://www.opensips-solutions.com
On 18.08.2016 16:13, Ramachandran, Agalya (Contractor) wrote:
Hi Liviu,

Please help me by giving some clue that what am missing on the below topic.
Your guidance here would be much helpful for me.

Regards,
Agalya

From: Ramachandran, Agalya (Contractor)
Sent: Tuesday, August 16, 2016 10:54 AM
To: users at lists.opensips.org<mailto:users at lists.opensips.org>
Subject: RE: [OpenSIPS-Users] Asynchronous operation for REST queries

Hi Bogdan/Liviu,

I have downloaded 2.1.4 version if opensips and trying to use rest_put call in async mode.

I have added the necessary code for rest_put () similar to rest_post() in rest_methods.c, rest_methods.h and rest_client.c
If I just call, rest_put from config file, without async it works fine. I could see rest_put() is called and do the necessary steps.

And am trying to call async from config file as,
 async(rest_put("http://***url*** <http://***url***%20> ", "$fU,$tU,$ci ", "application/json", "$var(body)", "$var(ct)", "$var(rcode)"),resume_put);

Further debugging I got some info that I can share with you so that you can help me out easily.
Instead of calling rest_put asynchronously I have tried to call rest_post async . I could able to see that HTTP request went out(from Wireshark traces) and I got 4xx response for the same.

With my code changes in place and when I call rest_put, am not seeing HTTP request sent out.
Assuming rest_put only is not working, there should be some libcurl stuffs not handled properly in 'start_async_http_req' for 'REST_CLIENT_PUT' case.

Am attaching the files that  contains code changes for rest_put only. I have removed other code in order to reduce the file size. Can you please take a look guide me here?.
Please let me know if you need more information on this.

Regards,
Agalya


From: users-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org> [mailto:users-bounces at lists.opensips.org] On Behalf Of Liviu Chircu
Sent: Friday, August 05, 2016 4:47 AM
To: users at lists.opensips.org<mailto:users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Asynchronous operation for REST queries

Hi Agalya,

1.11 has no async support at core level. If you need that, you will have to use 2.1+

Async rest_put() is currently not implemented, but its logic would be fairly similar to the GET and POST counterparts.

Liviu Chircu

OpenSIPS Developer

http://www.opensips-solutions.com
On 04.08.2016 23:14, Ramachandran, Agalya (Contractor) wrote:
Hi team,

We are using opensips1.11.3 version for our project.
I have a question here. Right now we are using a REST API call from config file for our project requirement and it is in synchronous mode currently.


More information about the Users mailing list