| 13 | | |
|---|
| 14 | | include 'common/php-asmanager.php'; |
|---|
| 15 | | |
|---|
| 16 | | |
|---|
| 17 | | |
|---|
| 18 | | //make sure we can connect to Asterisk Manager |
|---|
| 19 | | checkAstMan(); |
|---|
| 20 | | |
|---|
| 21 | | /* User specific stuff */ |
|---|
| 22 | | |
|---|
| 23 | | $dispnum = 'extensions'; //used for switch in config.php |
|---|
| 24 | | |
|---|
| 25 | | //create vars from the request |
|---|
| 26 | | extract($_REQUEST); |
|---|
| 27 | | |
|---|
| 28 | | // Clean up warnings for undef'ed vars |
|---|
| 29 | | if (!isset($extdisplay)) $extdisplay=''; |
|---|
| 30 | | if (!isset($record_in)) $record_in=''; |
|---|
| 31 | | if (!isset($record_out)) $record_out=''; |
|---|
| 32 | | if (!isset($emergencycid)) $emergencycid=''; |
|---|
| 33 | | if (!isset($outboundcid)) $outboundcid=''; |
|---|
| 34 | | |
|---|
| 35 | | //make sure we can connect to Asterisk Manager |
|---|
| 36 | | checkAstMan(); |
|---|
| 37 | | |
|---|
| 38 | | //read in the voicemail.conf and set appropriate variables for display |
|---|
| 39 | | $uservm = voicemail_getVoicemail(); |
|---|
| 40 | | $vmcontexts = array_keys($uservm); |
|---|
| 41 | | $vm=false; |
|---|
| 42 | | foreach ($vmcontexts as $vmcontext) { |
|---|
| 43 | | if(isset($extdisplay) && isset($uservm[$vmcontext][$extdisplay])){ |
|---|
| 44 | | //echo $extdisplay.' found in context '.$vmcontext.'<hr>'; |
|---|
| 45 | | $incontext = $vmcontext; //the context for the current extension |
|---|
| 46 | | $vmpwd = $uservm[$vmcontext][$extdisplay]['pwd']; |
|---|
| 47 | | $name = $uservm[$vmcontext][$extdisplay]['name']; |
|---|
| 48 | | $email = $uservm[$vmcontext][$extdisplay]['email']; |
|---|
| 49 | | $pager = $uservm[$vmcontext][$extdisplay]['pager']; |
|---|
| 50 | | //loop through all options |
|---|
| 51 | | $options=""; |
|---|
| 52 | | if (is_array($uservm[$vmcontext][$extdisplay]['options'])) { |
|---|
| 53 | | $alloptions = array_keys($uservm[$vmcontext][$extdisplay]['options']); |
|---|
| 54 | | if (isset($alloptions)) { |
|---|
| 55 | | foreach ($alloptions as $option) { |
|---|
| 56 | | if ( ($option!="attach") && ($option!="envelope") && ($option!="saycid") && ($option!="delete") && ($option!='') ) |
|---|
| 57 | | $options .= $option.'='.$uservm[$vmcontext][$extdisplay]['options'][$option].'|'; |
|---|
| 58 | | } |
|---|
| 59 | | $options = rtrim($options,'|'); |
|---|
| 60 | | // remove the = sign if there are no options set |
|---|
| 61 | | $options = rtrim($options,'='); |
|---|
| 62 | | |
|---|
| 63 | | } |
|---|
| 64 | | extract($uservm[$vmcontext][$extdisplay]['options'], EXTR_PREFIX_ALL, "vmops"); |
|---|
| 65 | | } |
|---|
| 66 | | $vm=true; |
|---|
| 67 | | } |
|---|
| 68 | | } |
|---|
| 69 | | |
|---|
| 70 | | $vmcontext = $_SESSION["AMP_user"]->_deptname; //AMP Users can only add to their department's context |
|---|
| 71 | | if (empty($vmcontext)) |
|---|
| 72 | | if (isset($incontext)) |
|---|
| 73 | | $vmcontext = isset($_REQUEST['vmcontext'])?$_REQUEST['vmcontext']:$incontext; |
|---|
| 74 | | if (empty($vmcontext)) |
|---|
| 75 | | $vmcontext = 'default'; |
|---|
| 76 | | |
|---|
| 77 | | //check if the extension is within range for this user |
|---|
| 78 | | if (isset($extension) && !checkRange($extension)){ |
|---|
| 79 | | echo "<script>javascript:alert('". _("Warning! Extension")." ".$extension." "._("is not allowed for your account").".');</script>"; |
|---|
| 80 | | } else { |
|---|
| 81 | | //deviceid and extension are the same and fixed |
|---|
| 82 | | $deviceid = $deviceuser = isset($extension)?$extension:''; |
|---|
| 83 | | $description = isset($_REQUEST['description'])?$_REQUEST['description']:''; |
|---|
| 84 | | |
|---|
| 85 | | //user name should be equal to device description |
|---|
| 86 | | $_REQUEST['name'] = $description; |
|---|
| 87 | | |
|---|
| 88 | | //if submitting form, update database |
|---|
| 89 | | if (!isset($action)) |
|---|
| 90 | | $action=''; |
|---|
| 91 | | switch ($action) { |
|---|
| 92 | | case "add": |
|---|
| 93 | | core_users_add($_REQUEST,$vmcontext); |
|---|
| 94 | | core_devices_add($deviceid,$tech,$dial,$devicetype,$deviceuser,$description,$emergency_cid); |
|---|
| 95 | | needreload(); |
|---|
| 96 | | break; |
|---|
| 97 | | case "del": |
|---|
| 98 | | core_devices_del($extdisplay); |
|---|
| 99 | | core_users_del($extdisplay,$incontext,$uservm); |
|---|
| 100 | | core_users_cleanastdb($extdisplay); |
|---|
| 101 | | needreload(); |
|---|
| 102 | | break; |
|---|
| 103 | | case "edit": //just delete and re-add |
|---|
| 104 | | core_devices_del($extdisplay); |
|---|
| 105 | | core_devices_add($deviceid,$tech,$dial,$devicetype,$deviceuser,$description,$emergency_cid); |
|---|
| 106 | | core_users_edit($extdisplay,$_REQUEST,$vmcontext,$incontext,$uservm); |
|---|
| 107 | | // Need to re-propogate all the vm info here, because it could have changed |
|---|
| 108 | | $uservm = voicemail_getVoicemail(); |
|---|
| 109 | | $vmcontexts = array_keys($uservm); |
|---|
| 110 | | $vm=false; |
|---|
| 111 | | foreach ($vmcontexts as $vmcontext) { |
|---|
| 112 | | if(isset($uservm[$vmcontext][$extdisplay])){ |
|---|
| 113 | | $incontext = $vmcontext; //the context for the current extension |
|---|
| 114 | | $vmpwd = $uservm[$vmcontext][$extdisplay]['pwd']; |
|---|
| 115 | | $name = $uservm[$vmcontext][$extdisplay]['name']; |
|---|
| 116 | | $email = $uservm[$vmcontext][$extdisplay]['email']; |
|---|
| 117 | | $pager = $uservm[$vmcontext][$extdisplay]['pager']; |
|---|
| 118 | | $options=""; |
|---|
| 119 | | if (is_array($uservm[$vmcontext][$extdisplay]['options'])) { |
|---|
| 120 | | $alloptions = array_keys($uservm[$vmcontext][$extdisplay]['options']); |
|---|
| 121 | | if (isset($alloptions)) { |
|---|
| 122 | | foreach ($alloptions as $option) { |
|---|
| 123 | | if ( ($option!="attach") && ($option!="envelope") && ($option!="saycid") && ($option!="delete") && ($option!='') ) |
|---|
| 124 | | $options .= $option.'='.$uservm[$vmcontext][$extdisplay]['options'][$option].'|'; |
|---|
| 125 | | } |
|---|
| 126 | | $options = rtrim($options,'|'); |
|---|
| 127 | | // remove the = sign if there are no options set |
|---|
| 128 | | $options = rtrim($options,'='); |
|---|
| 129 | | } |
|---|
| 130 | | extract($uservm[$vmcontext][$extdisplay]['options'], EXTR_PREFIX_ALL, "vmops"); |
|---|
| 131 | | } |
|---|
| 132 | | $vm=true; |
|---|
| 133 | | } |
|---|
| 134 | | } |
|---|
| 135 | | needreload(); |
|---|
| 136 | | break; |
|---|
| 137 | | case "resetall": //form a url with this option to nuke the AMPUSER & DEVICE trees and start over. |
|---|
| 138 | | core_users2astdb(); |
|---|
| 139 | | core_devices2astdb(); |
|---|
| 140 | | break; |
|---|
| 141 | | } |
|---|
| 142 | | } |
|---|
| 152 | | |
|---|
| 153 | | |
|---|
| 154 | | <div class="content"> |
|---|
| 155 | | <?php |
|---|
| 156 | | if ($action == 'del') { |
|---|
| 157 | | echo '<br><h3>'.$extdisplay.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>'; |
|---|
| 158 | | } else if( (isset($tech)?$tech:'') == '' && (isset($extdisplay)?$extdisplay:'') == '' ) { |
|---|
| 159 | | ?> |
|---|
| 160 | | <h2><?php echo _("Add an Extension")?></h2> |
|---|
| 161 | | <h5><?php echo _("Select device technology:")?></h5> |
|---|
| 162 | | <li><a href="<?php echo $_SERVER['PHP_SELF'].'?display='.$display; ?>&tech=sip"><?php echo _("SIP")?></a><br><br> |
|---|
| 163 | | <li><a href="<?php echo $_SERVER['PHP_SELF'].'?display='.$display; ?>&tech=iax2"><?php echo _("IAX2")?></a><br><br> |
|---|
| 164 | | <li><a href="<?php echo $_SERVER['PHP_SELF'].'?display='.$display; ?>&tech=zap"><?php echo _("ZAP")?></a><br><br> |
|---|
| 165 | | <li><a href="<?php echo $_SERVER['PHP_SELF'].'?display='.$display; ?>&tech=custom"><?php echo _("Custom")?></a><br><br> |
|---|
| 166 | | <?php |
|---|
| 167 | | } else { |
|---|
| 168 | | $delURL = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=del'; |
|---|
| 169 | | ?> |
|---|
| 170 | | <?php if ($extdisplay != null) { |
|---|
| 171 | | $deviceInfo=core_devices_get($extdisplay); |
|---|
| 172 | | extract($deviceInfo,EXTR_PREFIX_ALL,'devinfo'); |
|---|
| 173 | | $extenInfo=core_users_get($extdisplay); |
|---|
| 174 | | extract($extenInfo); |
|---|
| 175 | | $tech = $devinfo_tech; |
|---|
| 176 | | if (is_array($deviceInfo)) extract($deviceInfo); |
|---|
| 177 | | ?> |
|---|
| 178 | | <h2><?php echo strtoupper($tech)." "._("Extension")?>: <?php echo $extdisplay; ?></h2> |
|---|
| 179 | | <p><a href="<?php echo $delURL ?>"><?php echo _("Delete Extension")?> <?php echo $extdisplay ?></a></p> |
|---|
| 180 | | <?php |
|---|
| 181 | | // implementation of module hook |
|---|
| 182 | | echo $module_hook->hookHtml; |
|---|
| 183 | | } else { ?> |
|---|
| 184 | | <h2><?php echo _("Add")." ".strtoupper($tech)." "._("Extension")?></h2> |
|---|
| 185 | | <?php } ?> |
|---|
| 186 | | <?php |
|---|
| 187 | | ?> |
|---|
| 188 | | <form name="addNew" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return addNew_onsubmit();"> |
|---|
| 189 | | <input type="hidden" name="display" value="<?php echo $dispnum?>"> |
|---|
| 190 | | <input type="hidden" name="action" value="<?php echo ($extdisplay ? 'edit' : 'add') ?>"> |
|---|
| 191 | | <input type="hidden" name="extdisplay" value="<?php echo $extdisplay ?>"> |
|---|
| 192 | | <input type="hidden" name="tech" value="<?php echo $tech ?>"> |
|---|
| 193 | | <table> |
|---|
| 194 | | |
|---|
| 195 | | <tr><td colspan="2"><h5><?php echo ($extdisplay ? _('Edit Extension') : _('Add Extension')) ?><hr></h5></td></tr> |
|---|
| 196 | | |
|---|
| 197 | | <tr <?php echo ($extdisplay ? 'style="display:none"':'') ?>> |
|---|
| 198 | | <td> |
|---|
| 199 | | <a href="#" class="info"><?php echo _("Extension Number")?><span><?php echo _('Use a unique number. The device will use this number to authenicate to the system, and users will dial it to ring the device.').' '._('You can not use 0')?></span></a>: |
|---|
| 200 | | </td> |
|---|
| 201 | | <td> |
|---|
| 202 | | <input type="text" name="extension" value="<?php echo $extdisplay ?>"> |
|---|
| 203 | | </td> |
|---|
| 204 | | </tr> |
|---|
| 205 | | |
|---|
| 206 | | <tr> |
|---|
| 207 | | <td> |
|---|
| 208 | | <a href="#" class="info"><?php echo _("Display Name")?><span><?php echo _("The caller id name for this device will be set to this.")?><br></span></a>: |
|---|
| 209 | | </td><td> |
|---|
| 210 | | <input type="text" name="description" value="<?php echo htmlspecialchars($devinfo_description) ?>"/> |
|---|
| 211 | | </td> |
|---|
| 212 | | </tr> |
|---|
| 213 | | <input type="hidden" name="devicetype" value="fixed"/> |
|---|
| 214 | | <input type="hidden" name="deviceuser" value="same"/> |
|---|
| 215 | | <input type="hidden" name="password" value=""/> |
|---|
| 216 | | |
|---|
| 217 | | <tr> |
|---|
| 218 | | <td colspan="2"> |
|---|
| 219 | | <h5><br><?php echo _("Extension Options")?><hr></h5> |
|---|
| 220 | | </td> |
|---|
| 221 | | </tr> |
|---|
| 222 | | |
|---|
| 223 | | <tr> |
|---|
| 224 | | <td> |
|---|
| 225 | | <a href="#" class="info"><?php echo _("Direct DID")?><span><?php echo _("The direct DID that is associated with this extension. The DID should be in the same format as provided by the provider (e.g. full number, 4 digits for 10x4, etc).<br><br>Format should be: <b>XXXXXXXXXX</b><br><br>Leave this field blank to disable the direct DID feature for this extension. All non-numeric characters will be stripped.")?><br></span></a>: |
|---|
| 226 | | </td><td> |
|---|
| 227 | | <input type="text" name="directdid" value="<?php echo htmlentities($directdid) ?>"/> |
|---|
| 228 | | </td> |
|---|
| 229 | | </tr> |
|---|
| 230 | | |
|---|
| 231 | | <tr> |
|---|
| 232 | | <td> |
|---|
| 233 | | <a href="#" class="info"><?php echo _("DID Alert Info")?><span><?php echo _("Alert Info can be used for distinctive ring on SIP phones. Set this value to the desired Alert Info to be sent to the phone when this DID is called. Leave blank to use default values. Will have no effect if no Direct DID is set")?><br></span></a>: |
|---|
| 234 | | </td><td> |
|---|
| 235 | | <input type="text" name="didalert" value="<?php echo htmlentities($didalert) ?>"/> |
|---|
| 236 | | </td> |
|---|
| 237 | | </tr> |
|---|
| 238 | | |
|---|
| 239 | | <tr> |
|---|
| 240 | | <td> |
|---|
| 241 | | <a href="#" class="info"><?php echo _("Outbound CID")?><span><?php echo _("Overrides the caller id when dialing out a trunk. Any setting here will override the common outbound caller id set in the Trunks admin.<br><br>Format: <b>\"caller name\" <#######></b><br><br>Leave this field blank to disable the outbound callerid feature for this extension.")?><br></span></a>: |
|---|
| 242 | | </td><td> |
|---|
| 243 | | <input type="text" name="outboundcid" value="<?php echo htmlentities($outboundcid) ?>"/> |
|---|
| 244 | | </td> |
|---|
| 245 | | </tr> |
|---|
| 246 | | |
|---|
| 247 | | <tr> |
|---|
| 248 | | <td> |
|---|
| 249 | | <a href="#" class="info"><?php echo _("Emergency CID")?><span><?php echo _("This caller id will always be set when dialing out an Outbound Route flagged as Emergency. The Emergency CID overrides all other caller id settings.")?><br></span></a>: |
|---|
| 250 | | </td><td> |
|---|
| 251 | | <input type="text" name="emergency_cid" value="<?php echo htmlspecialchars($emergency_cid) ?>"/> |
|---|
| 252 | | </td> |
|---|
| 253 | | </tr> |
|---|
| 254 | | |
|---|
| 255 | | <tr> |
|---|
| 256 | | <td> |
|---|
| 257 | | <a href="#" class="info"><?php echo _("Record Incoming")?><span><?php echo _("Record all inbound calls received at this extension.")?><br></span></a>: |
|---|
| 258 | | </td><td> |
|---|
| 259 | | <select name="record_in"/> |
|---|
| 260 | | <option value="Adhoc" <?php echo ($record_in == "On-Demand") ? 'selected' : '' ?>><?php echo _("On Demand")?> |
|---|
| 261 | | <option value="Always" <?php echo ($record_in == "Always") ? 'selected' : '' ?>><?php echo _("Always")?> |
|---|
| 262 | | <option value="Never" <?php echo ($record_in == "Never") ? 'selected' : '' ?>><?php echo _("Never")?> |
|---|
| 263 | | </select> |
|---|
| 264 | | </td> |
|---|
| 265 | | </tr> |
|---|
| 266 | | |
|---|
| 267 | | <tr> |
|---|
| 268 | | <td> |
|---|
| 269 | | <a href="#" class="info"><?php echo _("Record Outgoing")?><span><?php echo _("Record all outbound calls received at this extension.")?><br></span></a>: |
|---|
| 270 | | </td><td> |
|---|
| 271 | | <select name="record_out"/> |
|---|
| 272 | | <option value="Adhoc" <?php echo ($record_out == "On-Demand") ? 'selected' : '' ?>><?php echo _("On Demand")?> |
|---|
| 273 | | <option value="Always" <?php echo ($record_out == "Always") ? 'selected' : '' ?>><?php echo _("Always")?> |
|---|
| 274 | | <option value="Never" <?php echo ($record_out == "Never") ? 'selected' : '' ?>><?php echo _("Never")?> |
|---|
| 275 | | </select> |
|---|
| 276 | | </td> |
|---|
| 277 | | </tr> |
|---|
| 278 | | |
|---|
| 279 | | <td><br></td> |
|---|
| 280 | | |
|---|
| 281 | | <tr><td colspan="2"><h5><?php echo _("Fax Handling")?><hr></h5></td></tr> |
|---|
| 282 | | <tr> |
|---|
| 283 | | <td> |
|---|
| 284 | | <a class="info" href="#"><?php echo _("Fax Extension")?><span><?php echo _("Select 'system' to have the system receive and email faxes.<br><br>The freePBX default is defined in General Settings.")?></span></a>: |
|---|
| 285 | | </td> |
|---|
| 286 | | <td> |
|---|
| 287 | | <select name="faxexten"> |
|---|
| 288 | | <?php |
|---|
| 289 | | // Cleaning up warnings. I should do this a better way. |
|---|
| 290 | | if (!isset($faxexten)) |
|---|
| 291 | | $faxexten = null; |
|---|
| 292 | | if (!isset($faxemail)) |
|---|
| 293 | | $faxemail = null; |
|---|
| 294 | | if (!isset($answer)) |
|---|
| 295 | | $answer = '0'; |
|---|
| 296 | | ?> |
|---|
| 297 | | <option value="default" <?php echo ($faxexten == 'default' ? 'SELECTED' : '')?>><?php echo _("freePBX default")?> |
|---|
| 298 | | <option value="disabled" <?php echo ($faxexten == 'disabled' ? 'SELECTED' : '')?>><?php echo _("disabled")?> |
|---|
| 299 | | <option value="system" <?php echo ($faxexten == 'system' ? 'SELECTED' : '')?>><?php echo _("system")?> |
|---|
| 300 | | <?php |
|---|
| 301 | | //get unique devices |
|---|
| 302 | | $devices = core_devices_list(); |
|---|
| 303 | | if (isset($devices)) { |
|---|
| 304 | | foreach ($devices as $device) { |
|---|
| 305 | | echo '<option value="'.$device[0].'" '.($faxexten == $device[0] ? 'SELECTED' : '').'>'.$device[1].' <'.$device[0].'>'; |
|---|
| 306 | | } |
|---|
| 307 | | } |
|---|
| 308 | | ?> |
|---|
| 309 | | </select> |
|---|
| 310 | | </td> |
|---|
| 311 | | </tr> |
|---|
| 312 | | <tr> |
|---|
| 313 | | <td> |
|---|
| 314 | | <a class="info" href="#"><?php echo _("Fax Email")?><span><?php echo _("Email address is used if 'system' has been chosen for the fax extension above.<br><br>Leave this blank to use the freePBX default in General Settings.")?></span></a>: |
|---|
| 315 | | </td> |
|---|
| 316 | | <td> |
|---|
| 317 | | <input type="text" size="20" name="faxemail" value="<?php echo htmlspecialchars($faxemail)?>"/> |
|---|
| 318 | | </td> |
|---|
| 319 | | </tr> |
|---|
| 320 | | <tr> |
|---|
| 321 | | <td><a href="#" class="info"><?php echo _("Fax Detection Type")?><span><?php echo _('Selecting Zaptel or NVFax will immediately answer the call and play ringing tones to the caller for the number of seconds in Pause below. Use NVFax on SIP or IAX trunks.')?></span></a>:</td> |
|---|
| 322 | | <td> |
|---|
| 323 | | <select name="answer"> |
|---|
| 324 | | <option value="0" <?php echo ($answer == '0' ? 'SELECTED' : '')?>><?php echo _("None")?> |
|---|
| 325 | | <option value="1" <?php echo ($answer == '1' ? 'SELECTED' : '')?>><?php echo _("Zaptel")?> |
|---|
| 326 | | <option value="2" <?php echo ($answer == '2' ? 'SELECTED' : '')?>><?php echo _("NVFax")?> |
|---|
| 327 | | </select> |
|---|
| 328 | | </td> |
|---|
| 329 | | </tr> |
|---|
| 330 | | <tr> |
|---|
| 331 | | <td><a href="#" class="info"><?php echo _("Pause after answer")?><span><?php echo _('The number of seconds we should wait after performing an Immediate Answer. The primary purpose of this is to pause and listen for a fax tone before allowing the call to proceed.')?></span></a>:</td> |
|---|
| 332 | | <td><input type="text" name="wait" size="3" value="<?php echo isset($wait)?$wait:'' ?>"></td> |
|---|
| 333 | | </tr> |
|---|
| 334 | | <tr> |
|---|
| 335 | | <td><br></td> |
|---|
| 336 | | </tr> |
|---|
| 337 | | <?php |
|---|
| 338 | | if (!isset($privacyman)) |
|---|
| 339 | | $privacyman = '0'; |
|---|
| 340 | | ?> |
|---|
| 341 | | <tr><td colspan="2"><h5><?php echo _("Privacy")?><hr></h5></td></tr> |
|---|
| 342 | | <tr> |
|---|
| 343 | | <td><a href="#" class="info"><?php echo _("Privacy Manager")?><span><?php echo _('If no Caller ID is sent, Privacy Manager will asks the caller to enter their 10 digit phone number. The caller is given 3 attempts.')?></span></a>:</td> |
|---|
| 344 | | <td> |
|---|
| 345 | | <select name="privacyman"> |
|---|
| 346 | | <option value="0" <?php echo ($privacyman == '0' ? 'SELECTED' : '')?>><?php echo _("No")?> |
|---|
| 347 | | <option value="1" <?php echo ($privacyman == '1' ? 'SELECTED' : '')?>><?php echo _("Yes")?> |
|---|
| 348 | | </select> |
|---|
| 349 | | </td> |
|---|
| 350 | | </tr> |
|---|
| 351 | | <tr> |
|---|
| 352 | | <td><br></td> |
|---|
| 353 | | </tr> |
|---|
| 354 | | |
|---|
| 355 | | <tr> |
|---|
| 356 | | <td colspan="2"> |
|---|
| 357 | | <h5><br><?php echo _("Device Options")?><hr></h5> |
|---|
| 358 | | </td> |
|---|
| 359 | | </tr> |
|---|
| 360 | | |
|---|
| 361 | | <?php |
|---|
| 362 | | switch(strtolower($tech)) { |
|---|
| 363 | | case "zap": |
|---|
| 364 | | $basic = array( |
|---|
| 365 | | 'channel' => '', |
|---|
| 366 | | ); |
|---|
| 367 | | $advanced = array( |
|---|
| 368 | | 'context' => 'from-internal', |
|---|
| 369 | | 'signalling' => 'fxo_ks', |
|---|
| 370 | | 'echocancel' => 'yes', |
|---|
| 371 | | 'echocancelwhenbridged' => 'no', |
|---|
| 372 | | 'echotraining' => '800', |
|---|
| 373 | | 'immediate' => 'no', |
|---|
| 374 | | 'busydetect' => 'no', |
|---|
| 375 | | 'busycount' => '7', |
|---|
| 376 | | 'callprogress' => 'no', |
|---|
| 377 | | 'dial' => '', |
|---|
| 378 | | 'accountcode' => '', |
|---|
| 379 | | 'mailbox' => '' |
|---|
| 380 | | ); |
|---|
| 381 | | break; |
|---|
| 382 | | case "iax2": |
|---|
| 383 | | $basic = array( |
|---|
| 384 | | 'secret' => '', |
|---|
| 385 | | ); |
|---|
| 386 | | $advanced = array( |
|---|
| 387 | | 'notransfer' => 'yes', |
|---|
| 388 | | 'context' => 'from-internal', |
|---|
| 389 | | 'host' => 'dynamic', |
|---|
| 390 | | 'type' => 'friend', |
|---|
| 391 | | 'port' => '4569', |
|---|
| 392 | | 'qualify' => 'no', |
|---|
| 393 | | 'disallow' => '', |
|---|
| 394 | | 'allow' => '', |
|---|
| 395 | | 'dial' => '', |
|---|
| 396 | | 'accountcode' => '', |
|---|
| 397 | | 'mailbox' => '' |
|---|
| 398 | | ); |
|---|
| 399 | | break; |
|---|
| 400 | | case "sip": |
|---|
| 401 | | $basic = array( |
|---|
| 402 | | 'secret' => '', |
|---|
| 403 | | 'dtmfmode' => 'rfc2833' |
|---|
| 404 | | ); |
|---|
| 405 | | $advanced = array( |
|---|
| 406 | | 'canreinvite' => 'no', |
|---|
| 407 | | 'context' => 'from-internal', |
|---|
| 408 | | 'host' => 'dynamic', |
|---|
| 409 | | 'type' => 'friend', |
|---|
| 410 | | 'nat' => 'never', |
|---|
| 411 | | 'port' => '5060', |
|---|
| 412 | | 'qualify' => 'no', |
|---|
| 413 | | 'callgroup' => '', |
|---|
| 414 | | 'pickupgroup' => '', |
|---|
| 415 | | 'disallow' => '', |
|---|
| 416 | | 'allow' => '', |
|---|
| 417 | | 'dial' => '', |
|---|
| 418 | | 'accountcode' => '', |
|---|
| 419 | | 'mailbox' => '' |
|---|
| 420 | | ); |
|---|
| 421 | | break; |
|---|
| 422 | | case "custom": |
|---|
| 423 | | $basic = array( |
|---|
| 424 | | 'dial' => '', |
|---|
| 425 | | ); |
|---|
| 426 | | $advanced = array(); |
|---|
| 427 | | break; |
|---|
| 428 | | } |
|---|
| 429 | | |
|---|
| 430 | | if($extdisplay != '') { |
|---|
| 431 | | foreach($basic as $key => $value) { |
|---|
| 432 | | echo "<tr><td>"._("{$key}")."</td><td><input type=\"text\" name=\"{$key}\" value=\"{$$key}\"/></td></tr>"; |
|---|
| 433 | | } |
|---|
| 434 | | foreach($advanced as $key => $value) { |
|---|
| 435 | | echo "<tr><td>"._("{$key}")."</td><td><input type=\"text\" name=\"{$key}\" value=\"{$$key}\"/></td></tr>"; |
|---|
| 436 | | } |
|---|
| 437 | | } else { |
|---|
| 438 | | foreach($basic as $key => $value) { |
|---|
| 439 | | echo "<tr><td>{$key}</td><td><input type=\"text\" name=\"{$key}\" value=\"{$value}\"/></td></tr>"; |
|---|
| 440 | | } |
|---|
| 441 | | foreach($advanced as $key => $value) { |
|---|
| 442 | | echo "<input type=\"hidden\" name=\"{$key}\" value=\"{$value}\"/>"; |
|---|
| 443 | | } |
|---|
| 444 | | } |
|---|
| 445 | | ?> |
|---|
| 446 | | |
|---|
| 447 | | <tr><td colspan=2> |
|---|
| 448 | | <h5><br><br><?php echo _("Voicemail & Directory:")?> |
|---|
| 449 | | <select name="vm" onchange="checkVoicemail(addNew);"> |
|---|
| 450 | | <option value="enabled" <?php echo ($vm) ? 'selected' : '' ?>><?php echo _("Enabled");?></option> |
|---|
| 451 | | <option value="disabled" <?php echo (!$vm) ? 'selected' : '' ?>><?php echo _("Disabled");?></option> |
|---|
| 452 | | </select> |
|---|
| 453 | | <hr></h5> |
|---|
| 454 | | </td></tr> |
|---|
| 455 | | <tr><td colspan=2> |
|---|
| 456 | | <table id="voicemail" <?php echo ($vm) ? '' : 'style="display:none;"' ?>> |
|---|
| 457 | | <tr> |
|---|
| 458 | | <td> |
|---|
| 459 | | <a href="#" class="info"><?php echo _("voicemail password")?><span><?php echo _("This is the password used to access the voicemail system.<br><br>This password can only contain numbers.<br><br>A user can change the password you enter here after logging into the voicemail system (*98) with a phone.")?><br><br></span></a>: |
|---|
| 460 | | </td><td> |
|---|
| 461 | | <input size="10" type="text" name="vmpwd" value="<?php echo isset($vmpwd)?$vmpwd:'' ?>"/> |
|---|
| 462 | | </td> |
|---|
| 463 | | </tr> |
|---|
| 464 | | <tr> |
|---|
| 465 | | <td><a href="#" class="info"><?php echo _("email address")?><span><?php echo _("The email address that voicemails are sent to.")?></span></a>: </td> |
|---|
| 466 | | <td><input type="text" name="email" value="<?php echo htmlspecialchars(isset($email)?$email:''); ?>"/></td> |
|---|
| 467 | | </tr> |
|---|
| 468 | | <tr> |
|---|
| 469 | | <td><a href="#" class="info"><?php echo _("pager email address")?><span><?echo _("Pager/mobile email address that short voicemail notifcations are sent to.")?></span></a>: </td> |
|---|
| 470 | | <td><input type="text" name="pager" value="<?php echo htmlspecialchars(isset($pager)?$pager:''); ?>"/></td> |
|---|
| 471 | | </tr> |
|---|
| 472 | | <tr> |
|---|
| 473 | | <td><a href="#" class="info"><?php echo _("email attachment")?><span><?php echo _("Option to attach voicemails to email.")?></span></a>: </td> |
|---|
| 474 | | <?php if (isset($vmops_attach) && $vmops_attach == "yes"){?> |
|---|
| 475 | | <td><input type="radio" name="attach" value="attach=yes" checked=checked/> <?php echo _("yes");?> <input type="radio" name="attach" value="attach=no"/> <?php echo _("no");?></td> |
|---|
| 476 | | <?php } else{ ?> |
|---|
| 477 | | <td><input type="radio" name="attach" value="attach=yes" /> <?php echo _("yes");?> <input type="radio" name="attach" value="attach=no" checked=checked /> <?php echo _("no");?></td> <?php }?> |
|---|
| 478 | | </tr> |
|---|
| 479 | | |
|---|
| 480 | | <tr> |
|---|
| 481 | | <td><a href="#" class="info"><?php echo _("Play CID")?><span><?php echo _("Read back caller's telephone number prior to playing the incoming message, and just after announcing the date and time the message was left.")?></span></a>: </td> |
|---|
| 482 | | <?php if (isset($vmops_saycid) && $vmops_saycid == "yes"){?> |
|---|
| 483 | | <td><input type="radio" name="saycid" value="saycid=yes" checked=checked/> <?php echo _("yes");?> <input type="radio" name="saycid" value="saycid=no"/> <?php echo _("no");?></td> |
|---|
| 484 | | <?php } else{ ?> |
|---|
| 485 | | <td><input type="radio" name="saycid" value="saycid=yes" /> <?php echo _("yes");?> <input type="radio" name="saycid" value="saycid=no" checked=checked /> <?php echo _("no");?></td> <?php }?> |
|---|
| 486 | | </tr> |
|---|
| 487 | | |
|---|
| 488 | | <tr> |
|---|
| 489 | | <td><a href="#" class="info"><?php echo _("Play Envelope")?><span><?php echo _("Envelope controls whether or not the voicemail system will play the message envelope (date/time) before playing the voicemail message. This settng does not affect the operation of the envelope option in the advanced voicemail menu.")?></span></a>: </td> |
|---|
| 490 | | <?php if (isset($vmops_envelope) && $vmops_envelope == "yes"){?> |
|---|
| 491 | | <td><input type="radio" name="envelope" value="envelope=yes" checked=checked/> <?php echo _("yes");?> <input type="radio" name="envelope" value="envelope=no"/> <?php echo _("no");?></td> |
|---|
| 492 | | <?php } else{ ?> |
|---|
| 493 | | <td><input type="radio" name="envelope" value="envelope=yes" /> <?php echo _("yes");?> <input type="radio" name="envelope" value="envelope=no" checked=checked /> <?php echo _("no");?></td> <?php }?> |
|---|
| 494 | | </tr> |
|---|
| 495 | | |
|---|
| 496 | | <tr> |
|---|
| 497 | | <td><a href="#" class="info"><?php echo _("Delete Vmail")?><span><?php echo _("If set to \"yes\" the message will be deleted from the voicemailbox (after having been emailed). Provides functionality that allows a user to receive their voicemail via email alone, rather than having the voicemail able to be retrieved from the Webinterface or the Extension handset. CAUTION: MUST HAVE attach voicemail to email SET TO YES OTHERWISE YOUR MESSAGES WILL BE LOST FOREVER.")?> |
|---|
| 498 | | </span></a>: </td> |
|---|
| 499 | | <?php if (isset($vmops_delete) && $vmops_delete == "yes"){?> |
|---|
| 500 | | <td><input type="radio" name="delete" value="delete=yes" checked=checked/> <?php echo _("yes");?> <input type="radio" name="delete" value="delete=no"/> <?php echo _("no");?></td> |
|---|
| 501 | | <?php } else{ ?> |
|---|
| 502 | | <td><input type="radio" name="delete" value="delete=yes" /> <?php echo _("yes");?> <input type="radio" name="delete" value="delete=no" checked=checked /> <?php echo _("no");?></td> <?php }?> |
|---|
| 503 | | </tr> |
|---|
| 504 | | |
|---|
| 505 | | <tr> |
|---|
| 506 | | <td><a href="#" class="info"><?php echo _("vm options")?><span><?php echo _("Separate options with pipe ( | )")?><br><br><?php echo _("ie: review=yes|maxmessage=60")?></span></a>: </td> |
|---|
| 507 | | <td><input size="20" type="text" name="options" value="<?php echo htmlspecialchars(isset($options)?$options:''); ?>" /></td> |
|---|
| 508 | | </tr> |
|---|
| 509 | | <tr> |
|---|
| 510 | | <td><?php echo _("vm context:")?> </td> |
|---|
| 511 | | <td><input size="20" type="text" name="vmcontext" value="<?php echo $vmcontext; ?>" /></td> |
|---|
| 512 | | </tr> |
|---|
| 513 | | </table> |
|---|
| 514 | | </td></tr> |
|---|
| 515 | | |
|---|
| 516 | | |
|---|
| 517 | | <tr> |
|---|
| 518 | | <td colspan=2> |
|---|
| 519 | | <br><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit")?>"> |
|---|
| 520 | | </td> |
|---|
| 521 | | </tr> |
|---|
| 522 | | </table> |
|---|
| 523 | | |
|---|
| 524 | | <script language="javascript"> |
|---|
| 525 | | <!-- |
|---|
| 526 | | |
|---|
| 527 | | var theForm = document.addNew; |
|---|
| 528 | | if (theForm.extension.value == "") { |
|---|
| 529 | | theForm.extension.focus(); |
|---|
| 530 | | } else { |
|---|
| 531 | | theForm.description.focus(); |
|---|
| 532 | | } |
|---|
| 533 | | |
|---|
| 534 | | function addNew_onsubmit() { |
|---|
| 535 | | var msgInvalidExtNum = "<?php echo _('Please enter a valid extension number.'); ?>"; |
|---|
| 536 | | var msgInvalidDevDesc = "<?php echo _('Please enter a valid Description for this device'); ?>"; |
|---|
| 537 | | var msgInvalidOutboundCID = "<?php echo _('Please enter a valid Outbound CID'); ?>"; |
|---|
| 538 | | var msgInvalidEmergCID = "<?php echo _('Please enter a valid Emergency CID'); ?>"; |
|---|
| 539 | | var msgInvalidDTMFMODE = "<?php echo _('Please enter the dtmfmode for this device'); ?>"; |
|---|
| 540 | | var msgInvalidChannel = "<?php echo _('Please enter the channel for this device'); ?>"; |
|---|
| 541 | | var msgInvalidVmPwd = "<?php echo _('Please enter a valid Voicemail Password, using digits only'); ?>"; |
|---|
| 542 | | var msgInvalidEmail = "<?php echo _('Please enter a valid Email Address'); ?>"; |
|---|
| 543 | | var msgInvalidPager = "<?php echo _('Please enter a valid Pager Email Address'); ?>"; |
|---|
| 544 | | var msgInvalidVMContext = "<?php echo _('VM Context cannot be blank'); ?>"; |
|---|
| 545 | | var msgConfirmSecret = "<?php echo _('You have not entered a Secret for this device, although this is possible it is generally bad practice to not assign a Secret to a device.\n\nAre you sure you want to leave the Secret empty?'); ?>"; |
|---|
| 546 | | |
|---|
| 547 | | defaultEmptyOK = false; |
|---|
| 548 | | if (!isInteger(theForm.extension.value)) |
|---|
| 549 | | return warnInvalid(theForm.extension, msgInvalidExtNum); |
|---|
| 550 | | |
|---|
| 551 | | if (!isCallerID(theForm.description.value)) |
|---|
| 552 | | return warnInvalid(theForm.description, msgInvalidDevDesc); |
|---|
| 553 | | |
|---|
| 554 | | defaultEmptyOK = true; |
|---|
| 555 | | if (!isCallerID(theForm.outboundcid.value)) |
|---|
| 556 | | return warnInvalid(theForm.outboundcid, msgInvalidOutboundCID); |
|---|
| 557 | | |
|---|
| 558 | | if (!isCallerID(theForm.emergency_cid.value)) |
|---|
| 559 | | return warnInvalid(theForm.emergency_cid, msgInvalidEmergCID); |
|---|
| 560 | | |
|---|
| 561 | | defaultEmptyOK = false; |
|---|
| 562 | | if (theForm.dtmfmode != undefined && isEmpty(theForm.dtmfmode.value)) |
|---|
| 563 | | return warnInvalid(theForm.dtmfmode, msgInvalidDTMFMODE); |
|---|
| 564 | | |
|---|
| 565 | | if (theForm.channel != undefined && isEmpty(theForm.channel.value)) |
|---|
| 566 | | return warnInvalid(theForm.channel, msgInvalidChannel); |
|---|
| 567 | | |
|---|
| 568 | | // voicemail stuff |
|---|
| 569 | | if (theForm.vm.value == "enabled") { |
|---|
| 570 | | defaultEmptyOK = false; |
|---|
| 571 | | if (!isInteger(theForm.vmpwd.value)) |
|---|
| 572 | | return warnInvalid(theForm.vmpwd, msgInvalidVmPwd); |
|---|
| 573 | | |
|---|
| 574 | | defaultEmptyOK = true; |
|---|
| 575 | | if (!isEmail(theForm.email.value)) |
|---|
| 576 | | return warnInvalid(theForm.email, msgInvalidEmail); |
|---|
| 577 | | |
|---|
| 578 | | if (!isEmail(theForm.pager.value)) |
|---|
| 579 | | return warnInvalid(theForm.pager, msgInvalidPager); |
|---|
| 580 | | |
|---|
| 581 | | defaultEmptyOK = false; |
|---|
| 582 | | if (isEmpty(theForm.vmcontext.value) || isWhitespace(theForm.vmcontext.value)) |
|---|
| 583 | | return warnInvalid(theForm.vmcontext, msgInvalidVMContext); |
|---|
| 584 | | |
|---|
| 585 | | } |
|---|
| 586 | | |
|---|
| 587 | | if (theForm.secret != undefined && isEmpty(theForm.secret.value)) { |
|---|
| 588 | | var cnf = confirm(msgConfirmSecret); |
|---|
| 589 | | if (!cnf) { |
|---|
| 590 | | theForm.secret.focus(); |
|---|
| 591 | | return false; |
|---|
| 592 | | } |
|---|
| 593 | | } |
|---|
| 594 | | |
|---|
| 595 | | return true; |
|---|
| 596 | | } |
|---|
| 597 | | |
|---|
| 598 | | function checkVoicemail(theForm) { |
|---|
| 599 | | $vm = theForm.elements["vm"].value; |
|---|
| 600 | | if ($vm == 'disabled') { |
|---|
| 601 | | document.getElementById('voicemail').style.display='none'; |
|---|
| 602 | | theForm.vmpwd.value = ''; |
|---|
| 603 | | theForm.email.value = ''; |
|---|
| 604 | | theForm.pager.value = ''; |
|---|
| 605 | | } else { |
|---|
| 606 | | document.getElementById('voicemail').style.display='block'; |
|---|
| 607 | | } |
|---|
| 608 | | } |
|---|
| 609 | | |
|---|
| 610 | | //--> |
|---|
| 611 | | </script> |
|---|
| 612 | | |
|---|
| 613 | | </form> |
|---|
| 614 | | <?php |
|---|
| 615 | | } //end if action == delGRP |
|---|
| 616 | | |
|---|
| 617 | | |
|---|
| 618 | | ?> |
|---|
| 619 | | |
|---|
| 620 | | |
|---|