| 1 |
<?php /* $Id: page.findmefollow.php 1197 2006-03-19 17:59:02Z mheydon1973 $ */ |
|---|
| 2 |
//Copyright (C) 2006 Philippe Lindheimer (p_lindheimer at yahoo dot com) |
|---|
| 3 |
// |
|---|
| 4 |
//This program is free software; you can redistribute it and/or |
|---|
| 5 |
//modify it under the terms of the GNU General Public License |
|---|
| 6 |
//as published by the Free Software Foundation; either version 2 |
|---|
| 7 |
//of the License, or (at your option) any later version. |
|---|
| 8 |
// |
|---|
| 9 |
//This program is distributed in the hope that it will be useful, |
|---|
| 10 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 |
//GNU General Public License for more details. |
|---|
| 13 |
|
|---|
| 14 |
$tabindex = 0; |
|---|
| 15 |
|
|---|
| 16 |
$dispnum = 'findmefollow'; //used for switch on config.php |
|---|
| 17 |
|
|---|
| 18 |
isset($_REQUEST['action'])?$action = $_REQUEST['action']:$action=''; |
|---|
| 19 |
//the extension we are currently displaying |
|---|
| 20 |
isset($_REQUEST['extdisplay'])?$extdisplay=$_REQUEST['extdisplay']:$extdisplay=''; |
|---|
| 21 |
isset($_REQUEST['account'])?$account = $_REQUEST['account']:$account=''; |
|---|
| 22 |
isset($_REQUEST['grptime'])?$grptime = $_REQUEST['grptime']:$grptime=''; |
|---|
| 23 |
isset($_REQUEST['grppre'])?$grppre = $_REQUEST['grppre']:$grppre=''; |
|---|
| 24 |
isset($_REQUEST['strategy'])?$strategy = $_REQUEST['strategy']:$strategy=''; |
|---|
| 25 |
isset($_REQUEST['annmsg_id'])?$annmsg_id = $_REQUEST['annmsg_id']:$annmsg_id=''; |
|---|
| 26 |
isset($_REQUEST['dring'])?$dring = $_REQUEST['dring']:$dring=''; |
|---|
| 27 |
isset($_REQUEST['needsconf'])?$needsconf = $_REQUEST['needsconf']:$needsconf=''; |
|---|
| 28 |
isset($_REQUEST['remotealert_id'])?$remotealert_id = $_REQUEST['remotealert_id']:$remotealert_id=''; |
|---|
| 29 |
isset($_REQUEST['toolate_id'])?$toolate_id = $_REQUEST['toolate_id']:$toolate_id=''; |
|---|
| 30 |
isset($_REQUEST['ringing'])?$ringing = $_REQUEST['ringing']:$ringing=''; |
|---|
| 31 |
isset($_REQUEST['pre_ring'])?$pre_ring = $_REQUEST['pre_ring']:$pre_ring='0'; |
|---|
| 32 |
isset($_REQUEST['ddial'])?$ddial = $_REQUEST['ddial']:$ddial=''; |
|---|
| 33 |
isset($_REQUEST['changecid'])?$changecid = $_REQUEST['changecid']:$changecid='default'; |
|---|
| 34 |
isset($_REQUEST['fixedcid'])?$fixedcid = $_REQUEST['fixedcid']:$fixedcid=''; |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { |
|---|
| 38 |
$goto = $_REQUEST[$_REQUEST['goto0']."0"]; |
|---|
| 39 |
} else { |
|---|
| 40 |
$goto = ''; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
if (isset($_REQUEST["grplist"])) { |
|---|
| 45 |
$grplist = explode("\n",$_REQUEST["grplist"]); |
|---|
| 46 |
|
|---|
| 47 |
if (!$grplist) { |
|---|
| 48 |
$grplist = null; |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
foreach (array_keys($grplist) as $key) { |
|---|
| 52 |
//trim it |
|---|
| 53 |
$grplist[$key] = trim($grplist[$key]); |
|---|
| 54 |
|
|---|
| 55 |
// remove invalid chars |
|---|
| 56 |
$grplist[$key] = preg_replace("/[^0-9#*]/", "", $grplist[$key]); |
|---|
| 57 |
|
|---|
| 58 |
if ($grplist[$key] == ltrim($extdisplay,'GRP-').'#') |
|---|
| 59 |
$grplist[$key] = rtrim($grplist[$key],'#'); |
|---|
| 60 |
|
|---|
| 61 |
// remove blanks |
|---|
| 62 |
if ($grplist[$key] == "") unset($grplist[$key]); |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
// check for duplicates, and re-sequence |
|---|
| 66 |
$grplist = array_values(array_unique($grplist)); |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
// do if we are submitting a form |
|---|
| 70 |
if(isset($_POST['action'])){ |
|---|
| 71 |
//check if the extension is within range for this user |
|---|
| 72 |
if (isset($account) && !checkRange($account)){ |
|---|
| 73 |
echo "<script>javascript:alert('". _("Warning! Extension")." ".$account." "._("is not allowed for your account").".');</script>"; |
|---|
| 74 |
} else { |
|---|
| 75 |
//add group |
|---|
| 76 |
if ($action == 'addGRP') { |
|---|
| 77 |
findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid,$fixedcid); |
|---|
| 78 |
|
|---|
| 79 |
needreload(); |
|---|
| 80 |
redirect_standard(); |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
//del group |
|---|
| 84 |
if ($action == 'delGRP') { |
|---|
| 85 |
findmefollow_del($account); |
|---|
| 86 |
needreload(); |
|---|
| 87 |
redirect_standard(); |
|---|
| 88 |
} |
|---|
| 89 |
|
|---|
| 90 |
//edit group - just delete and then re-add the extension |
|---|
| 91 |
if ($action == 'edtGRP') { |
|---|
| 92 |
findmefollow_del($account); |
|---|
| 93 |
findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid,$fixedcid); |
|---|
| 94 |
|
|---|
| 95 |
needreload(); |
|---|
| 96 |
redirect_standard('extdisplay'); |
|---|
| 97 |
} |
|---|
| 98 |
} |
|---|
| 99 |
} |
|---|
| 100 |
?> |
|---|
| 101 |
</div> |
|---|
| 102 |
|
|---|
| 103 |
<div class="rnav"><ul> |
|---|
| 104 |
<?php |
|---|
| 105 |
//get unique ring groups |
|---|
| 106 |
$gresults = findmefollow_allusers(); |
|---|
| 107 |
$set_users = findmefollow_list(); |
|---|
| 108 |
|
|---|
| 109 |
if (isset($gresults)) { |
|---|
| 110 |
foreach ($gresults as $gresult) { |
|---|
| 111 |
$defined = is_array($set_users) ? (in_array($gresult[0], $set_users) ? "(edit)" : "(add)") : "add"; |
|---|
| 112 |
echo "<li><a class=\"".($extdisplay=='GRP-'.$gresult[0] ? 'current':'')."\" href=\"config.php?display=".urlencode($dispnum)."&extdisplay=".urlencode("GRP-".$gresult[0])."\">"._("$gresult[1]")." <{$gresult[0]}> $defined </a></li>"; |
|---|
| 113 |
|
|---|
| 114 |
} |
|---|
| 115 |
} |
|---|
| 116 |
?> |
|---|
| 117 |
</ul></div> |
|---|
| 118 |
|
|---|
| 119 |
<div class="content"> |
|---|
| 120 |
<?php |
|---|
| 121 |
|
|---|
| 122 |
if ($extdisplay == "") { |
|---|
| 123 |
echo '<br><h2>'._("Follow Me").'</h2><br><h3>'._('Choose a user/extension:').'</h3><br><br><br><br><br><br><br>'; |
|---|
| 124 |
} |
|---|
| 125 |
elseif ($action == 'delGRP') { |
|---|
| 126 |
echo '<br><h3>'._("Follow Me").' '.$account.' '._("deleted").'!</h3><br><br><br><br><br><br><br><br>'; |
|---|
| 127 |
} else { |
|---|
| 128 |
if ($extdisplay != "") { |
|---|
| 129 |
// We need to populate grplist with the existing extension list. |
|---|
| 130 |
$extdisplay = ltrim($extdisplay,'GRP-'); |
|---|
| 131 |
|
|---|
| 132 |
$thisgrp = findmefollow_get($extdisplay, 1); |
|---|
| 133 |
$grpliststr = isset($thisgrp['grplist']) ? $thisgrp['grplist'] : ''; |
|---|
| 134 |
$grplist = explode("-", $grpliststr); |
|---|
| 135 |
|
|---|
| 136 |
$strategy = isset($thisgrp['strategy']) ? $thisgrp['strategy'] : ''; |
|---|
| 137 |
$grppre = isset($thisgrp['grppre']) ? $thisgrp['grppre'] : ''; |
|---|
| 138 |
$grptime = isset($thisgrp['grptime']) ? $thisgrp['grptime'] : ''; |
|---|
| 139 |
$annmsg_id = isset($thisgrp['annmsg_id']) ? $thisgrp['annmsg_id'] : ''; |
|---|
| 140 |
$dring = isset($thisgrp['dring']) ? $thisgrp['dring'] : ''; |
|---|
| 141 |
$remotealert_id = isset($thisgrp['remotealert_id']) ? $thisgrp['remotealert_id'] : ''; |
|---|
| 142 |
$needsconf = isset($thisgrp['needsconf']) ? $thisgrp['needsconf'] : ''; |
|---|
| 143 |
$toolate_id = isset($thisgrp['toolate_id']) ? $thisgrp['toolate_id'] : ''; |
|---|
| 144 |
$ringing = isset($thisgrp['ringing']) ? $thisgrp['ringing'] : ''; |
|---|
| 145 |
$pre_ring = isset($thisgrp['pre_ring']) ? $thisgrp['pre_ring'] : ''; |
|---|
| 146 |
$ddial = isset($thisgrp['ddial']) ? $thisgrp['ddial'] : ''; |
|---|
| 147 |
$changecid = isset($thisgrp['changecid']) ? $thisgrp['changecid'] : 'default'; |
|---|
| 148 |
$fixedcid = isset($thisgrp['fixedcid']) ? $thisgrp['fixedcid'] : ''; |
|---|
| 149 |
$goto = isset($thisgrp['postdest'])?$thisgrp['postdest']:((isset($thisgrp['voicemail']) && $thisgrp['voicemail'] != 'novm')?"ext-local,vmu$extdisplay,1":''); |
|---|
| 150 |
unset($grpliststr); |
|---|
| 151 |
unset($thisgrp); |
|---|
| 152 |
|
|---|
| 153 |
$delButton = " |
|---|
| 154 |
<form name=delete action=\"{$_SERVER['PHP_SELF']}\" method=POST> |
|---|
| 155 |
<input type=\"hidden\" name=\"display\" value=\"{$dispnum}\"> |
|---|
| 156 |
<input type=\"hidden\" name=\"account\" value=\"{$extdisplay}\"> |
|---|
| 157 |
<input type=\"hidden\" name=\"action\" value=\"delGRP\"> |
|---|
| 158 |
<input type=submit value=\""._("Delete Entries")."\"> |
|---|
| 159 |
</form>"; |
|---|
| 160 |
|
|---|
| 161 |
echo "<h2>"._("Follow Me").": ".$extdisplay."</h2>"; |
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
// Copied straight out of old code,let's see if it works? |
|---|
| 165 |
// |
|---|
| 166 |
if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) { |
|---|
| 167 |
$editURL = $_SERVER['PHP_SELF'].'?display=users&extdisplay='.$extdisplay; |
|---|
| 168 |
$EXTorUSER = _("User"); |
|---|
| 169 |
} |
|---|
| 170 |
else { |
|---|
| 171 |
$editURL = $_SERVER['PHP_SELF'].'?display=extensions&extdisplay='.$extdisplay; |
|---|
| 172 |
$EXTorUSER = _("Extension"); |
|---|
| 173 |
} |
|---|
| 174 |
|
|---|
| 175 |
$label = '<span><img width="16" height="16" border="0" title="'.sprintf(_("Edit %s"),$EXTorUSER).'" alt="" src="images/user_edit.png"/> '.sprintf(_("Edit %s %s"),$EXTorUSER, $extdisplay).'</span>'; |
|---|
| 176 |
echo "<p><a href=".$editURL.">".$label."</a></p>"; |
|---|
| 177 |
echo "<p>".$delButton."</p>"; |
|---|
| 178 |
} |
|---|
| 179 |
?> |
|---|
| 180 |
<form name="editGRP" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkGRP(editGRP);"> |
|---|
| 181 |
<input type="hidden" name="display" value="<?php echo $dispnum?>"> |
|---|
| 182 |
<input type="hidden" name="action" value="<?php echo (($extdisplay != "") ? 'edtGRP' : 'addGRP'); ?>"> |
|---|
| 183 |
<table> |
|---|
| 184 |
<tr><td colspan="2"><h5><?php echo (($extdisplay != "") ? _("Edit Follow Me") : _("Add Follow Me")) ?><hr></h5></td></tr> |
|---|
| 185 |
<tr> |
|---|
| 186 |
<?php |
|---|
| 187 |
if ($extdisplay != "") { |
|---|
| 188 |
|
|---|
| 189 |
?> |
|---|
| 190 |
<input size="5" type="hidden" name="account" value="<?php echo $extdisplay; ?>"> |
|---|
| 191 |
<?php } else { ?> |
|---|
| 192 |
<td><a href="#" class="info"><?php echo _("group number")?>:<span><?php echo _("The number users will dial to ring extensions in this ring group")?></span></a></td> |
|---|
| 193 |
<td><input size="5" type="text" name="account" value="<?php echo $gresult[0] + 1; ?>"></td> |
|---|
| 194 |
<?php } ?> |
|---|
| 195 |
</tr> |
|---|
| 196 |
|
|---|
| 197 |
<tr> |
|---|
| 198 |
<td><a href="#" class="info"><?php echo _("Disable")?><span><?php echo _('By default (not checked) any call to this extension will go to this Follow-Me instead, including directory calls by name from IVRs. If checked, calls will go only to the extension.<BR>However, destinations that specify FollowMe will come here.<BR>Checking this box is often used in conjunction with VmX Locater, where you want a call to ring the extension, and then only if the caller chooses to find you do you want it to come here.')?></span></a>:</td> |
|---|
| 199 |
<td><input type="checkbox" name="ddial" value="CHECKED" <?php echo $ddial ?> tabindex="<?php echo ++$tabindex;?>"/></td> |
|---|
| 200 |
</tr> |
|---|
| 201 |
|
|---|
| 202 |
<tr> |
|---|
| 203 |
<td><a href="#" class="info"><?php echo _("Initial Ring Time:")?> |
|---|
| 204 |
<span><?php echo _("This is the number of seconds to ring the primary extension prior to proceeding to the follow-me list. The extension can also be included in the follow-me list. A 0 setting will bypass this.")?> |
|---|
| 205 |
</span></a> |
|---|
| 206 |
</td> |
|---|
| 207 |
<td> |
|---|
| 208 |
<select name="pre_ring" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 209 |
<?php |
|---|
| 210 |
$default = (isset($pre_ring) ? $pre_ring : 0); |
|---|
| 211 |
for ($i=0; $i <= 60; $i++) { |
|---|
| 212 |
echo '<option value="'.$i.'" '.($i == $default ? 'SELECTED' : '').'>'.$i.'</option>'; |
|---|
| 213 |
} |
|---|
| 214 |
?> |
|---|
| 215 |
</select> |
|---|
| 216 |
</td> |
|---|
| 217 |
</tr> |
|---|
| 218 |
|
|---|
| 219 |
<tr> |
|---|
| 220 |
<td> |
|---|
| 221 |
<a href="#" class="info"><?php echo _("Ring Strategy:")?> |
|---|
| 222 |
<span> |
|---|
| 223 |
<b><?php echo _("ringallv2")?></b>: <?php echo _("ring primary extension for initial ring time followed by all additional extensions until one answers")?><br> |
|---|
| 224 |
<b><?php echo _("ringall")?></b>: <?php echo _("ring all available channels until one answers (default)")?><br> |
|---|
| 225 |
<b><?php echo _("hunt")?></b>: <?php echo _("take turns ringing each available extension")?><br> |
|---|
| 226 |
<b><?php echo _("memoryhunt")?></b>: <?php echo _("ring first extension in the list, then ring the 1st and 2nd extension, then ring 1st 2nd and 3rd extension in the list.... etc.")?><br> |
|---|
| 227 |
<b><?php echo _("*-prim")?></b>: <?php echo _("these modes act as described above. However, if the primary extension (first in list) is occupied, the other extensions will not be rung. If the primary is FreePBX DND, it won't be rung. If the primary is FreePBX CF unconditional, then all will be rung")?><br> |
|---|
| 228 |
<b><?php echo _("firstavailable")?></b>: <?php echo _("ring only the first available channel")?><br> |
|---|
| 229 |
<b><?php echo _("firstnotonphone")?></b>: <?php echo _("ring only the first channel which is not off hook - ignore CW")?><br> |
|---|
| 230 |
</span> |
|---|
| 231 |
</a> |
|---|
| 232 |
</td> |
|---|
| 233 |
<td> |
|---|
| 234 |
<select name="strategy" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 235 |
<?php |
|---|
| 236 |
$default = (isset($strategy) ? $strategy : 'ringall'); |
|---|
| 237 |
$items = array('ringallv2','ringallv2-prim','ringall','ringall-prim','hunt','hunt-prim','memoryhunt','memoryhunt-prim','firstavailable','firstnotonphone'); |
|---|
| 238 |
foreach ($items as $item) { |
|---|
| 239 |
echo '<option value="'.$item.'" '.($default == $item ? 'SELECTED' : '').'>'._($item); |
|---|
| 240 |
} |
|---|
| 241 |
?> |
|---|
| 242 |
</select> |
|---|
| 243 |
</td> |
|---|
| 244 |
</tr> |
|---|
| 245 |
|
|---|
| 246 |
<tr> |
|---|
| 247 |
<td> |
|---|
| 248 |
<a href=# class="info"><?php echo _("Ring Time (max 60 sec)")?> |
|---|
| 249 |
<span> |
|---|
| 250 |
<?php echo _("Time in seconds that the phones will ring. For all hunt style ring strategies, this is the time for each iteration of phone(s) that are rung")?> |
|---|
| 251 |
</span> |
|---|
| 252 |
</a> |
|---|
| 253 |
</td> |
|---|
| 254 |
<td><input size="4" type="text" name="grptime" value="<?php echo $grptime?$grptime:20 ?>" tabindex="<?php echo ++$tabindex;?>"></td> |
|---|
| 255 |
</tr> |
|---|
| 256 |
|
|---|
| 257 |
<tr> |
|---|
| 258 |
<td valign="top"><a href="#" class="info"><?php echo _("Follow-Me List")?>:<span><br><?php echo _("List extensions to ring, one per line, or use the Extension Quick Pick below.<br><br>You can include an extension on a remote system, or an external number by suffixing a number with a pound (#). ex: 2448089# would dial 2448089 on the appropriate trunk (see Outbound Routing).")?><br><br></span></a></td> |
|---|
| 259 |
<td valign="top"> |
|---|
| 260 |
<?php |
|---|
| 261 |
$rows = count($grplist)+1; |
|---|
| 262 |
if ($rows <= 2 && trim($grplist[0]) == "") { |
|---|
| 263 |
$grplist[0] = $extdisplay; |
|---|
| 264 |
} |
|---|
| 265 |
($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows); |
|---|
| 266 |
?> |
|---|
| 267 |
<textarea id="grplist" cols="15" rows="<?php echo $rows ?>" name="grplist" tabindex="<?php echo ++$tabindex;?>"><?php echo implode("\n",$grplist);?></textarea> |
|---|
| 268 |
</td> |
|---|
| 269 |
</tr> |
|---|
| 270 |
|
|---|
| 271 |
<tr> |
|---|
| 272 |
<td> |
|---|
| 273 |
<a href=# class="info"><?php echo _("Extension Quick Pick")?> |
|---|
| 274 |
<span> |
|---|
| 275 |
<?php echo _("Choose an extension to append to the end of the extension list above.")?> |
|---|
| 276 |
</span> |
|---|
| 277 |
</a> |
|---|
| 278 |
</td> |
|---|
| 279 |
<td> |
|---|
| 280 |
<select onChange="insertExten();" id="insexten" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 281 |
<option value=""><?php echo _("(pick extension)")?></option> |
|---|
| 282 |
<?php |
|---|
| 283 |
$results = core_users_list(); |
|---|
| 284 |
foreach ($results as $result) { |
|---|
| 285 |
echo "<option value='".$result[0]."'>".$result[0]." (".$result[1].")</option>\n"; |
|---|
| 286 |
} |
|---|
| 287 |
?> |
|---|
| 288 |
</select> |
|---|
| 289 |
</td> |
|---|
| 290 |
</tr> |
|---|
| 291 |
|
|---|
| 292 |
<?php if(function_exists('recordings_list')) { //only include if recordings is enabled?> |
|---|
| 293 |
<tr> |
|---|
| 294 |
<td><a href="#" class="info"><?php echo _("Announcement:")?><span><?php echo _("Message to be played to the caller before dialing this group.<br><br>To add additional recordings please use the \"System Recordings\" MENU to the left")?></span></a></td> |
|---|
| 295 |
<td> |
|---|
| 296 |
<select name="annmsg_id" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 297 |
<?php |
|---|
| 298 |
$tresults = recordings_list(); |
|---|
| 299 |
$default = (isset($annmsg_id) ? $annmsg_id : ''); |
|---|
| 300 |
echo '<option value="">'._("None"); |
|---|
| 301 |
if (isset($tresults)) { |
|---|
| 302 |
foreach ($tresults as $tresult) { |
|---|
| 303 |
echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; |
|---|
| 304 |
} |
|---|
| 305 |
} |
|---|
| 306 |
?> |
|---|
| 307 |
</select> |
|---|
| 308 |
</td> |
|---|
| 309 |
</tr> |
|---|
| 310 |
<?php } else { ?> |
|---|
| 311 |
<tr> |
|---|
| 312 |
<td><a href="#" class="info"><?php echo _("Announcement:")?><span><?php echo _("Message to be played to the caller before dialing this group.<br><br>You must install and enable the \"Systems Recordings\" Module to edit this option")?></span></a></td> |
|---|
| 313 |
<td> |
|---|
| 314 |
<?php |
|---|
| 315 |
$default = (isset($annmsg_id) ? $annmsg_id : ''); |
|---|
| 316 |
?> |
|---|
| 317 |
<input type="hidden" name="annmsg_id" value="<?php echo $default; ?>"><?php echo ($default != '' ? $default : 'None'); ?> |
|---|
| 318 |
</td> |
|---|
| 319 |
</tr> |
|---|
| 320 |
|
|---|
| 321 |
<?php } if (function_exists('music_list')) { ?> |
|---|
| 322 |
<tr> |
|---|
| 323 |
<td><a href="#" class="info"><?php echo _("Play Music On Hold?")?><span><?php echo _("If you select a Music on Hold class to play, instead of 'Ring', they will hear that instead of Ringing while they are waiting for someone to pick up.")?></span></a></td> |
|---|
| 324 |
<td> |
|---|
| 325 |
<select name="ringing" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 326 |
<?php |
|---|
| 327 |
$tresults = music_list(); |
|---|
| 328 |
$cur = (isset($ringing) ? $ringing : 'Ring'); |
|---|
| 329 |
echo '<option value="Ring">'._("Ring")."</option>"; |
|---|
| 330 |
if (isset($tresults[0])) { |
|---|
| 331 |
foreach ($tresults as $tresult) { |
|---|
| 332 |
echo '<option value="'.$tresult.'"'.($tresult == $cur ? ' SELECTED' : '').'>'.$tresult."</option>\n"; |
|---|
| 333 |
} |
|---|
| 334 |
} |
|---|
| 335 |
?> |
|---|
| 336 |
</select> |
|---|
| 337 |
</td> |
|---|
| 338 |
</tr> |
|---|
| 339 |
<?php } ?> |
|---|
| 340 |
|
|---|
| 341 |
<tr> |
|---|
| 342 |
<td><a href="#" class="info"><?php echo _("CID Name Prefix")?>:<span><?php echo _('You can optionally prefix the Caller ID name when ringing extensions in this group. ie: If you prefix with "Sales:", a call from John Doe would display as "Sales:John Doe" on the extensions that ring.')?></span></a></td> |
|---|
| 343 |
<td><input size="4" type="text" name="grppre" value="<?php echo $grppre ?>" tabindex="<?php echo ++$tabindex;?>"></td> |
|---|
| 344 |
</tr> |
|---|
| 345 |
|
|---|
| 346 |
<tr> |
|---|
| 347 |
<td><a href="#" class="info"><?php echo _("Alert Info")?>:<span><?php echo _('You can optionally include an Alert Info which can create distinctive rings on SIP phones.')?></span></a></td> |
|---|
| 348 |
<td><input size="30" type="text" name="dring" value="<?php echo $dring ?>" tabindex="<?php echo ++$tabindex;?>"></td> |
|---|
| 349 |
</tr> |
|---|
| 350 |
|
|---|
| 351 |
<tr><td colspan="2"><h5><?php echo _("Call Confirmation Configuration") ?><hr></h5></td></tr> |
|---|
| 352 |
|
|---|
| 353 |
<tr> |
|---|
| 354 |
<td><a href="#" class="info"><?php echo _("Confirm Calls")?><span><?php echo _('Enable this if you\'re calling external numbers that need confirmation - eg, a mobile phone may go to voicemail which will pick up the call. Enabling this requires the remote side push 1 on their phone before the call is put through. This feature only works with the ringall/ringall-prim ring strategy')?></span></a>:</td> |
|---|
| 355 |
<td> |
|---|
| 356 |
<input type="checkbox" name="needsconf" value="CHECKED" <?php echo $needsconf ?> tabindex="<?php echo ++$tabindex;?>"/> |
|---|
| 357 |
</td> |
|---|
| 358 |
</tr> |
|---|
| 359 |
|
|---|
| 360 |
<?php if(function_exists('recordings_list')) { //only include if recordings is enabled?> |
|---|
| 361 |
<tr> |
|---|
| 362 |
<td><a href="#" class="info"><?php echo _("Remote Announce:")?><span><?php echo _("Message to be played to the person RECEIVING the call, if 'Confirm Calls' is enabled.<br><br>To add additional recordings use the \"System Recordings\" MENU to the left")?></span></a></td> |
|---|
| 363 |
<td> |
|---|
| 364 |
<select name="remotealert_id" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 365 |
<?php |
|---|
| 366 |
$tresults = recordings_list(); |
|---|
| 367 |
$default = (isset($remotealert_id) ? $remotealert_id : ''); |
|---|
| 368 |
echo '<option value="">'._("Default")."</option>"; |
|---|
| 369 |
if (isset($tresults[0])) { |
|---|
| 370 |
foreach ($tresults as $tresult) { |
|---|
| 371 |
echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; |
|---|
| 372 |
} |
|---|
| 373 |
} |
|---|
| 374 |
?> |
|---|
| 375 |
</select> |
|---|
| 376 |
</td> |
|---|
| 377 |
</tr> |
|---|
| 378 |
<tr> |
|---|
| 379 |
<td><a href="#" class="info"><?php echo _("Too-Late Announce:")?><span><?php echo _("Message to be played to the person RECEIVING the call, if the call has already been accepted before they push 1.<br><br>To add additional recordings use the \"System Recordings\" MENU to the left")?></span></a></td> |
|---|
| 380 |
<td> |
|---|
| 381 |
<select name="toolate_id" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 382 |
<?php |
|---|
| 383 |
$tresults = recordings_list(); |
|---|
| 384 |
$default = (isset($toolate_id) ? $toolate_id : ''); |
|---|
| 385 |
echo '<option value="">'._("Default")."</option>"; |
|---|
| 386 |
if (isset($tresults[0])) { |
|---|
| 387 |
foreach ($tresults as $tresult) { |
|---|
| 388 |
echo '<option value="'.$tresult['id'].'"'.($tresult['id'] == $default ? ' SELECTED' : '').'>'.$tresult['displayname']."</option>\n"; |
|---|
| 389 |
} |
|---|
| 390 |
} |
|---|
| 391 |
?> |
|---|
| 392 |
</select> |
|---|
| 393 |
</td> |
|---|
| 394 |
</tr> |
|---|
| 395 |
<?php } ?> |
|---|
| 396 |
|
|---|
| 397 |
<tr><td colspan="2"><h5><?php echo _("Change External CID Configuration") ?><hr></h5></td></tr> |
|---|
| 398 |
<tr> |
|---|
| 399 |
<td> |
|---|
| 400 |
<a href="#" class="info"><?php echo _("Mode")?>: |
|---|
| 401 |
<span> |
|---|
| 402 |
<b><?php echo _("Default")?></b>: <?php echo _("Transmits the Callers CID if allowed by the trunk.")?><br> |
|---|
| 403 |
<b><?php echo _("Fixed CID Value")?></b>: <?php echo _("Always transmit the Fixed CID Value below.")?><br> |
|---|
| 404 |
<b><?php echo _("Outside Calls Fixed CID Value")?></b>: <?php echo _("Transmit the Fixed CID Value below on calls that come in from outside only. Internal extension to extension calls will continue to operate in default mode.")?><br> |
|---|
| 405 |
<b><?php echo _("Use Dialed Number")?></b>: <?php echo _("Transmit the number that was dialed as the CID for calls coming from outside. Internal extension to extension calls will continue to operate in default mode. There must be a DID on the inbound route for this. This will be BLOCKED on trunks that block foreign callerid")?><br> |
|---|
| 406 |
<b><?php echo _("Force Dialed Number")?></b>: <?php echo _("Transmit the number that was dialed as the CID for calls coming from outside. Internal extension to extension calls will continue to operate in default mode. There must be a DID on the inbound route for this. This WILL be transmitted on trunks that block foreign callerid")?><br> |
|---|
| 407 |
</span> |
|---|
| 408 |
</a> |
|---|
| 409 |
</td> |
|---|
| 410 |
<td> |
|---|
| 411 |
<select name="changecid" id="changecid" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 412 |
<?php |
|---|
| 413 |
$default = (isset($changecid) ? $changecid : 'default'); |
|---|
| 414 |
echo '<option value="default" '.($default == 'default' ? 'SELECTED' : '').'>'._("Default"); |
|---|
| 415 |
echo '<option value="fixed" '.($default == 'fixed' ? 'SELECTED' : '').'>'._("Fixed CID Value"); |
|---|
| 416 |
echo '<option value="extern" '.($default == 'extern' ? 'SELECTED' : '').'>'._("Outside Calls Fixed CID Value"); |
|---|
| 417 |
echo '<option value="did" '.($default == 'did' ? 'SELECTED' : '').'>'._("Use Dialed Number"); |
|---|
| 418 |
echo '<option value="forcedid" '.($default == 'forcedid' ? 'SELECTED' : '').'>'._("Force Dialed Number"); |
|---|
| 419 |
$fixedcid_disabled = ($default != 'fixed' && $default != 'extern') ? 'disabled = "disabled"':''; |
|---|
| 420 |
?> |
|---|
| 421 |
</select> |
|---|
| 422 |
</td> |
|---|
| 423 |
</tr> |
|---|
| 424 |
|
|---|
| 425 |
<tr> |
|---|
| 426 |
<td><a href="#" class="info"><?php echo _("Fixed CID Value")?>:<span><?php echo _('Fixed value to replace the CID with used with some of the modes above. Should be in a format of digits only with an option of E164 format using a leading "+".')?></span></a></td> |
|---|
| 427 |
<td><input size="30" type="text" name="fixedcid" id="fixedcid" value="<?php echo $fixedcid ?>" tabindex="<?php echo ++$tabindex;?>" <?php echo $fixedcid_disabled ?>></td> |
|---|
| 428 |
</tr> |
|---|
| 429 |
|
|---|
| 430 |
<tr><td colspan="2"><br><h5><?php echo _("Destination if no answer")?>:<hr></h5></td></tr> |
|---|
| 431 |
|
|---|
| 432 |
<?php |
|---|
| 433 |
//draw goto selects |
|---|
| 434 |
echo drawselects($goto,0); |
|---|
| 435 |
?> |
|---|
| 436 |
|
|---|
| 437 |
<tr> |
|---|
| 438 |
<td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td> |
|---|
| 439 |
|
|---|
| 440 |
</tr> |
|---|
| 441 |
</table> |
|---|
| 442 |
</form> |
|---|
| 443 |
<?php |
|---|
| 444 |
} //end if action == delGRP |
|---|
| 445 |
|
|---|
| 446 |
?> |
|---|
| 447 |
<script language="javascript"> |
|---|
| 448 |
<!-- |
|---|
| 449 |
|
|---|
| 450 |
$(document).ready(function(){ |
|---|
| 451 |
$("#changecid").change(function(){ |
|---|
| 452 |
state = (this.value == "fixed" || this.value == "extern") ? "" : "disabled"; |
|---|
| 453 |
$("#fixedcid").attr("disabled",state); |
|---|
| 454 |
}); |
|---|
| 455 |
}); |
|---|
| 456 |
|
|---|
| 457 |
function insertExten() { |
|---|
| 458 |
exten = document.getElementById('insexten').value; |
|---|
| 459 |
|
|---|
| 460 |
grpList=document.getElementById('grplist'); |
|---|
| 461 |
if (grpList.value[ grpList.value.length - 1 ] == "\n") { |
|---|
| 462 |
grpList.value = grpList.value + exten; |
|---|
| 463 |
} else { |
|---|
| 464 |
grpList.value = grpList.value + '\n' + exten; |
|---|
| 465 |
} |
|---|
| 466 |
|
|---|
| 467 |
// reset element |
|---|
| 468 |
document.getElementById('insexten').value = ''; |
|---|
| 469 |
} |
|---|
| 470 |
|
|---|
| 471 |
function checkGRP(theForm) { |
|---|
| 472 |
var msgInvalidExtList = "<?php echo _('Please enter an extension list.'); ?>"; |
|---|
| 473 |
var msgInvalidTime = "<?php echo _('Invalid time specified'); ?>"; |
|---|
| 474 |
var msgInvalidGrpTimeRange = "<?php echo _('Time must be between 1 and 60 seconds'); ?>"; |
|---|
| 475 |
var msgInvalidRingStrategy = "<?php echo _('Only ringall, ringallv2, hunt and the respective -prim versions are supported when confirmation is checked'); ?>"; |
|---|
| 476 |
var msgInvalidCID = "<?php echo _('Invalid CID Number. Must be in a format of digits only with an option of E164 format using a leading "+"'); ?>"; |
|---|
| 477 |
|
|---|
| 478 |
// set up the Destination stuff |
|---|
| 479 |
setDestinations(theForm, 1); |
|---|
| 480 |
|
|---|
| 481 |
// form validation |
|---|
| 482 |
defaultEmptyOK = false; |
|---|
| 483 |
if (isEmpty(theForm.grplist.value)) |
|---|
| 484 |
return warnInvalid(theForm.grplist, msgInvalidExtList); |
|---|
| 485 |
|
|---|
| 486 |
if (!theForm.fixedcid.disabled) { |
|---|
| 487 |
fixedcid = $.trim(theForm.fixedcid.value); |
|---|
| 488 |
if (!fixedcid.match('^[+]{0,1}[0-9]+$')) { |
|---|
| 489 |
return warnInvalid(theForm.fixedcid, msgInvalidCID); |
|---|
| 490 |
} |
|---|
| 491 |
} |
|---|
| 492 |
|
|---|
| 493 |
if (!isInteger(theForm.grptime.value)) { |
|---|
| 494 |
return warnInvalid(theForm.grptime, msgInvalidTime); |
|---|
| 495 |
} else { |
|---|
| 496 |
var grptimeVal = theForm.grptime.value; |
|---|
| 497 |
if (grptimeVal < 1 || grptimeVal > 60) |
|---|
| 498 |
return warnInvalid(theForm.grptime, msgInvalidGrpTimeRange); |
|---|
| 499 |
} |
|---|
| 500 |
|
|---|
| 501 |
if (theForm.needsconf.checked && (theForm.strategy.value.substring(0,7) != "ringall" && theForm.strategy.value.substring(0,4) != "hunt")) { |
|---|
| 502 |
return warnInvalid(theForm.needsconf, msgInvalidRingStrategy); |
|---|
| 503 |
} |
|---|
| 504 |
|
|---|
| 505 |
defaultEmptyOK = true; |
|---|
| 506 |
|
|---|
| 507 |
if (!validateDestinations(theForm, 1, true)) |
|---|
| 508 |
return false; |
|---|
| 509 |
|
|---|
| 510 |
return true; |
|---|
| 511 |
} |
|---|
| 512 |
//--> |
|---|
| 513 |
</script> |
|---|