星号-设置访问控制允许来源

时间:2020-06-10 06:42:49

标签: javascript api asterisk

我拥有以下基础设施:

Web服务器-云(当然是https)

本地网络-Issabel上的星号-呼叫中心

对于星号,我已经设置了ssl,因此没有“混合内容”错误,这就是我的http.conf在星号上的样子:

[root@issabel etc]# more http.conf
[general]
enabled=yes
enablestatic=yes      ; without this, you can only send AMI commands, not display 
                      ; html content

bindaddr=0.0.0.0          ; address you want the Asterisk HTTP server to respond on
bindport=8088             ; port you want the Asterisk HTTP server to respond on
prefix=asterisk           ; will form part of the URI, similar to a directory name
tlsenable = yes
tlsbindaddr = 0.0.0.0: 8089
tlscertfile = /etc/asterisk/ssl/ajam.pem
tlsprivatekey = /etc/asterisk/ssl/ajam.pem

我的目标:我想在我的云网站上为呼叫中心员工创建一个插件,以查看正在向他们打电话的“实时”人员,并查看此呼叫者所需的数据。

我的脚本,当我从本地网络上的浏览器调用它们时可以使用:

用于登录:

https://100.64.0.200:8089/asterisk/rawman?action=login&username=foo&secret=bar

进行状态检查并提取呼叫者信息:

https://100.64.0.200:8089/asterisk/mxml?action=status

它可以在本地网络上运行,但是当我尝试从云上的Web服务器调用它们时却无法使用,这是我的问题。

我在控制台上的javascript测试:

var  xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","https://100.64.0.200:8089/asterisk/mxml?action=status",true);
xmlhttp.send();

然后我遇到以下错误:

Access to XMLHttpRequest at 'https://100.64.0.200:8089/asterisk/mxml?action=status' from origin 'https://myserver-on-the-cloud.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

基于此错误消息,我看到我必须以某种方式允许本地网络中的星号服务器允许来自远程服务器“ https://myserver-on-the-cloud.com”的源 我的问题是,我不知道如何。我一整天都在阅读数百页的文档,但是一无所获。

任何帮助/提示都将不胜感激!

0 个答案:

没有答案