home-dashboard/public/index.html
2024-12-21 16:20:28 -05:00

68 lines
2.4 KiB
HTML

<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Dashboard</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<script src="elm.js"></script>
<script src="sip.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">
You are using an <strong>outdated</strong> browser. Please
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
your experience.
</p>
<![endif]-->
<audio id="remoteAudio"></audio>
<script type="text/javascript">
var app = Elm.App.init({flags: "https://pbx-provisioning.sailmaker.fenix.lgbt/dashboard-kitchen.json"});
const simpleUserDelegate = {
onCallCreated: () => {
console.log('Call created');
},
onCallAnswered: () => {
console.log('Call answered');
},
onCallHangup: () => {
console.log('Call hung up');
},
onCallHold: (held) => {
console.log('Call hold: ${held}')
}
}
var simpleUser;
app.ports.connectPhone.subscribe(function(config) {
console.log('Connect', config);
const simpleUserOptions = {
delegate: simpleUserDelegate,
media: {
remote: {
audio: document.getElementById('remoteAudio')
}
},
aor: `sip:${config.username}@${config.domain}`,
userAgentOptions: {
displayName: config.name,
authorizationUsername: config.username,
authorizationPassword: config.password
}
};
console.log('Options', simpleUserOptions);
simpleUser = new SIP.Web.SimpleUser(
"wss://pbx.sailmaker.fenix.lgbt/ws",
simpleUserOptions
);
simpleUser.connect();
});
</script>
</body>
</html>