[OpenSIPS-Users] Asynchronous operation for REST queries

Ramachandran, Agalya (Contractor) Agalya_Ramachandran at comcast.com
Mon Aug 15 22:35:14 CEST 2016


Hi Bogdan/Liviu,

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 I have modified. Can you please take a look guide me here.

And regarding the below error, am not seeing it every time now. It's coming now and then. Sometimes in my debug I could able to see the async_start and async_resume has executed for rest_put as well.
But the HTTP request never went to the destination.
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] On Behalf Of Ramachandran, Agalya (Contractor)
Sent: Monday, August 15, 2016 9:32 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Asynchronous operation for REST queries

Hi Bogdan/Liviu,

Please help on this async() to get worked at config file.
Am using rest_put() and I have added the needed functions and declarations for the same as like rest_post().

Am getting the below error if I enable debug logs.
Seems, w_async_rest_put function is called and after that it didn't process the async(rest_put)).
Do we need to configure anything specific when async() is called in config file?

Aug 11 19:49:52 DBG:tm:_reply_light: finished
Aug 11 19:49:52 DBG:rest_client:w_async_rest_put: async rest put 'http://***URL***?' 0x7f3df7848538 0x7f3df78485d0 0x7f3df7848650
Aug 11 19:50:12 DBG:rest_client:start_async_http_req: done, no need for async!
Aug 11 19:50:12 DBG:rest_client:set_output_pv_params: Last response code: 0
Aug 11 19:50:12 DBG:core:fm_free: free(0) called
Aug 11 19:50:12 DBG:core:comp_scriptvar: int 26 : -4 / 0
Aug 11 19:50:12 Return code is -4
Aug 11 19:50:12 Error code 0 in HTTP PUT!

Regards,
Agalya


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

Hi 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);

But I never see rest_put() is called. Rather am getting below error continuously.
Aug  9 17:27:47 sturn-test /usr/local/sbin/opensips[18525]: WARNING:core:handle_timer_job: utimer job <tm-utimer> has a 403840000 us delay in execution
Aug  9 17:27:47 sturn-test /usr/local/sbin/opensips[18525]: WARNING:core:handle_timer_job: utimer job <tm-utimer> has a 403840000 us delay in execution
Aug  9 17:27:47 sturn-test /usr/local/sbin/opensips[18525]: WARNING:core:handle_timer_job: utimer job <tm-utimer> has a 403840000 us delay in execution
Aug  9 17:27:47 sturn-test /usr/local/sbin/opensips[18525]: WARNING:core:handle_timer_job: utimer job <tm-utimer> has a 403840000 us delay in execution

Am I missing something here? I am sure it is a small thing. Do we need to do anything else before calling async in the script?

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