forked from Cynjut/SCCP_Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.sccp_devices.php
588 lines (503 loc) · 25.5 KB
/
page.sccp_devices.php
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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
<?php
//if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
/** SCCP MANAGER Module for FreePBX 2.5 or later.
* Copyright 2015 David Burgess, Cynjut Consulting Services, LLC
* Copyright 2012 Javier de la Fuente, GT-TOIP CSIC
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
$version = sccp_get_asterisk_version();
$sccpConf = sccp_get_confData('client');
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'setup';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$RestartPhone = isset($_REQUEST['RestartPhone']) ? $_REQUEST['RestartPhone'] : '';
if (isset($_REQUEST['del'])) {
$action = 'del';
}
$devdisplay = isset($_REQUEST['devdisplay']) ? $_REQUEST['devdisplay'] : '';
$mac = isset($_REQUEST['mac']) ? $_REQUEST['mac'] : '';
$devData = isset($_REQUEST['devData']) ? $_REQUEST['devData'] : '';
$buttonData = isset($_REQUEST['buttonData']) ? $_REQUEST['buttonData'] : '';
if (isset($_REQUEST['goto0']) && $_REQUEST['goto0']) {
$dest = $_REQUEST[ $_REQUEST['goto0'].'0' ];
}
if ($RestartPhone){
sccp_reset_phone($devdisplay);
}
global $astman;
switch ($action) {
case 'add':
if ( $_REQUEST['Submit'] ) {
sccp_add_device($devData, $buttonData);
//needreload();
redirect_standard();
}
break;
case 'edit':
sccp_edit_device($devData, $buttonData);
$astman->send_request("Command", array("Command" => "sccp restart ".$devdisplay));
//needreload();
redirect_standard('devdisplay');
break;
case 'del':
sccp_delete_device($devdisplay);
//needreload();
redirect_standard();
break;
}
?>
<div class="rnav"><ul>
<?php
echo '<li><a href="config.php?display=sccp_devices">'._('Add Phone').'</a></li>';
foreach (sccp_list_devices() as $row) {
$l_device = $row['device'];
$l_type = $row['type'];
$l_ext = $row['ext'];
echo "<li><a href='config.php?display=sccp_devices&devdisplay=$l_device&type=$l_type'> $l_device ($l_type) - $l_ext</a></li>";
}
echo '<li> </li>';
$row_temp = sccp_list_devices_wo_extension();
if ( count($row_temp) > 0 ) {
echo '<li>'._('Devices without extension associated').'</li>';
foreach (sccp_list_devices_wo_extension() as $row) {
$l_name = $row['name'];
$l_type = $row['type'];
$l_ext = $row['ext'];
echo "<li><a href='config.php?display=sccp_devices&devdisplay=$l_name&type=$l_type'> $l_name ($l_type)</a></li>";
}
}
?>
</ul></div>
<div class="content">
<?php
if ($devdisplay) {
$row = sccp_get_device($devdisplay);
$devData = sccp_get_device_full($devdisplay);
$type = isset($devData['type']) ? $devData['type'] : $type;
$rowButtons = get_buttons_devtype($type);
$Lines = $rowButtons['buttons'];
$noSidecar = $rowButtons['dns'];
if (strlen($devData['addon']) > 0) {
$rowButtons = get_buttons_devtype($devData['addon']);
$Lines += $rowButtons['buttons'];
}
$mac = $row['mac'];
echo "<h2> "._("Edit: ")."SEP$mac (".$devData['type'].")"."</h2>";
$delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=del';
$tlabel_del = sprintf(_("Delete Phone %s"),$devdisplay);
$label_del = '<span> <img width="16" height="16" border="0" title="'.$tlabel_del.'" alt="" src="images/user_delete.png"/> <a href="'.$delURL.'">'.$tlabel_del.'</a></span>';
echo $label_del;
} else {
echo "<h2> "._("Add Phone")."</h2>";
$Lines = 1;
}
?>
<form name="edit_sccp_devices" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return check_sccp_device(edit_sccp_devices);">
<input type="hidden" name="devdisplay" value="<?php echo $devdisplay; ?>">
<input type="hidden" name="action" value="<?php echo ($devdisplay ? 'edit' : 'add'); ?>" >
<table>
<tr><td colspan="5"><h5><?php echo ($devdisplay ? _("Edit Phone") : _("Add Phone")) ?><hr></h5></td></tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("MAC")?>:<span><?php echo _("The MAC address of the phone")?></span></a> .</td>
<td><input size="12" type="text" <?php if ($devData['name']) echo 'readonly="readonly"'?> name="devData[name]" id='mac_address' value="<?php echo substr($devData['name'], -12); ?>" maxlength="12" onchange="mayusculas()" ></td>
</tr>
<?php
$modelData = sccp_get_model_data();
$numModels = count($modelData['model']);
$addonData = sccp_get_addon_data();
$numAddons = count($addonData['model']);
?>
<tr>
<td></td>
<td><a href="#" class="info">Type: <span><?php echo _("The type of phone: 7911, 7940, 7960, etc. Important note: the 'G' models are handled as the base model (e.g., 7962G is handled as 7962). In the Display mode, this field is read-only because the MAC address and the model number are a pair.")?> </span></a></td>
<td>
<select name='devData[type]' id='type' onchange="this.form.submit()" >
<?php
echo "<option value=''></option>";
foreach ($modelData['model'] AS $model) {
if ($devData['type'] == $model) {
echo "<option value='$model' selected='selected'>$model </option>";
$valToHidden = $model;
} else {
echo "<option value='$model'>$model</option>";
}
}
?>
</select>
</td>
</tr>
<?php
if ($noSidecar < 2) {
echo "<tr><td></td>";
echo "<td><a href='#' class='info'>Addon:<span>Addons are model specific and only work with certain base phones. This phone model is identified as being a phone that does not accept sidecars. Update devmodel if this is not correct.</span></a></td>";
echo "<td><input type=text name=ignore value='N/A' readonly='readonly'></td></tr>";
echo "<!--";
}
?>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("Addon")?>:<span><?php echo _("Addons are model specific and only work with certain base phones. There are no checks for this here. Use the '79xx,79xx' syntax if you have two sidecars.")?></span></a></td>
<td>
<select name='devData[addon]' id='phone_addon' onchange="this.form.submit()" >
<?php
echo "<option value=''></option>";
for ($i=0; $i < $numAddons; $i++){
if ($devData['addon'] == $addonData['model'][$i]) {
echo "<option value='{$addonData['model'][$i]}' selected='selected'>{$addonData['model'][$i]} </option>";
} else {
echo "<option value='{$addonData['model'][$i]}'>{$addonData['model'][$i]} </option>";
}
}
?>
</select>
</td>
</tr>
<?php
if ($noSidecar < 2) {
echo "-->";
}
?>
<tr>
<td></td>
<td><a href="#" class="info">Description:<span><?php echo _("Phone description. This text is shown in the upper right corner, close to date")?></span></a> </td>
<td>
<input type='text' size='20' maxlength='20' name='devData[description]' value="<?php echo $devData['description']?>" ></td>
</tr>
<tr><td colspan="5"><h5><?php echo "<br>"; echo (_("Associated Extension & Speeddials")); ?><hr></h5></td></tr>
<tr>
<td></td>
<td></td>
<td></td>
<td><font color='grey' size=-1><a href="#" class="info"><?php echo _("Prompt")?>:<span><?php echo _("This is the prompt your phone button will show. For 'empty', it should be blank. For 'line', it will be the line number. For everything else, it is a description of the button. Some phones have limited space for prompts, so be brief. <bR>A special note about shared lines - you can use the same line number on as many phones as you'd like without any special syntax since version 3.0 of the SCCP-Chan-B driver. If you are using a shared line, you can specify 'silent' in the options field and that phone will not ring on that line.")?></span></a></font></td>
<td><font color='grey' size=-1><a href="#" class="info"><?php echo _("Options")?>:<span><?php echo _("Options for your line type. For 'empty', it will be blank. For 'line', it will usually be blank or 'silent'. For 'speeddial', it will be the string to dial and an optional comma separated 'hint' for monitoring that number. For 'service', it will be a Cisco XML compatible service URL. Note that not all services make sense on your phone. For 'feature', it will be one of the feature sets implemented. Note that you can specify one of the 'not implemented yet' features and the phone will simply not use that feature, since it isn't implemented yet.")?></span></a></font></td>
</tr>
<?php
for ($Instance = 0; $Instance < $Lines; $Instance++){
$tybuData = get_properties_in_button($devdisplay,($Instance+1));
?>
<tr>
<td></td>
<td>
<?php
if ($Instance == 0) {
echo "<a href='#' class='info'>";
}
echo "Button ". ($Instance+1) . ":";
if ($Instance == 0) {
echo "<span>\"Assigned Values to the Button\"</span></a>";
}
?>
</td>
<td>
<select name="<?php print "buttonData[type{$Instance}]" ?>">
<option value="empty" <?php if ($tybuData['type']=="empty") echo "selected='selected'" ?> >Empty</option>
<option value="line" <?php if ($tybuData['type']=="line") echo "selected='selected'" ?> >Line</option>
<option value="service" <?php if ( ($tybuData['type']=="service") ) echo "selected='selected'" ?> >Service</option>
<option value="feature" <?php if ( ($tybuData['type']=="feature") ) echo "selected='selected'" ?> >Feature</option>
<option value="speeddial" <?php if ($tybuData['type']=="speeddial") echo "selected='selected'" ?> >SpeedDial</option>
</select>
</td>
<td><input size="20" type="text" name="<?php print "buttonData[name{$Instance}]" ?>" value="<?php print $tybuData['name']; ?>" /></td>
<td>
<?php
if ($tybuData['type']=="feature") {
?>
<select name="<?php print "buttonData[options{$Instance}]" ?>">
<option value="privacy,callpresent" <?php if ($tybuData['options']=="privacy,callpresent") echo "selected='selected'" ?> >Call - Number Supporessed</option>
<option value="privacy,hint" <?php if ($tybuData['options']=="privacy,hint") echo "selected='selected'" ?> >Private Call - Hint Suppressed</option>
<option value="cfwdall,$number" <?php if ($tybuData['options']=="cfwdall,number") echo "selected='selected'" ?> disabled>Call Forward All</option>
<option value="cfwbusy,$number" <?php if ($tybuData['options']=="cfwbusy,number") echo "selected='selected'" ?> disabled>Call Forward On Busy</option>
<option value="cfwnoaswer,$number" <?php if ($tybuData['options']=="cfwnoaswer,number") echo "selected='selected'" ?> disabled>Call Forward On No Answer</option>
<option value="DND,busy" <?php if ($tybuData['options']=="DND,busy") echo "selected='selected'" ?> >No Not Disturb - Busy Status</option>
<option value="DND,silent" <?php if ($tybuData['options']=="DND,silent") echo "selected='selected'" ?> >No Not Disturb - No Status</option>
<?php
if (substr($version,1,3) == '1.6') {
echo "<option value='monitor' ";
if ($tybuData['options']=="monitor") {
echo "selected='selected'";
}
echo "Record Calls using AutoMon (Ast 1.6 only)</option>";
}
?>
<option value="devstate,custom_devstate" <?php if ($tybuData['options']=="devstate,custom_devstate") echo "selected='selected'" ?> >Device State Feature</option>
<option value="hold" <?php if ($tybuData['options']=="hold") echo "selected='selected'" ?> disabled >hold</option>
<option value="transfer" <?php if ($tybuData['options']=="transfer") echo "selected='selected'" ?> disabled>transfer</option>
<option value="multiblink" <?php if ($tybuData['options']=="multiblink") echo "selected='selected'" ?> disabled>multiblink</option>
<option value="mobility" <?php if ($tybuData['options']=="mobility") echo "selected='selected'" ?> disabled>mobility</option>
<option value="parkedcalls" <?php if ($tybuData['options']=="parkedcalls") echo "selected='selected'" ?> disabled>parkedcalls</option>
<option value="conference" <?php if ($tybuData['options']=="conference") echo "selected='selected'" ?> disabled>conference</option>
</select>
<?php
} else if ($tybuData['type'] == "line") {
if ($tybuData['options'] == 'Default') {
$checked = 'checked';
} else {
$checked = '';
}
echo "<input type='radio' name='buttonData[default_line]' value='{$tybuData['name']}' $checked> Default";
} else {
echo "<input size='60' type='text' name='buttonData[options". $Instance . "]' value='" . $tybuData['options']. "'/> ";
}
?>
</td>
</tr>
<?php
}
?>
<tr>
<td></td>
<td><a href="#" class="info">Softkeyset:<span>Select the softkeyset from the list. You can manage your keysets from the SCCP keysets option. The default is 'softkeyset'.</span></a></td>
<td>
<select name='devData[softkeyset]' id='softkeyset' >
<?php
$keyset = sccp_list_keysets();
echo "<option value='default'> default</option>";
foreach ($keyset AS $check) {
if ($devData['softkeyset'] == $check) {
echo "<option value='$check' selected='selected'> $check</option>";
} else {
echo "<option value='$check'> $check</option>";
}
}
?>
</td>
</tr>
<tr><td colspan="5"><h5><br>Device Properties<hr></h5></td></tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("Codec Disallow")?>:<span><?php echo _("Certain codecs are not allowed on these phones. The list of allowed ones is so short, 'all' makes sense.")?></span></a></td>
<td><input size="6" type="text" name="devData[disallow]" id="devData[disallow]" value="<?php echo $devData['disallow']?>" /></td>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("Codec Allow")?>:<span><?php echo _("Certain codecs are allowed on these phones. The list of allowed ones is so short, 'ulaw' and 'alaw' are about it.")?></span></a></td>
<td><input size="6" type="text" name="devData[allow]" id="devData[allow]" value="<?php echo $devData['allow']?>" /></td>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("Transfer")?>:<span><?php echo _("Transfer allowed")?></span></a></td>
<td>
<select name="devData[transfer]" id="devData[transfer]">
<option value="on" <?php if ($devData['transfer']=="on") echo "selected='selected'" ?> >On</option>
<option value="off" <?php if ($devData['transfer']=="off") echo "selected='selected'" ?> >Off</option>
</select>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("cfwdall")?>:<span><?php echo _("Activate the callforward softkeys. Default is On")?></span></a></td>
<td>
<select name="devData[cfwdall]" id="devData[cfwdall]">
<option value="on" <?php if ($devData['cfwdall']=="on") echo "selected='selected'" ?> >On</option>
<option value="off" <?php if ($devData['cfwdall']=="off") echo "selected='selected'" ?> >Off</option>
</select>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("cfwdbusy")?>:<span><?php echo _("Activate the callforward busy softkeys. Default is On")?></span></a></td>
<td>
<select name="devData[cfwdbusy]" id="devData[cfwdbusy]">
<option value="on" <?php if ($devData['cfwdbusy']=="on") echo "selected='selected'" ?> >On</option>
<option value="off" <?php if ($devData['cfwdbusy']=="off") echo "selected='selected'" ?> >Off</option>
</select>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("DTMFmode")?>:<span><?php echo _("Dual-Tone Multi-Frequency: outofband is the native cisco dtmf tone play")?></span></a></td>
<td>
<select name="devData[dtmfmode]" id="devData[dtmfmode]">
<option value="outofband" <?php if ($devData['dtmfmode']=="outofband") echo "selected='selected'" ?> >outofband</option>
<option value="inband" <?php if ($devData['dtmfmode']=="inband") echo "selected='selected'" ?> >inband</option>
</select>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("DND")?>:<span><?php echo _("Do Not Disturb. Default is Off")?></span></a></td>
<td>
<select name="devData[dndFeature]" id="devData[dndFeature]">
<option value="on" <?php if ($devData['dndFeature']=="user") echo "selected='selected'" ?> >User</option>
<option value="silent" <?php if ($devData['dndFeature']=="ilent") echo "selected='selected'" ?> >Silent</option>
<option value="reject" <?php if ($devData['dndFeature']=="reject") echo "selected='selected'" ?> >Reject</option>
<option value="off" <?php if ($devData['dndFeature']=="off") echo "selected='selected'" ?> >Off</option>
</select>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("mwilamp")?>:<span><?php echo _("Define the MWI Lamp stype - on. off. flash. blink, or wink. Default is On")?></span></a></td>
<td>
<select name="devData[mwilamp]" id="devData[mwilamp]">
<option value="on" <?php if ($devData['mwilamp']=="on") echo "selected='selected'" ?> >On</option>
<option value="flash" <?php if ($devData['mwilamp']=="flash") echo "selected='selected'" ?> >Flash</option>
<option value="wink" <?php if ($devData['mwilamp']=="wink") echo "selected='selected'" ?> >Wink</option>
<option value="blink" <?php if ($devData['mwilamp']=="blink") echo "selected='selected'" ?> >Blink</option>
<option value="off" <?php if ($devData['mwilamp']=="off") echo "selected='selected'" ?> >Off</option>
</select>
</tr>
<tr>
<td></td>
<td><a href="#" class="info"><?php echo _("tzoffset")?>:<span><?php echo _("Set the TimeZone offset for your phone. Not usually required, but may be needed to keep some phones screens from turning off during the day.")?></span></a></td>
<td><input size="6" type="text" name="devData[tzoffset]" id="devData[tzoffset]" value="<?php echo $devData['tzoffset']?>" /></td>
</tr>
<tr>
<td> </td>
</tr>
<?php
$loadlist = sccp_get_tftp_loadlist($type);
if (strlen($loadlist['loadimage']) > 0) {
$devData['imageversion'] = $loadlist['loadimage'];
}
?>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("Phone Load Name")?>:<span><?php echo _("Firmware version for upgrade ")?></span></a></td>
<td><input size="20" type="text" name="devData[imageversion]" id="devData[imageversion]" value="<?php echo $devData['imageversion']?>" /></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("NAT")?>:<span><?php echo _("Device NAT support (default Off)")?></span></a></td>
<td>
<select name="devData[nat]" id="devData[nat]">
<option value="off" <?php if ($devData['nat']=="off") echo "selected='selected'" ?> >Off</option>
<option value="on" <?php if ($devData['nat']=="on") echo "selected='selected'" ?> >On</option>
</select>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("directrtp")?>:<span><?php echo _("This option allow devices to do direct RTP sessions (default Off)")?></span></a></td>
<td>
<select name="devData[directrtp]" id="devData[directrtp]">
<option value="off" <?php if ($devData['directrtp']=="off") echo "selected='selected'" ?> >Off</option>
<option value="on" <?php if ($devData['directrtp']=="on") echo "selected='selected'" ?> >On</option>
</select>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("earlyrtp")?>:<span><?php echo _("The audio strem will be open in the progress and connected state.<br>Valid options: none, progress, offhook, dial, ringout. Default may be Progress.")?></span></a></td>
<td>
<select name="devData[earlyrtp]" id="devData[earlyrtp]">
<option value="progress" <?php if ($devData['earlyrtp']=="progress") echo "selected='selected'" ?> >Progress</option>
<option value="offhook" <?php if ($devData['earlyrtp']=="offhook") echo "selected='selected'" ?> >Offhook</option>
<option value="dial" <?php if ($devData['earlyrtp']=="dial") echo "selected='selected'" ?> >Dial</option>
<option value="none" <?php if ($devData['earlyrtp']=="none") echo "selected='selected'" ?> >None</option>
</select>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("deny")?>:<span><?php echo _("Deny IP address list. Default is 0.0.0.0")?></span></a></td>
<?php
if (strlen($devData['deny']) < 7) {
$devData['deny'] = $sccpConf['deny'];;
}
?>
<td><input size="20" type="text" name="devData[deny]" id="devData[deny]" value="<?php echo $devData['deny']?>" /></td>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("permit")?>:<span><?php echo _("Permit IP address list. Default is the server's webserver IP address.")?></span></a></td>
<?php
if (strlen($devData['permit']) < 7) {
$devData['permit'] = $sccpConf['permit'];
}
?>
<td><input size="20" type="text" name="devData[permit]" id="devData[permit]" value="<?php echo $devData['permit']?>" /></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("Pickup Exten")?>:<span><?php echo _("Enable Pickup function to direct pickup an extension. Default is On")?></span></a></td>
<td>
<select name="devData[pickupexten]" id="devData[pickupexten]">
<option value="on" <?php if ($devData['pickupexten']=="on") echo "selected='selected'" ?> >On</option>
<option value="off" <?php if ($devData['pickupexten']=="off") echo "selected='selected'" ?> >Off</option>
</select>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("Pickup Context")?>:<span><?php echo _("Context where direct pickup search for extensions. Default value in FreePBX is from-internal.")?></span></a></td>
<?php
if (strlen($devData['pickupcontext']) < 1) {
$devData['pickupcontext'] = $sccpConf['context'];
}
?>
<td><input size="20" type="text" name="devData[pickupcontext]" id="devData[pickupcontext]" value="<?php echo $devData['pickupcontext']?>" /></td>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("Pickup Mode Answer")?>:<span><?php echo _("On (Default)= the call has been answered when picked up<br />Off = call manager way, the phone who picked up the call rings the call")?></span></a></td>
<td>
<select name="devData[pickupmodeanswer]" id="devData[pickupmodeanswer]">
<option value="on" <?php if ($devData['pickupmodeanswer']=="on") echo "selected='selected'" ?> >On</option>
<option value="off" <?php if ($devData['pickupmodeanswer']=="off") echo "selected='selected'" ?> >Off</option>
</select>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info"><?php echo _("Background Image")?>:<span><?php echo _("For phones that can display background images - display this one. Default is [empty]")?></span></a></td>
<td><input size="20" type="text" name="devData[backgroundImage]" id="devData[backgroundImage]" value="<?php echo $devData['backgroundImage']?>" /></td>
</tr>
<tr>
<td> </td>
<td><a href="#" class="info">Ringtone:<span><?php echo _("The ringtone that the phone will default to. Can be overridden in the phone. The files RINGLIST.XML provice the basic phone ring tones, while DISTINCTIVERINGLIST.XML defines the list of possible ring tones for your other line types. They, along with the actual 'raw' ringtones, are stored in the /tftpboot/ directory with the rest of the config files."); ?></a></td>
<td><input size="20" type="text" name="devData[ringtone]" id="devData[ringtone]" value="<?php echo $devData['ringtone']?>" /></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="5"><br /><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>">
<?php
if ($devdisplay) {
echo '<input name="ResetPhone" id="ResetPhone" type="button" value="Reset Phone" onclick="reset_phone(edit_sccp_devices)" />';
echo "<input type='hidden' name='RestartPhone' id='RestartPhone' value=0>";
}
?>
</td>
</tr>
</table>
</form>
<?php echo add_free_space(7); ?>
<script language="javascript">
function check_sccp_device(theForm) {
var msgInvalidMAC = "<?php echo _('Invalid MAC address specified'); ?>";
var msgInvalidPhoneType = "<?php echo _("Must select phone type - currently $phone_type or $type"); ?> or theForm.type.value";
// set up the Destination stuff
setDestinations(theForm, '_post_dest');
defaultEmptyOK = false;
if (theForm.mac_address.value.length != 12)
return warnInvalid(theForm.mac_address, msgInvalidMAC);
if ("<!php echo $devData['type'] ?>" ==""){
alert (msgInvalidPhoneType);
return false;
}
if (!validateDestinations(theForm, 1, true))
return false;
return true;
}
function reset_phone(theForm) {
var msgResetPhone = "<?php echo _('Reset phone: '); ?>";
var Phone = "SEP"+theForm.mac_address.value;
if (confirm(msgResetPhone+Phone+'. OK ?' )) {
theForm.RestartPhone.value = 1;
document.edit_sccp_devices.submit();
} else {
return false;
}
}
function mayusculas(){
texto = document.getElementById("mac_address").value;
document.getElementById("mac_address").value = texto.toUpperCase();
}
</script>