Yate server > Other Yate server issues

Javascript http request

(1/2) > >>

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?


Monica Tepelus:

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.

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.


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.


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!


[0] Message Index

[#] Next page

Go to full version