root/freepbx/branches/2.2/amp_conf/htdocs/admin/modules/core/page.general.php

Revision 3870, 11.5 kB (checked in by p_lindheimer, 6 years ago)

warn users when setting the 'r' option in the outbound dial command options. We should probably do something atupgrade time to detect past systems but for now this is a step in the right direction

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php /* $Id$ */
2 //Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca)
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 $action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
15
16
17 //if submitting form, update database
18 if ($action == 'editglobals') {
19     $globalfields = array(
20                         array($_REQUEST['RINGTIMER'],'RINGTIMER'),
21                         array($_REQUEST['FAX_RX'],'FAX_RX'),
22                         array($_REQUEST['FAX_RX_EMAIL'],'FAX_RX_EMAIL'),
23                         array($_REQUEST['FAX_RX_FROM'],'FAX_RX_FROM'),
24                         array($_REQUEST['DIRECTORY'],'DIRECTORY'),
25                         array($_REQUEST['VM_PREFIX'],'VM_PREFIX'),
26                         array($_REQUEST['VM_DDTYPE'],'VM_DDTYPE'),
27                         array($_REQUEST['VM_GAIN'],'VM_GAIN'),
28                         array($_REQUEST['DIAL_OPTIONS'],'DIAL_OPTIONS'),
29                         array($_REQUEST['TRUNK_OPTIONS'],'TRUNK_OPTIONS'),
30                         array($_REQUEST['TONEZONE'], 'TONEZONE'),
31                         array($_REQUEST['TIMEFORMAT'], 'TIMEFORMAT'),
32                         array($_REQUEST['ALLOW_SIP_ANON'], 'ALLOW_SIP_ANON'),
33                         array($_REQUEST['OPERATOR_XTN'], 'OPERATOR_XTN'),
34                         array(isset($_REQUEST['DIRECTORY_OPTS']) ? $_REQUEST['DIRECTORY_OPTS'] : "",'DIRECTORY_OPTS'),
35                         array(isset($_REQUEST['VM_OPTS']) ? $_REQUEST['VM_OPTS'] : "",'VM_OPTS'),
36                         );
37
38     $compiled = $db->prepare('UPDATE globals SET value = ? WHERE variable = ?');
39     //$compiled = $db->prepare('REPLACE INTO globals (value,variable) VALUES (?, ?)');
40     $result = $db->executeMultiple($compiled,$globalfields);
41     if(DB::IsError($result)) {
42         echo $action.'<br>';
43         die($result->getMessage());
44     }
45     
46     //indicate 'need reload' link in header.php
47     needreload();
48 }
49     
50 //get all rows relating to selected account
51 $sql = "SELECT * FROM globals";
52 $globals = $db->getAll($sql);
53 if(DB::IsError($globals)) {
54 die($globals->getMessage());
55 }
56
57 //create a set of variables that match the items in global[0]
58 foreach ($globals as $global) {
59     ${trim($global[0])} = $global[1];   
60 }
61
62 ?>
63
64 <form name="general" action="config.php" method="post" onsubmit="return general_onsubmit();">
65 <input type="hidden" name="display" value="general"/>
66 <input type="hidden" name="action" value="editglobals"/>
67
68 <h5><?php echo _("Dialing Options")?></h5>
69 <p>
70     <a href=# class="info"><?php echo _("Asterisk Dial command options:")?><span><br>
71 <?php echo _("t: Allow the called user to transfer the call by hitting #")?><br>
72 <?php echo _("T: Allow the calling user to transfer the call by hitting #")?><br>
73 <?php echo _("r: Generate a ringing tone for the calling party")?><br>
74 <?php echo _("w: Allow the called user to start recording after pressing *1 (Asterisk v1.2)")?><br>
75 <?php echo _("W: Allow the calling user to start recording after pressing *1 (Asterisk v1.2)")?><br>
76     </span></a>
77     <input type="text" size="2" name="DIAL_OPTIONS" value="<?php  echo htmlspecialchars($DIAL_OPTIONS)?>"/>
78     <br><br>
79     <a href=# class="info"><?php echo _("Asterisk Outbound Dial command options:")?><span><br>
80 <?php echo _("t: Allow the called user to transfer the call by hitting #")?><br>
81 <?php echo _("T: Allow the calling user to transfer the call by hitting #")?><br>
82 <?php echo _("w: Allow the called user to start recording after pressing *1 (Asterisk v1.2)")?><br>
83 <?php echo _("W: Allow the calling user to start recording after pressing *1 (Asterisk v1.2)")?><br>
84 <?php echo _("r: You SHOULD NOT use this option on outbound trunks")?><br>
85     </span></a>
86     <input type="text" size="2" name="TRUNK_OPTIONS" value="<?php  echo htmlspecialchars($TRUNK_OPTIONS)?>"/>
87 </p>
88
89 <h5><?php echo _("Voicemail")?></h5>
90 <p>
91     <?php echo _("Number of seconds to ring phones before sending callers to voicemail:")?>
92     <input type="text" size="2" name="RINGTIMER" value="<?php  echo htmlspecialchars($RINGTIMER)?>"/>
93     <br><br>
94     <?php echo _("Extension prefix for dialing direct to voicemail:")?>
95     <input type="text" size="2" name="VM_PREFIX" value="<?php  echo htmlspecialchars($VM_PREFIX)?>"/>
96     <br><br>
97     <?php echo _("Direct Dial to Voicemail message type:")?>
98     <select name="VM_DDTYPE">
99     <option value=""><?php echo _("Default"); ?></option>
100     <option value="u"<?php if ($VM_DDTYPE == "u") echo " SELECTED"; ?>><?php echo _("Unavailable"); ?></option>
101     <option value="su"<?php if ($VM_DDTYPE == "su") echo " SELECTED"; ?>><?php echo _("Unavailable")."--"._("no instructions"); ?></option>
102     <option value="b"<?php if ($VM_DDTYPE == "b") echo " SELECTED"; ?>><?php echo _("Busy"); ?></option>
103     <option value="sb"<?php if ($VM_DDTYPE == "sb") echo " SELECTED"; ?>><?php echo _("Busy")."--"._("no instructions"); ?></option>
104     <option value="s"<?php if ($VM_DDTYPE == "s") echo " SELECTED"; ?>><?php echo ("No Message"); ?></option>
105     </select>
106     <br><br>
107     <a href=# class="info"><?php echo _("Use gain when recording the voicemail message (optional):")?><span>
108     <?php echo _("Use the specified amount of gain when recording the voicemail message."); ?><br><br>
109     <?php echo _("The units are whole-number decibels (dB)."); ?></span></a>
110     <input type="text" size="2" name="VM_GAIN" value="<?php  echo htmlspecialchars($VM_GAIN)?>"/>
111     <br><br>
112     <input type="checkbox" value="s" name="VM_OPTS" <?php  echo ($VM_OPTS ? 'CHECKED' : '')?>> <a href=# class="info"><?php echo _("Do Not Play")?><span><?php echo _("Check this to remove the default message \"Please leave your message after the tone. When done, hang-up, or press the pound key.\" That is played after the voicemail greeting (the s option). This applies globally to all vm boxes.")?></span></a> <?php echo _("please leave message after tone to caller")?>
113 </p>
114
115 <h5><?php echo _("Company Directory")?></h5>
116 <p>
117     <?php echo _("Find users in the Company Directory by:")?>
118     <select name="DIRECTORY">
119         <option value="first" <?php  echo ($DIRECTORY == 'first' ? 'SELECTED' : '')?>><?php echo _("first name")?>
120         <option value="last" <?php  echo ($DIRECTORY == 'last' ? 'SELECTED' : '')?>><?php echo _("last name")?>
121         <option value="both" <?php  echo ($DIRECTORY == 'both' ? 'SELECTED' : '')?>><?php echo _("first or last name")?>
122     </select>
123     <br><br>
124     <input type="checkbox" value="e" name="DIRECTORY_OPTS" <?php  echo ($DIRECTORY_OPTS ? 'CHECKED' : '')?>> <a href=# class="info"><?php echo _("Play extension number")?><span><?php echo _("Plays a message \"Please hold while I transfer you to extension xxx\" that lets the caller know what extension to use in the future.")?></span></a> <?php echo _("to caller before transferring call")?><br><br>
125     <a href=# class="info"><?php echo _("Operator Extension:")?><span>
126     <?php echo _("When users hit '0' in the directory, they are put through to this number. Note that it"); ?>
127     <?php echo _(" does NOT need to be an extension, it can be a Ring Group, or even an external number."); ?></span></a>
128     <input type="text" size="10" name="OPERATOR_XTN" value="<?php  echo htmlspecialchars($OPERATOR_XTN)?>"/>
129 </p>
130 <h5><?php echo _("Fax Machine")?></h5>
131 <p>
132     <?php echo _("Extension of")?> <a class="info" href="#"><?php echo _("fax machine")?><span><?php echo _("Select 'system' to have the system receive and email faxes.<br>Selecting 'disabled' will result in incoming calls being answered more quickly.")?></span></a> <?php echo _("for receiving faxes:")?>
133     <!--<input type="text" size="8" name="FAX_RX" value="<?php  echo $FAX_RX?>"/>-->
134     <select name="FAX_RX">
135         <option value="disabled" <?php  echo ($FAX_RX == 'disabled' ? 'SELECTED' : '')?>><?php echo _("disabled")?>
136         <option value="system" <?php  echo ($FAX_RX == 'system' ? 'SELECTED' : '')?>><?php echo _("system")?>
137 <?php
138     //get unique devices
139     $devices = core_devices_list();
140     if (isset($devices)) {
141         foreach ($devices as $device) {
142             echo '<option value="'.$device[0].'" '.($FAX_RX == $device[0] ? 'SELECTED' : '').'>'.$device[1].' &lt;'.$device[0].'&gt;';
143         }
144     }
145 ?>    
146     </select>
147    
148 </p>
149 <p>
150     <a class="info" href="#"><?php echo _("Email address")?><span><?php echo _("Email address used if 'system' has been chosen for the fax extension above.")?></span></a> <?php echo _("to have faxes emailed to:")?>
151     <input type="text" size="20" name="FAX_RX_EMAIL" value="<?php  echo htmlspecialchars($FAX_RX_EMAIL)?>"/>
152 </p>
153 <p>
154     <a class="info" href="#"><?php echo _("Email address")?><span><?php echo _("Email address that faxes appear to come from if 'system' has been chosen for the fax extension above.")?></span></a> <?php echo _("that faxes appear to come from:")?>
155     <input type="text" size="20" name="FAX_RX_FROM" value="<?php  echo htmlspecialchars($FAX_RX_FROM)?>"/>
156 </p>
157 <h5><?php echo _("International Settings")?></h5>
158 <p>
159     <?php echo _("Country")?> <a class="info" href="#"><?php echo _("Indications")?><span><?php echo _("Select which country you are in")?></span></a>&nbsp;
160     <?php     if (isset($TONEZONE) && strlen($TONEZONE))
161         general_display_zones($TONEZONE);
162         else
163         general_display_zones('us');
164         ?>
165 </p>
166 <p>
167     <a class="info" href="#"><?php echo _("24-hour format")?><span><?php echo _("Select Yes if you use 24-hour format or No if you are using 12-hour am/pm format")?></span></a>&nbsp;
168     <select name="TIMEFORMAT">
169         <option value="IMp"><?php echo _("no"); ?></option>
170         <option value="kM" <?php echo (($TIMEFORMAT=="kM") ? 'selected="selected"' : '');?>><?php echo _("yes"); ?></option>
171     </select>
172 </p>
173 <h5><?php echo _("Security Settings")?></h5>
174 <p>
175     <a href=# class="info"><?php echo _("Allow Anonymous Inbound SIP Calls?")?><span><br>
176 <?php echo _("** WARNING **")?><br><br>
177 <?php echo _("Setting this to 'yes' will potentially allow ANYBODY to call into your Asterisk server using the SIP protocol")?><br><br>
178 <?php echo _("It should only be used if you fully understand the impact of allowing anonymous calls into your server")?><br>
179     </span></a>&nbsp;
180     <select name="ALLOW_SIP_ANON">
181     <option value="no"><?php echo _("no"); ?></option>
182     <option <?php if ($ALLOW_SIP_ANON == "yes") echo "SELECTED "?>value="yes"><?php echo _("yes"); ?></option>
183     </select>
184 </p>
185 <h6>
186     <input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>">
187 </h6>
188 <script language="javascript">
189 <!--
190
191 var theForm = document.general;
192
193 function hasRing (s) {
194     if (s.indexOf('r') >= 0) {
195         return true;
196     } else {
197         return false;
198     }
199 }
200
201 function warnConfirm (theField, s) {
202     theField.focus();
203     theField.select();
204         return confirm(s);
205 }
206
207 function general_onsubmit() {
208     var msgInvalidSeconds = "<?php echo _('Please enter a valid Number of Seconds'); ?>";
209     var msgInvalidDefaultFaxEmail = "<?php echo _('Please enter a valid Fax Email'); ?>";
210     var msgRingOptionOutboundTrunk = "<?php echo _('You have selected the \'r\' option for your trunks. This is highly discouraged and will create problems with calls on many PRI, VoIP, ISDN and other trunks that are capable of signalling. Asterisk will generate a ringing tone until the signalling indicates the line is answered. This will result in some external IVRs being inaccessible and other strange problems.'); ?>";
211
212     defaultEmptyOK = false;
213     if (!isInteger(theForm.RINGTIMER.value))
214         return warnInvalid(theForm.RINGTIMER, msgInvalidSeconds);
215
216     // Fax email must be present if selected 'system', otherwise optional
217     if (theForm.FAX_RX.value == "system") {
218         defaultEmptyOK = false;
219     } else {
220         defaultEmptyOK = true;
221     }
222     if (!isEmail(theForm.FAX_RX_EMAIL.value))
223         return warnInvalid(theForm.FAX_RX_EMAIL, msgInvalidDefaultFaxEmail);
224
225     if (hasRing(theForm.TRUNK_OPTIONS.value))
226         return warnConfirm(theForm.TRUNK_OPTIONS, msgRingOptionOutboundTrunk);
227    
228     return true;
229 }
230
231 //-->
232 </script>
233 </form>
234
235
Note: See TracBrowser for help on using the browser.