-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwait4answer.html
69 lines (60 loc) · 1.98 KB
/
wait4answer.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="/js/astman-jah.js"></script>
<link href="../css/astman.css" media="all" rel="Stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script>
var logins = new Object;
var logoffs = new Object;
var channels = new Object;
var pongs = new Object;
var loggedon = -1;
var demo = new Object;
demo.logins = function(msgs) {
response = msgs[0].headers['response'];
alert('login result: ' + response);
$('#statusbar').text( msgs[0].headers['message'] );
if (response !='Error') {
astmanEngine.pollEvents();
}
}
function doLogin(username,secret) {
$('#statusbar').html("<i>Logging in...</i>");
astmanEngine.sendRequest('action=login&username=' + username + "&secret=" + secret, demo.logins);
}
demo.eventCB = function(msgs) {
var test = '';
for (x=0;x<msgs.length;x++) {
eventname = msgs[x].headers['event'];
if (eventname == 'Link' ) {
channel1 = msgs[x].headers['channel1'];
channel2 = msgs[x].headers['channel2'];
alert(channel2 + " linked with " + channel1 );
}
if (eventname == 'Hangup') {
channel = msgs[x].headers['channel'];
$('konferenceState').html(channel + " Положил трубку ");
}
for (y=0;y<msgs[x].names.length;y++) {
test = test + "msg "+ (x + 1) + "/" + msgs[x].names[y] + "/" + msgs[x].headers[msgs[x].names[y]] + "<br>";
}
}
$('#eventlist').html(test);
$('#statusbar').html("<i>Got " + msgs.length + "events. </i>");
astmanEngine.pollEvents();
}
function localajaminit() {
astmanEngine.setURL('/asterisk/rawman');
astmanEngine.setEventCallback(demo.eventCB);
doLogin('webuser','zee7ae0Ma2ria4sh');
}
</script>
<title>PearlPBX AJAM Demo</title>
<body onload="localajaminit()">
<div id='eventlist'>
</div>
<div id="statusbar">
<span style="margin-left: 4px;font-weight:bold"> </span>
</div>
<div id='konferenceState'>
</div>
</body>