-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
55 lines (44 loc) · 1.58 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kunzite Iframe Demo</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
background-color: black;
}
.btn-custom {
margin-top: 10px;
}
</style>
</head>
<body>
<iframe name="sf" id="sf" src="https://softphone.kunzite.app/" frameborder="0" width="320" height="460" allow="camera *;microphone *"></iframe>
<button id="click2call" type="button" class="btn btn-primary btn-custom">Click2Call</button>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
window.addEventListener('message', ({ data: details }) => {
console.log('softphone-event', JSON.stringify(details));
const { type, data } = details;
if (type === 'logged') {
const contacts = [
{ id: 'id1', name: 'John Doe', phones: ['+34666555444'] },
{ id: 'id2', name: 'Jennifer Doe', phones: ['+34666555444', '+34666777888'] },
];
window.frames.sf.postMessage({ type: 'contacts', data: { contacts } }, '*');
}
});
document.getElementById("click2call").addEventListener("click", () => {
window.frames.sf.postMessage({ type: 'click2call', data: { number: '+34911085460' } }, '*');
});
</script>
</body>
</html>