Установлена сборка FreePBX-64bit-10.13.66 на virtualbox.
Создал 2 экстешена 520 и 530 номера
В разделе Admin-User Management включил WebRTC phone для каждого пользователя.
По адресу 192.168.0.210/ucp отлично звонит второму пользователю, на софтофон X-Lite.
Проблема состоит в том, что мне нужно реализовать веб-звонилку, только на библиотеке SIP.js (поднят веб-сервер по адресу 192.168.0.156).
Предоставляю код js:
Код: Выделить всё
( function()
{
var session;
var endButton = document.getElementById('endCall');
endButton.addEventListener("click", function ()
{
session.bye();
alert ("Call Terminated");
}
, false
);
//Registration and websocket connectivity details for the useragent
var config = {
// Asterisk IP address
uri: '520@192.168.0.210',
// Asterisk IP address,
// and replace the port with your Asterisk port from the http.conf file
wsServers: 'ws://192.168.0.210:8088/ws',
// Replace this with the username from your sip.conf file
authorizationUser: '520',
// Replace this with the password from your sip.conf file
password: '1234',
// Enable sip traces on js console
traceSip: true,
stunServers: 'null',
};
//Creates the anonymous user agent so that you can make calls
var userAgent = new SIP.UA ();
//Here you determine whether the call has video and audio
var options = {
media: {
constraints: {
audio: true,
video: false,
},
render: {
remote: {
audio: document.getElementById('remoteAudio')
},
local: {
audio: document.getElementById('localAudio')
}
}
}
};
function onAccepted ()
{
alert("Call Connected");
}
function onDisconnected ()
{
alert("Call Terminated");
}
//makes the call
session = userAgent.invite('530@192.168.0.210', options);
session.on('accepted', onAccepted);
//session.on('disconnected', onDisconnected);
}
)();
Код: Выделить всё
<!DOCTYPE html>
<script src="http://sipjs.com/download/sip-0.7.0.min.js"></script>
<script src=/index.js></script>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<audio id="remoteAudio"></audio>
<audio id="localAudio" muted="muted"></audio>
<button id="endCall">End Call</button>
</body>
</html>
Звонок не идет.
Куда копать?
