Yate Community Forum

Yate server => Other Yate server issues => Topic started by: rukavinamilan on March 16, 2018, 01:35:43 PM

Title: Javascript http request
Post by: rukavinamilan on March 16, 2018, 01:35:43 PM
I was reading docs but I cannot find a way to make http request from javascript (fetch api)? Or at least call from javascript shell (curl) to do so?

Thanks
Title: Re: Javascript http request
Post by: Monica Tepelus on March 20, 2018, 06:34:36 AM
Hi,

You can't do the actual call from javascript because javascript is embedded in Yate, and yate doesn't have http support. What you can do is have an external php script, with a handler for a custom message. Ex: http.request. Send the message from javascript and let the php scrit do the call.
Title: Re: Javascript http request
Post by: rukavinamilan on March 29, 2018, 11:22:32 AM
Thanks Monica!
I'm aware of that option, but that's seems suboptimal, since javascript seems to work fast since it does not depend on external module...being able to make http request or shell exec would make it very flexible.

Thanks!
Title: Re: Javascript http request
Post by: asymetrixs on April 03, 2018, 01:25:48 PM
The javascript interpreter is custom build, so it lacks lots of functionality that e.g. V8 would offer, because it was specifically for use with yate.
Title: Re: Javascript http request
Post by: dorinelromeo on December 02, 2021, 08:43:11 AM
Hello,

I'm having the same issue, I want to make a GET request with A number to get B number from external API. I've tried implementing the HTTP client from here: https://docs.yate.ro/wiki/HTTP_Client but with no success.
Maybe I'm missing something here.

What should new Message("http.request",false,params); do? Do I need to create a php file to handle the GET request?

Thank you!
Title: Re: Javascript http request
Post by: Monica Tepelus on December 02, 2021, 08:55:43 AM
Hi,

httpclient module is only available in the private yate version.

Before implementing this we used below script and that is in a public repo.

http://yate.null.ro/websvn/filedetails.php?repname=yate-common&path=%2Ftrunk%2Fscripts%2Fhttp_req.sh

Monica
Title: Re: Javascript http request
Post by: Monica Tepelus on December 03, 2021, 03:26:53 AM
https://docs.yate.ro/wiki/How_To_For_External_Modules_In_Telnet
https://docs.yate.ro/wiki/Debugging_and,_or_Investigation_of_messages