/
phone-remote.htm
434 lines (406 loc) · 14.2 KB
/
phone-remote.htm
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<html>
<head>
<title>snom javascript screen</title>
<style type="text/css">
* { padding: 0; margin: 0; }
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
#wrapper {
margin: 0 auto;
width: 1900px;
}
#header {
/* empty header (commented out for now)*/
color: #333;
width: 1890px;
float: left;
padding: 10px;
border: 0px;
height: 30px;
margin: 10px 0px 5px 0px;
/*background: #015C87;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
*/
}
#leftcolumn {
/* Input column on the left */
height: 530px;
float: left;
}
#leftcolumn form {
color: #39a9dc;
border: 1px solid #ccc;
background: #fff;
margin: 0px 5px 5px 0px;
font-weight: bold;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
padding: 10px;
width: 235px;
float: left;
}
#title {
color: #555;
/*
border: 0px solid #ccc;
background: #ccc;
*/
margin: 0px 5px 5px 0px;
}
#leftcolumn h2 {
color: #39a9dc;
margin: 10px;
}
#leftcolumn input {
width: 95px;
border: 1px solid #39a9dc;
padding: 3px;
}
#leftcolumn .button {
border: 1px solid #ccc;
margin: 3px;
padding: 3px;
background: #ccc;
}
#centercolumn {
/* phone screen */
float: left;
color: #39a9dc;
border: 0px solid #ccc;
background: #ccc;
margin: 0px 0px 0px 0px;
padding: 10px;
height: 760px;
width: 1300px;
display: inline;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
}
#rightcolumn {
/* label screen */
float: left;
color: #39a9dc;
border: 0px solid #ccc;
background: #ccc;
margin: 0px 0px 0px 10px;
padding: 10px;
height: 340px;
width: 150px;
display: inline;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
}
#largecolumn {
/* expansion screen */
float: left;
color: #39a9dc;
border: 0px solid #ccc;
background: #ccc;
margin: 10px 0px 0px 260px;
padding: 10px;
height: 450px;
width: 640px;
display: inherit;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
}
#keypaddelme {
/*float: right;*/
color: #007abf;
border: 0px solid #ccc;
background: #fdc00d;
margin: 0px 0px 5px 0px;
padding: 10px;
height: 200px;
width: 638px;
display: inline;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
}
#footer {
width: 900px;
clear: both;
color: #333;
border: 0px solid #ccc;
background: #;
margin: 0px 0px 10px 0px;
padding: 10px;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
}
input { margin: 5px;}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script>
//TODO: Fix auth issue (XDR issue)
/*
function make_base_auth(username, password) {
return "Basic " + btoa(username + ":" + password);
}
function sendHttpReq(url, username, password) {
if(username == ''){
$.get(url);
} else {
var auth = make_base_auth(username, password);
//jquery ajax request
$.ajax({
url : url,
method : 'GET',
beforeSend : function(req) {
req.setRequestHeader('Authorization', auth);
}
});
}
}
*/
function sendHttpReq(url){
$.get(url);
}
var screenUrl;
function startVideo(form, image) {
switch(image){
case 'screen':
var imageFile = '/screen.bmp';
var screenBufferId = '#screen-buffer';
var screenDisplayedId = '#screen-displayed';
break;
case 'label':
var imageFile = '/label_screen.bmp';
var screenBufferId = '#label-buffer';
var screenDisplayedId = '#label-displayed';
break;
case 'exp':
var imageFile = '/exp_screen.bmp';
var screenBufferId = '#exp-buffer';
var screenDisplayedId = '#exp-displayed';
break;
}
//TODO: Fix auth issue (XDR issue)
/*
if(typeof form.user.value != ''){
var screenUrl = form.proto.value + '://' + form.user.value + ':' + form.password.value + '@' + form.phone.value + ':' + form.port.value + '/screen.bmp';
} else {
var screenUrl = form.proto.value + '://' + form.phone.value + ':' + form.port.value + '/screen.bmp';
} */
var screenUrl = form.proto.value + '://' + form.phone.value + ':' + form.port.value + imageFile;
$(screenBufferId).load(function(){
var loadedImage = $(this).attr('src');
$(screenDisplayedId).attr('src', loadedImage);
$(this).attr('src', screenUrl + '?nocache=' + Math.random());
});
$(screenBufferId).attr('src', screenUrl + '?nocache=' + Math.random());
}
function stopVideo(image){
switch(image){
case 'screen':
var screenBufferId = '#screen-buffer';
var screenDisplayedId = '#screen-displayed';
break;
case 'label':
var screenBufferId = '#label-buffer';
var screenDisplayedId = '#label-displayed';
break;
case 'exp':
var screenBufferId = '#exp-buffer';
var screenDisplayedId = '#exp-displayed';
break;
}
$(screenBufferId).unbind('load');
$(screenBufferId).attr('src', '');
$(screenDisplayedId).attr('src', '');
}
function pressKey(form){
var key = form.key.value;
var commandUrl = form.proto.value + '://' + form.phone.value + ':' + form.port.value + '/command.htm?key=' + key;
sendHttpReq(commandUrl);
}
function dialNumber(form){
var number = form.number.value;
var commandUrl = form.proto.value + '://' + form.phone.value + ':' + form.port.value + '/command.htm?number=' + number;
sendHttpReq(commandUrl);
}
function endCalls(form){
var command = 'RELEASE_ALL_CALLS';
var commandUrl = form.proto.value + '://' + form.phone.value + ':' + form.port.value + '/command.htm?' + command;
sendHttpReq(commandUrl);
}
function rebootPhone(form){
var commandUrl = form.proto.value + '://' + form.phone.value + ':' + form.port.value + '/advanced_update.htm?reboot=Reboot';
sendHttpReq(commandUrl);
}
function setSetting(form){
var setting_name = form.setting_name.value;
var setting_value = form.setting_value.value;
var commandUrl = form.proto.value + '://' + form.phone.value + ':' + form.port.value + '/dummy.htm?settings=save&' + setting_name + '=' + setting_value;
sendHttpReq(commandUrl);
}
</script>
</head>
<body>
<!-- Begin Wrapper -->
<div id="wrapper">
<!-- Begin Header -->
<!--div id="header"></div-->
<!-- End Header -->
<!-- Begin Left Column -->
<div id="leftcolumn">
<form name="form">
<h2>Phone:</h2>
<div><label>Phone IP: </label><input type="text" name="phone"/></div>
<!-- FIXME: browser security checks will not allow HTTPS-->
<input type="hidden" name="proto" value="http">
<!--
<div><label>HTTP: </label><input type="radio" name="proto" value="http" checked/></div>
<div><label>HTTPS: </label><input type="radio" name="proto" value="https"/></div>
-->
<div><label>TCP Port: </label><input type="text" name="port" value="80"/></div>
<!-- FIXME: browser sercurity checks will not allow -->
<!--
<div><label>Phone User: </label><input type="text" name="user"/></div>
<div><label>Phone Password: </label><input type="password" name="password"/></div>
-->
<hr/>
<div>
<label>View phone display</label>
</div>
<div>
<input class="button" type="button" name="button" value="Start Video" onclick="startVideo(this.form, "screen");"/>
<input class="button" type="button" name="button" value="Stop Video" onclick="stopVideo('screen');"/>
</div>
<div>
<label>View phone labels</label>
</div>
<div>
<input class="button" type="button" name="button" value="Start Video" onclick="startVideo(this.form, "label");"/>
<input class="button" type="button" name="button" value="Stop Video" onclick="stopVideo('label');"/>
</div>
<div>
<label>View Exp. screen</label>
</div>
<div>
<input class="button" type="button" name="button" value="Start Video" onclick="startVideo(this.form, "exp");"/>
<input class="button" type="button" name="button" value="Stop Video" onclick="stopVideo('exp');"/>
</div>
<hr/>
<div>
<label>Dial a number</label>
</div>
<div>
<input type="text" name="number"/>
<input class="button" type="button" name="button" value="Dial" onClick="dialNumber(this.form);" />
</div>
<hr/>
<div>
<label>End all the calls</label>
<input class="button" type="button" name="button" value="End Calls" onClick="endCalls(this.form);" />
</div>
<hr/>
<div>
<label>Configure a setting</label>
</div>
<div>
<label>Setting name: </label><input type="text" name="setting_name"/>
</div>
<div>
<label>Setting value: </label><input type="text" name="setting_value"/>
</div>
<div>
<label>Apply </label><input class="button" type="button" name="button" value="Setting" onClick="setSetting(this.form);" />
</div>
<hr/>
<div>
<label>Press a key</label>
</div>
<div>
<label>Select the key: </label>
<select name="key" onChange="pressKey(this.form)">
<option value=""></option>
<option value="OFFHOOK">OFFHOOK</option>
<option value="ONHOOK">ONHOOK</option>
<option value="ENTER">ENTER</option>
<option value="CANCEL">CANCEL</option>
<option value="RIGHT">RIGHT</option>
<option value="LEFT">LEFT</option>
<option value="UP">UP</option>
<option value="DOWN">DOWN</option>
<option value="VOLUME_UP">VOLUME_UP</option>
<option value="VOLUME_DOWN">VOLUME_DOWN</option>
<option value="MENU">MENU</option>
<option value="REDIAL">REDIAL</option>
<option value="F_ADR_BOOK">ADDRESSBOOK</option>
<option value="DND">DND</option>
<option value="F1">F1</option>
<option value="F2">F2</option>
<option value="F3">F3</option>
<option value="F4">F4</option>
<option value="P1">P1</option>
<option value="P2">P2</option>
<option value="P3">P3</option>
<option value="P4">P4</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="*">*</option>
<option value="#">#</option>
</select>
</div>
<hr/>
<div>
<label>Reboot the phone</label>
<input class="button" type="button" name="button" value="Reboot" onClick="rebootPhone(this.form);" />
</div>
</form>
</div>
<!-- End Left Column -->
<div id="title">
<b>Snom phone remote control</b><br/>
<b>NOTE:</b> This script doesn't support any security feature, sould be intended only as a feature showcase.<br/>
<hr/>
This script doesn't support HTTP authentication, to make it working please disable WUI authentication and hidden tags on the phone.
HTTPS isn't supported on this application.
</div>
<!-- Begin Center Column -->
<div id="centercolumn">
<center>
<h1>Phone screen</h1>
<img id="screen-displayed"/>
<img id="screen-buffer" style="visibility: hidden;"/>
</center>
</div>
<!-- End Center Column -->
<div id="rightcolumn">
<center>
<h1>Labels screen</h1>
<img id="label-displayed"/>
<img id="label-buffer" style="visibility: hidden;"/>
</center>
</div>
<!-- Begin Center Column -->
<div id="largecolumn">
<center>
<h1>Exp screen</h1>
<img id="exp-displayed"/>
<img id="exp-buffer" style="visibility: hidden;"/>
</center>
</div>
</div>
<!-- End Wrapper -->
</body>
</html>