| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
// Original Release by Philippe Lindheimer |
|---|
| 4 |
// Copyright Philippe Lindheimer (2009) |
|---|
| 5 |
// Copyright Bandwidth.com (2009) |
|---|
| 6 |
/* |
|---|
| 7 |
This program is free software: you can redistribute it and/or modify |
|---|
| 8 |
it under the terms of the GNU Affero General Public License as |
|---|
| 9 |
published by the Free Software Foundation, either version 3 of the |
|---|
| 10 |
License, or (at your option) any later version. |
|---|
| 11 |
|
|---|
| 12 |
This program is distributed in the hope that it will be useful, |
|---|
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 |
GNU Affero General Public License for more details. |
|---|
| 16 |
|
|---|
| 17 |
You should have received a copy of the GNU Affero General Public License |
|---|
| 18 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 19 |
*/ |
|---|
| 20 |
|
|---|
| 21 |
/* Determines how many columns per row for the codecs and formats the table */ |
|---|
| 22 |
$cols_per_row = 4; |
|---|
| 23 |
$width = (100.0 / $cols_per_row); |
|---|
| 24 |
$tabindex = 0; |
|---|
| 25 |
$dispnum = "iaxsettings"; |
|---|
| 26 |
$error_displays = array(); |
|---|
| 27 |
$action = isset($_POST['action'])?$_POST['action']:''; |
|---|
| 28 |
$post_codec = isset($_POST['codec']) ? $_POST['codec'] : array(); |
|---|
| 29 |
$post_vcodec = isset($_POST['vcodec']) ? $_POST['vcodec'] : array(); |
|---|
| 30 |
|
|---|
| 31 |
$codecs = array( |
|---|
| 32 |
'ulaw' => '', |
|---|
| 33 |
'alaw' => '', |
|---|
| 34 |
'slin' => '', |
|---|
| 35 |
'g726' => '', |
|---|
| 36 |
'gsm' => '', |
|---|
| 37 |
'g729' => '', |
|---|
| 38 |
'ilbc' => '', |
|---|
| 39 |
'g723' => '', |
|---|
| 40 |
'g726aal2' => '', |
|---|
| 41 |
'adpcm' => '', |
|---|
| 42 |
'lpc10' => '', |
|---|
| 43 |
'speex' => '', |
|---|
| 44 |
'g722' => '', |
|---|
| 45 |
); |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
// |
|---|
| 49 |
$pri = 1; |
|---|
| 50 |
foreach (array_keys($post_codec) as $codec) { |
|---|
| 51 |
$codecs[$codec] = $pri++; |
|---|
| 52 |
} |
|---|
| 53 |
$iax_settings['codecs'] = $codecs; |
|---|
| 54 |
|
|---|
| 55 |
$video_codecs = array( |
|---|
| 56 |
'h261' => '', |
|---|
| 57 |
'h263' => '', |
|---|
| 58 |
'h263p' => '', |
|---|
| 59 |
'h264' => '', |
|---|
| 60 |
); |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
// |
|---|
| 64 |
$pri = 1; |
|---|
| 65 |
foreach (array_keys($post_vcodec) as $vcodec) { |
|---|
| 66 |
$video_codecs[$vcodec] = $pri++; |
|---|
| 67 |
} |
|---|
| 68 |
$iax_settings['codecpriority'] = isset($_POST['codecpriority']) ? $_POST['codecpriority'] : 'host'; |
|---|
| 69 |
$iax_settings['bandwidth'] = isset($_POST['bandwidth']) ? $_POST['bandwidth'] : 'unset'; |
|---|
| 70 |
$iax_settings['video_codecs'] = $video_codecs; |
|---|
| 71 |
$iax_settings['videosupport'] = isset($_POST['videosupport']) ? $_POST['videosupport'] : 'no'; |
|---|
| 72 |
|
|---|
| 73 |
$iax_settings['maxregexpire'] = isset($_POST['maxregexpire']) ? htmlspecialchars($_POST['maxregexpire']) : '3600'; |
|---|
| 74 |
$iax_settings['minregexpire'] = isset($_POST['minregexpire']) ? htmlspecialchars($_POST['minregexpire']) : '60'; |
|---|
| 75 |
|
|---|
| 76 |
$iax_settings['jitterbuffer'] = isset($_POST['jitterbuffer']) ? $_POST['jitterbuffer'] : 'no'; |
|---|
| 77 |
$iax_settings['forcejitterbuffer'] = isset($_POST['forcejitterbuffer']) ? $_POST['forcejitterbuffer'] : 'no'; |
|---|
| 78 |
$iax_settings['maxjitterbuffer'] = isset($_POST['maxjitterbuffer']) ? htmlspecialchars($_POST['maxjitterbuffer']) : '200'; |
|---|
| 79 |
$iax_settings['resyncthreshold'] = isset($_POST['resyncthreshold']) ? htmlspecialchars($_POST['resyncthreshold']) : '1000'; |
|---|
| 80 |
$iax_settings['maxjitterinterps'] = isset($_POST['maxjitterinterps']) ? htmlspecialchars($_POST['maxjitterinterps']) : '10'; |
|---|
| 81 |
|
|---|
| 82 |
$iax_settings['iax_language'] = isset($_POST['iax_language']) ? htmlspecialchars($_POST['iax_language']) : ''; |
|---|
| 83 |
$iax_settings['bindaddr'] = isset($_POST['bindaddr']) ? htmlspecialchars($_POST['bindaddr']) : ''; |
|---|
| 84 |
$iax_settings['bindport'] = isset($_POST['bindport']) ? htmlspecialchars($_POST['bindport']) : ''; |
|---|
| 85 |
$iax_settings['delayreject'] = isset($_POST['delayreject']) ? htmlspecialchars($_POST['delayreject']) : 'yes'; |
|---|
| 86 |
|
|---|
| 87 |
$p_idx = 0; |
|---|
| 88 |
$n_idx = 0; |
|---|
| 89 |
while (isset($_POST["iax_custom_key_$p_idx"])) { |
|---|
| 90 |
if ($_POST["iax_custom_key_$p_idx"] != '') { |
|---|
| 91 |
$iax_settings["iax_custom_key_$n_idx"] = htmlspecialchars($_POST["iax_custom_key_$p_idx"]); |
|---|
| 92 |
$iax_settings["iax_custom_val_$n_idx"] = htmlspecialchars($_POST["iax_custom_val_$p_idx"]); |
|---|
| 93 |
$n_idx++; |
|---|
| 94 |
} |
|---|
| 95 |
$p_idx++; |
|---|
| 96 |
} |
|---|
| 97 |
function cmp($a, $b) { |
|---|
| 98 |
if ($a == $b) { |
|---|
| 99 |
return 0; |
|---|
| 100 |
} |
|---|
| 101 |
if ($a == '') { |
|---|
| 102 |
return 1; |
|---|
| 103 |
} elseif ($b == '') { |
|---|
| 104 |
return -1; |
|---|
| 105 |
} else { |
|---|
| 106 |
return ($a > $b) ? 1 : -1; |
|---|
| 107 |
} |
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
switch ($action) { |
|---|
| 111 |
case "edit": |
|---|
| 112 |
if (($errors = iaxsettings_edit($iax_settings)) !== true) { |
|---|
| 113 |
$error_displays = process_errors($errors); |
|---|
| 114 |
} else { |
|---|
| 115 |
needreload(); |
|---|
| 116 |
|
|---|
| 117 |
} |
|---|
| 118 |
break; |
|---|
| 119 |
default: |
|---|
| 120 |
|
|---|
| 121 |
$iax_settings = iaxsettings_get(); |
|---|
| 122 |
} |
|---|
| 123 |
$error_displays = array_merge($error_displays,iaxsettings_check_custom_files()); |
|---|
| 124 |
|
|---|
| 125 |
?> |
|---|
| 126 |
|
|---|
| 127 |
</div> |
|---|
| 128 |
<div class="content"> |
|---|
| 129 |
<h2><?php echo _("Edit Settings"); ?></h2> |
|---|
| 130 |
|
|---|
| 131 |
<?php |
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
* from and edit. So extract them after sorting out the codec sub arrays. |
|---|
| 135 |
*/ |
|---|
| 136 |
$codecs = $iax_settings['codecs']; |
|---|
| 137 |
unset($iax_settings['codecs']); |
|---|
| 138 |
uasort($codecs, 'cmp'); |
|---|
| 139 |
|
|---|
| 140 |
$video_codecs = $iax_settings['video_codecs']; |
|---|
| 141 |
unset($iax_settings['video_codecs']); |
|---|
| 142 |
uasort($video_codecs, 'cmp'); |
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
// |
|---|
| 146 |
extract($iax_settings); |
|---|
| 147 |
|
|---|
| 148 |
?> |
|---|
| 149 |
<form autocomplete="off" name="editIax" action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> |
|---|
| 150 |
<input type="hidden" name="action" value="edit"> |
|---|
| 151 |
<table width="690px"> |
|---|
| 152 |
|
|---|
| 153 |
<?php |
|---|
| 154 |
|
|---|
| 155 |
if (!empty($error_displays)) { |
|---|
| 156 |
?> |
|---|
| 157 |
<tr> |
|---|
| 158 |
<td colspan="2"> |
|---|
| 159 |
<div class="iax-errors"> |
|---|
| 160 |
<p><?php echo _("ERRORS") ?></p> |
|---|
| 161 |
<ul> |
|---|
| 162 |
<?php |
|---|
| 163 |
foreach ($error_displays as $div_disp) { |
|---|
| 164 |
echo "<li>".$div_disp['div']."</li>"; |
|---|
| 165 |
} |
|---|
| 166 |
?> |
|---|
| 167 |
</ul> |
|---|
| 168 |
</div> |
|---|
| 169 |
</td> |
|---|
| 170 |
</tr> |
|---|
| 171 |
<?php |
|---|
| 172 |
} |
|---|
| 173 |
?> |
|---|
| 174 |
<tr> |
|---|
| 175 |
<td colspan="2"><h5><?php echo _("Audio Codecs")?><hr></h5></td> |
|---|
| 176 |
</tr> |
|---|
| 177 |
<tr> |
|---|
| 178 |
<td valign='top'><a href="#" class="info"><?php echo _("Codecs")?><span><?php echo _("Check the desired codecs, all others will be disabled unless explicitly enabled in a device or trunks configuration. Drag to re-order.")?></span></a></td> |
|---|
| 179 |
<td> |
|---|
| 180 |
<?php |
|---|
| 181 |
$seq = 1; |
|---|
| 182 |
echo '<ul class="sortable">'; |
|---|
| 183 |
foreach ($codecs as $codec => $codec_state) { |
|---|
| 184 |
$tabindex++; |
|---|
| 185 |
$codec_trans = _($codec); |
|---|
| 186 |
$codec_checked = $codec_state ? 'checked' : ''; |
|---|
| 187 |
echo '<li>' |
|---|
| 188 |
. '<img src="assets/'.$dispnum.'/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> ' |
|---|
| 189 |
. '<input type="checkbox" ' |
|---|
| 190 |
. ($codec_checked ? 'value="'. $seq++ . '" ' : '') |
|---|
| 191 |
. 'name="codec[' . $codec . ']" ' |
|---|
| 192 |
. 'id="'. $codec . '" ' |
|---|
| 193 |
. 'class="audio-codecs" tabindex="' . $tabindex. '" ' |
|---|
| 194 |
. $codec_checked |
|---|
| 195 |
. ' />' |
|---|
| 196 |
. '<label for="'. $codec . '"> ' |
|---|
| 197 |
. '<small>' . $codec_trans . '</small>' |
|---|
| 198 |
. ' </label></li>'; |
|---|
| 199 |
} |
|---|
| 200 |
echo '</ul>'; |
|---|
| 201 |
?> |
|---|
| 202 |
|
|---|
| 203 |
</td> |
|---|
| 204 |
</tr> |
|---|
| 205 |
|
|---|
| 206 |
<tr> |
|---|
| 207 |
<td> |
|---|
| 208 |
<a href="#" class="info"><?php echo _("Codec Priority")?><span><?php echo _("Asterisk: codecpriority. Controls the codec negotiation of an inbound IAX call. This option is inherited to all user entities. It can also be defined in each user entity separately which will override the setting here. The valid values are:<br />host - Consider the host's preferred order ahead of the caller's.<br />caller - Consider the callers preferred order ahead of the host's.<br /> disabled - Disable the consideration of codec preference altogether. (this is the original behavior before preferences were added)<br />reqonly - Same as disabled, only do not consider capabilities if the requested format is not available the call will only be accepted if the requested format is available.")?></span></a> |
|---|
| 209 |
</td> |
|---|
| 210 |
<td> |
|---|
| 211 |
<table width="100%"> |
|---|
| 212 |
<tr> |
|---|
| 213 |
<td> |
|---|
| 214 |
<span class="radioset"> |
|---|
| 215 |
<input id="codecpriority-host" type="radio" name="codecpriority" value="host" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="host"?"checked=\"host\"":""?>/> |
|---|
| 216 |
<label for="codecpriority-host">host</label> |
|---|
| 217 |
<input id="codecpriority-caller" type="radio" name="codecpriority" value="caller" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="caller"?"checked=\"caller\"":""?>/> |
|---|
| 218 |
<label for="codecpriority-caller">caller</label> |
|---|
| 219 |
<input id="codecpriority-disabled" type="radio" name="codecpriority" value="disabled" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="disabled"?"checked=\"disabled\"":""?>/> |
|---|
| 220 |
<label for="codecpriority-disabled">disabled</label> |
|---|
| 221 |
<input id="codecpriority-regonly" type="radio" name="codecpriority" value="regonly" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="regonly"?"checked=\"regonly\"":""?>/> |
|---|
| 222 |
<label for="codecpriority-regonly">regonly</label> |
|---|
| 223 |
</span> |
|---|
| 224 |
</td> |
|---|
| 225 |
</tr> |
|---|
| 226 |
</table> |
|---|
| 227 |
</td> |
|---|
| 228 |
</tr> |
|---|
| 229 |
|
|---|
| 230 |
<tr> |
|---|
| 231 |
<td> |
|---|
| 232 |
<a href="#" class="info"><?php echo _("Bandwidth")?><span><?php echo _("Asterisk: bandwidth. Specify bandwidth of low, medium, or high to control which codecs are used in general.")?></span></a> |
|---|
| 233 |
</td> |
|---|
| 234 |
<td> |
|---|
| 235 |
<table width="100%"> |
|---|
| 236 |
<tr> |
|---|
| 237 |
<td> |
|---|
| 238 |
<span class="radioset"> |
|---|
| 239 |
<input id="bandwidth-low" type="radio" name="bandwidth" value="low" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="low"?"checked=\"low\"":""?>/> |
|---|
| 240 |
<label for="bandwidth-low"><?php echo _("low") ?></label> |
|---|
| 241 |
<input id="bandwidth-medium" type="radio" name="bandwidth" value="medium" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="medium"?"checked=\"medium\"":""?>/> |
|---|
| 242 |
<label for="bandwidth-medium"><?php echo _("medium") ?></label> |
|---|
| 243 |
<input id="bandwidth-high" type="radio" name="bandwidth" value="high" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="high"?"checked=\"high\"":""?>/> |
|---|
| 244 |
<label for="bandwidth-high"><?php echo _("high") ?></label> |
|---|
| 245 |
<input id="bandwidth-unset" type="radio" name="bandwidth" value="unset" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="unset"?"checked=\"unset\"":""?>/> |
|---|
| 246 |
<label for="bandwidth-unset"><?php echo _("unset") ?></label> |
|---|
| 247 |
</span> |
|---|
| 248 |
</td> |
|---|
| 249 |
</tr> |
|---|
| 250 |
</table> |
|---|
| 251 |
</td> |
|---|
| 252 |
</tr> |
|---|
| 253 |
|
|---|
| 254 |
<tr> |
|---|
| 255 |
<td colspan="2"><h5><?php echo _("Video Codecs")?><hr></h5></td> |
|---|
| 256 |
</tr> |
|---|
| 257 |
|
|---|
| 258 |
<tr> |
|---|
| 259 |
<td> |
|---|
| 260 |
<a href="#" class="info"><?php echo _("Video Support")?><span><?php echo _("Check to enable and then choose allowed codecs.")._(" If you clear each codec and then add them one at a time, submitting with each addition, they will be added in order which will effect the codec priority.")?></span></a> |
|---|
| 261 |
</td> |
|---|
| 262 |
<td> |
|---|
| 263 |
<table width="100%"> |
|---|
| 264 |
<tr> |
|---|
| 265 |
<td> |
|---|
| 266 |
<span class="radioset"> |
|---|
| 267 |
<input id="videosupport-yes" type="radio" name="videosupport" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $videosupport=="yes"?"checked=\"yes\"":""?>/> |
|---|
| 268 |
<label for="videosupport-yes"><?php echo _("Enabled") ?></label> |
|---|
| 269 |
<input id="videosupport-no" type="radio" name="videosupport" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $videosupport=="no"?"checked=\"no\"":""?>/> |
|---|
| 270 |
<label for="videosupport-no"><?php echo _("Disabled") ?></label> |
|---|
| 271 |
</span> |
|---|
| 272 |
</td> |
|---|
| 273 |
</tr> |
|---|
| 274 |
</table> |
|---|
| 275 |
</td> |
|---|
| 276 |
</tr> |
|---|
| 277 |
<tr class="video-codecs"> |
|---|
| 278 |
<td></td> |
|---|
| 279 |
<td> |
|---|
| 280 |
<table width="100%"> |
|---|
| 281 |
<tr> |
|---|
| 282 |
<?php |
|---|
| 283 |
echo '<ul class="sortable video-codecs">'; |
|---|
| 284 |
foreach ($video_codecs as $codec => $codec_state) { |
|---|
| 285 |
$tabindex++; |
|---|
| 286 |
$codec_trans = _($codec); |
|---|
| 287 |
$codec_checked = $codec_state ? 'checked' : ''; |
|---|
| 288 |
echo '<li>' |
|---|
| 289 |
. '<img src="assets/'.$dispnum.'/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> ' |
|---|
| 290 |
. '<input type="checkbox" ' |
|---|
| 291 |
. ($codec_checked ? 'value="'. $seq++ . '" ' : '') |
|---|
| 292 |
. 'name="vcodec[' . $codec . ']" ' |
|---|
| 293 |
. 'id="'. $codec . '" ' |
|---|
| 294 |
. 'class="audio-codecs" tabindex="' . $tabindex. '" ' |
|---|
| 295 |
. $codec_checked |
|---|
| 296 |
. ' />' |
|---|
| 297 |
. '<label for="'. $codec . '"> ' |
|---|
| 298 |
. '<small>' . $codec_trans . '</small>' |
|---|
| 299 |
. ' </label></li>'; |
|---|
| 300 |
} |
|---|
| 301 |
echo '</ul>'; |
|---|
| 302 |
|
|---|
| 303 |
?> |
|---|
| 304 |
</tr> |
|---|
| 305 |
</table> |
|---|
| 306 |
</td> |
|---|
| 307 |
</tr> |
|---|
| 308 |
|
|---|
| 309 |
<tr> |
|---|
| 310 |
<td colspan="2"><h5><?php echo _("Registration Settings") ?><hr></h5></td> |
|---|
| 311 |
</tr> |
|---|
| 312 |
|
|---|
| 313 |
<tr> |
|---|
| 314 |
<td> |
|---|
| 315 |
<a href="#" class="info"><?php echo _("Registration Times")?><span><?php echo _("Asterisk: minregexpire, maxregexpire. Minimum and maximum length of time that IAX peers can request as a registration expiration interval (in seconds).")?></span></a> |
|---|
| 316 |
</td> |
|---|
| 317 |
<td> |
|---|
| 318 |
<input type="text" size="2" id="minregexpire" name="minregexpire" class="validate-int" value="<?php echo $minregexpire ?>" tabindex="<?php echo ++$tabindex;?>"><small> (minregexpire)</small> |
|---|
| 319 |
<input type="text" size="3" id="maxregexpire" name="maxregexpire" class="validate-int" value="<?php echo $maxregexpire ?>" tabindex="<?php echo ++$tabindex;?>"><small> (maxregexpire)</small> |
|---|
| 320 |
</td> |
|---|
| 321 |
</tr> |
|---|
| 322 |
|
|---|
| 323 |
<tr> |
|---|
| 324 |
<td colspan="2"><h5><?php echo _("Jitter Buffer Settings") ?><hr></h5></td> |
|---|
| 325 |
</tr> |
|---|
| 326 |
|
|---|
| 327 |
<tr> |
|---|
| 328 |
<td> |
|---|
| 329 |
<a href="#" class="info"><?php echo _("Jitter Buffer")?><span><?php echo _("Asterisk: jitterbuffer. You can adjust several parameters relating to the jitter buffer. The jitter buffer's function is to compensate for varying network delay. The jitter buffer works for INCOMING audio - the outbound audio will be dejittered by the jitter buffer at the other end.")?></span></a> |
|---|
| 330 |
</td> |
|---|
| 331 |
<td> |
|---|
| 332 |
<table width="100%"> |
|---|
| 333 |
<tr> |
|---|
| 334 |
<td> |
|---|
| 335 |
<span class="radioset"> |
|---|
| 336 |
<input id="jitterbuffer-yes" type="radio" name="jitterbuffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jitterbuffer=="yes"?"checked=\"yes\"":""?>/> |
|---|
| 337 |
<label for="jitterbuffer-yes"><?php echo _("Enabled") ?></label> |
|---|
| 338 |
<input id="jitterbuffer-no" type="radio" name="jitterbuffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jitterbuffer=="no"?"checked=\"no\"":""?>/> |
|---|
| 339 |
<label for="jitterbuffer-no"><?php echo _("Disabled") ?></label> |
|---|
| 340 |
</span> |
|---|
| 341 |
</td> |
|---|
| 342 |
</tr> |
|---|
| 343 |
</table> |
|---|
| 344 |
</td> |
|---|
| 345 |
</tr> |
|---|
| 346 |
|
|---|
| 347 |
<tr class="jitter-buffer"> |
|---|
| 348 |
<td> |
|---|
| 349 |
<a href="#" class="info"><?php echo _("Force Jitter Buffer")?><span><?php echo _("Asterisk: forcejitterbuffer. Forces the use of a jitterbuffer on the receive side of an IAX channel. Normally the jitter buffer will not be used if receiving a jittery channel but sending it off to another channel such as a SIP channel to an endpoint, since there is typically a jitter buffer at the far end. This will force the use of the jitter buffer before sending the stream on. This is not typically desired as it adds additional latency into the stream.")?></span></a> |
|---|
| 350 |
</td> |
|---|
| 351 |
<td> |
|---|
| 352 |
<table width="100%"> |
|---|
| 353 |
<tr> |
|---|
| 354 |
<td> |
|---|
| 355 |
<span class="radioset"> |
|---|
| 356 |
<input id="forcejitterbuffer-yes" type="radio" name="forcejitterbuffer" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $forcejitterbuffer=="yes"?"checked=\"yes\"":""?>/> |
|---|
| 357 |
<label for="forcejitterbuffer-yes"><?php echo _("Yes") ?></label> |
|---|
| 358 |
<input id="forcejitterbuffer-no" type="radio" name="forcejitterbuffer" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $forcejitterbuffer=="no"?"checked=\"no\"":""?>/> |
|---|
| 359 |
<label for="forcejitterbuffer-no"><?php echo _("No") ?></label> |
|---|
| 360 |
<span> |
|---|
| 361 |
</td> |
|---|
| 362 |
</tr> |
|---|
| 363 |
</table> |
|---|
| 364 |
</td> |
|---|
| 365 |
</tr> |
|---|
| 366 |
|
|---|
| 367 |
<tr class="jitter-buffer"> |
|---|
| 368 |
<td> |
|---|
| 369 |
<a href="#" class="info"><?php echo _("Jitter Buffer Size")?><span><?php echo _("Asterisk: maxjitterbuffer. Max length of the jitterbuffer in milliseconds.<br /> Asterisk: resyncthreshold. When the jitterbuffer notices a significant change in delay that continues over a few frames, it will resync, assuming that the change in delay was caused by a timestamping mix-up. The threshold for noticing a change in delay is measured as twice the measured jitter plus this resync threshold. Resyncing can be disabled by setting this parameter to -1.")?></span></a> |
|---|
| 370 |
</td> |
|---|
| 371 |
<td> |
|---|
| 372 |
<input type="text" size="4" id="maxjitterbuffer" name="maxjitterbuffer" class="jitter-buffer validate-int" value="<?php echo $maxjitterbuffer ?>" tabindex="<?php echo ++$tabindex;?>"><small> (maxjitterbuffer)</small> |
|---|
| 373 |
<input type="text" size="4" id="resyncthreshold" name="resyncthreshold" class="jitter-buffer validate-int" value="<?php echo $resyncthreshold ?>" tabindex="<?php echo ++$tabindex;?>"><small> (resyncthreshold)</small> |
|---|
| 374 |
</td> |
|---|
| 375 |
</tr> |
|---|
| 376 |
|
|---|
| 377 |
<tr class="jitter-buffer"> |
|---|
| 378 |
<td> |
|---|
| 379 |
<a href="#" class="info"><?php echo _("Max Interpolations")?><span><?php echo _("Asterisk: maxjitterinterps. The maximum number of interpolation frames the jitterbuffer should return in a row. Since some clients do not send CNG/DTX frames to indicate silence, the jitterbuffer will assume silence has begun after returning this many interpolations. This prevents interpolating throughout a long silence.")?></span></a> |
|---|
| 380 |
</td> |
|---|
| 381 |
<td> |
|---|
| 382 |
<input type="text" size="4" id="maxjitterinterps" name="maxjitterinterps" class="jitter-buffer validate-int" value="<?php echo $maxjitterinterps ?>" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 383 |
</td> |
|---|
| 384 |
</tr> |
|---|
| 385 |
|
|---|
| 386 |
<tr> |
|---|
| 387 |
<td colspan="2"><h5><?php echo _("Advanced General Settings") ?><hr></h5></td> |
|---|
| 388 |
</tr> |
|---|
| 389 |
|
|---|
| 390 |
<tr> |
|---|
| 391 |
<td> |
|---|
| 392 |
<a href="#" class="info"><?php echo _("Language")?><span><?php echo _("Default Language for a channel, Asterisk: language")?></span></a> |
|---|
| 393 |
</td> |
|---|
| 394 |
<td> |
|---|
| 395 |
<input type="text" id="iax_language" name="iax_language" class="validate-alphanumeric" value="<?php echo $iax_language ?>" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 396 |
</td> |
|---|
| 397 |
</tr> |
|---|
| 398 |
|
|---|
| 399 |
<tr> |
|---|
| 400 |
<td> |
|---|
| 401 |
<a href="#" class="info"><?php echo _("Bind Address")?><span><?php echo _("Asterisk: bindaddr. The IP address to bind to and listen for calls on the Bind Port. If set to 0.0.0.0 Asterisk will listen on all addresses. To bind to multiple IP addresses or ports, use the Other 'IAX Settings' fields where you can put settings such as:<br /> bindaddr=192.168.10.100:4555.<br /> It is recommended to leave this blank.")?></span></a> |
|---|
| 402 |
</td> |
|---|
| 403 |
<td> |
|---|
| 404 |
<input type="text" id="bindaddr" name="bindaddr" class="validate-ip" value="<?php echo $bindaddr ?>" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 405 |
</td> |
|---|
| 406 |
</tr> |
|---|
| 407 |
|
|---|
| 408 |
<tr> |
|---|
| 409 |
<td> |
|---|
| 410 |
<a href="#" class="info"><?php echo _("Bind Port")?><span><?php echo _("Asterisk: bindport. Local incoming UDP Port that Asterisk will bind to and listen for IAX messages. The IAX standard is 4569 and in most cases this is what you want. It is recommended to leave this blank.")?></span></a> |
|---|
| 411 |
</td> |
|---|
| 412 |
<td> |
|---|
| 413 |
<input type="text" id="bindport" name="bindport" class="validate-ip-port" value="<?php echo $bindport ?>" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 414 |
</td> |
|---|
| 415 |
</tr> |
|---|
| 416 |
|
|---|
| 417 |
<tr> |
|---|
| 418 |
<td> |
|---|
| 419 |
<a href="#" class="info"><?php echo _("Delay Auth Rejects")?><span><?php echo _("Asterisk: delayreject. For increased security against brute force password attacks enable this which will delay the sending of authentication reject for REGREQ or AUTHREP if there is a password.")?></span></a> |
|---|
| 420 |
</td> |
|---|
| 421 |
<td> |
|---|
| 422 |
<table width="100%"> |
|---|
| 423 |
<tr> |
|---|
| 424 |
<td> |
|---|
| 425 |
<span class="radioset"> |
|---|
| 426 |
<input id="delayreject-yes" type="radio" name="delayreject" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $delayreject=="yes"?"checked=\"yes\"":""?>/> |
|---|
| 427 |
<label for="delayreject-yes"><?php echo _("Enable") ?></label> |
|---|
| 428 |
<input id="delayreject-no" type="radio" name="delayreject" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $delayreject=="no"?"checked=\"no\"":""?>/> |
|---|
| 429 |
<label for="delayreject-no"><?php echo _("Disable") ?></label> |
|---|
| 430 |
</span> |
|---|
| 431 |
</td> |
|---|
| 432 |
</tr> |
|---|
| 433 |
</table> |
|---|
| 434 |
</td> |
|---|
| 435 |
</tr> |
|---|
| 436 |
|
|---|
| 437 |
<tr><td colspan="2"><br /></td></tr> |
|---|
| 438 |
|
|---|
| 439 |
<tr> |
|---|
| 440 |
<td> |
|---|
| 441 |
<a href="#" class="info"><?php echo _("Other IAX Settings")?><span><?php echo _("You may set any other IAX settings not present here that are allowed to be configured in the General section of iax.conf. There will be no error checking against these settings so check them carefully. They should be entered as:<br /> [setting] = [value]<br /> in the boxes below. Click the Add Field box to add additional fields. Blank boxes will be deleted when submitted.")?></span></a> |
|---|
| 442 |
</td> |
|---|
| 443 |
<td> |
|---|
| 444 |
<input type="text" id="iax_custom_key_0" name="iax_custom_key_0" class="iax-custom" value="<?php echo $iax_custom_key_0 ?>" tabindex="<?php echo ++$tabindex;?>"> = |
|---|
| 445 |
<input type="text" id="iax_custom_val_0" name="iax_custom_val_0" value="<?php echo $iax_custom_val_0 ?>" tabindex="<?php echo ++$tabindex;?>"> |
|---|
| 446 |
</td> |
|---|
| 447 |
</tr> |
|---|
| 448 |
|
|---|
| 449 |
<?php |
|---|
| 450 |
$idx = 1; |
|---|
| 451 |
$var_iax_custom_key = "iax_custom_key_$idx"; |
|---|
| 452 |
$var_iax_custom_val = "iax_custom_val_$idx"; |
|---|
| 453 |
while (isset($$var_iax_custom_key)) { |
|---|
| 454 |
if ($$var_iax_custom_key != '') { |
|---|
| 455 |
$tabindex++; |
|---|
| 456 |
echo <<< END |
|---|
| 457 |
<tr> |
|---|
| 458 |
<td> |
|---|
| 459 |
</td> |
|---|
| 460 |
<td> |
|---|
| 461 |
<input type="text" id="iax_custom_key_$idx" name="iax_custom_key_$idx" class="iax-custom" value="{$$var_iax_custom_key}" tabindex="$tabindex"> = |
|---|
| 462 |
END; |
|---|
| 463 |
$tabindex++; |
|---|
| 464 |
echo <<< END |
|---|
| 465 |
<input type="text" id="iax_custom_val_$idx" name="iax_custom_val_$idx" value="{$$var_iax_custom_val}" tabindex="$tabindex"> |
|---|
| 466 |
</td> |
|---|
| 467 |
</tr> |
|---|
| 468 |
END; |
|---|
| 469 |
} |
|---|
| 470 |
$idx++; |
|---|
| 471 |
$var_iax_custom_key = "iax_custom_key_$idx"; |
|---|
| 472 |
$var_iax_custom_val = "iax_custom_val_$idx"; |
|---|
| 473 |
} |
|---|
| 474 |
$tabindex += 60; |
|---|
| 475 |
?> |
|---|
| 476 |
<tr id="iax-custom-buttons"> |
|---|
| 477 |
<td></td> |
|---|
| 478 |
<td><br \> |
|---|
| 479 |
<input type="button" id="iax-custom-add" value="<?php echo _("Add Field")?>" /> |
|---|
| 480 |
</td> |
|---|
| 481 |
</tr> |
|---|
| 482 |
|
|---|
| 483 |
<tr> |
|---|
| 484 |
<td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td> |
|---|
| 485 |
</tr> |
|---|
| 486 |
</table> |
|---|
| 487 |
<script language="javascript"> |
|---|
| 488 |
<!-- |
|---|
| 489 |
$(document).ready(function(){ |
|---|
| 490 |
|
|---|
| 491 |
/* Add a Custom Var / Val textbox */ |
|---|
| 492 |
$("#iax-custom-add").click(function(){ |
|---|
| 493 |
addCustomField("",""); |
|---|
| 494 |
}); |
|---|
| 495 |
|
|---|
| 496 |
/* Initialize Video Support settings and show/hide */ |
|---|
| 497 |
if (document.getElementById("videosupport-no").checked) { |
|---|
| 498 |
$(".video-codecs").hide(); |
|---|
| 499 |
} |
|---|
| 500 |
$("#videosupport-yes").click(function(){ |
|---|
| 501 |
$(".video-codecs").show(); |
|---|
| 502 |
}); |
|---|
| 503 |
$("#videosupport-no").click(function(){ |
|---|
| 504 |
$(".video-codecs").hide(); |
|---|
| 505 |
}); |
|---|
| 506 |
|
|---|
| 507 |
/* Initialize Jitter Buffer settings and show/hide */ |
|---|
| 508 |
if (document.getElementById("jitterbuffer-no").checked) { |
|---|
| 509 |
$(".jitter-buffer").hide(); |
|---|
| 510 |
} |
|---|
| 511 |
$("#jitterbuffer-yes").click(function(){ |
|---|
| 512 |
$(".jitter-buffer").show(); |
|---|
| 513 |
}); |
|---|
| 514 |
$("#jitterbuffer-no").click(function(){ |
|---|
| 515 |
$(".jitter-buffer").hide(); |
|---|
| 516 |
}); |
|---|
| 517 |
<?php |
|---|
| 518 |
|
|---|
| 519 |
if (!empty($error_displays)) { |
|---|
| 520 |
foreach ($error_displays as $js_disp) { |
|---|
| 521 |
echo " ".$js_disp['js']; |
|---|
| 522 |
} |
|---|
| 523 |
} |
|---|
| 524 |
?> |
|---|
| 525 |
}); |
|---|
| 526 |
|
|---|
| 527 |
var theForm = document.editIax; |
|---|
| 528 |
|
|---|
| 529 |
/* Insert a iax_setting/iax_value pair of text boxes */ |
|---|
| 530 |
function addCustomField(key, val) { |
|---|
| 531 |
var idx = $(".iax-custom").size(); |
|---|
| 532 |
var idxp = idx - 1; |
|---|
| 533 |
var tabindex = parseInt($("#iax_custom_val_"+idxp).attr('tabindex')) + 1; |
|---|
| 534 |
var tabindexp = tabindex + 1; |
|---|
| 535 |
|
|---|
| 536 |
$("#iax-custom-buttons").before('\ |
|---|
| 537 |
<tr>\ |
|---|
| 538 |
<td>\ |
|---|
| 539 |
</td>\ |
|---|
| 540 |
<td>\ |
|---|
| 541 |
<input type="text" id="iax_custom_key_'+idx+'" name="iax_custom_key_'+idx+'" class="iax-custom" value="'+key+'" tabindex="'+tabindex+'"> =\ |
|---|
| 542 |
<input type="text" id="iax_custom_val_'+idx+'" name="iax_custom_val_'+idx+'" value="'+val+'" tabindex="'+tabindexp+'">\ |
|---|
| 543 |
</td>\ |
|---|
| 544 |
</tr>\ |
|---|
| 545 |
'); |
|---|
| 546 |
} |
|---|
| 547 |
//--> |
|---|
| 548 |
</script> |
|---|
| 549 |
</form> |
|---|
| 550 |
<?php |
|---|
| 551 |
|
|---|
| 552 |
|
|---|
| 553 |
|
|---|
| 554 |
function process_errors($errors) { |
|---|
| 555 |
foreach($errors as $error) { |
|---|
| 556 |
$error_display[] = array( |
|---|
| 557 |
'js' => "$('#".$error['id']."').addClass('validation-error');\n", |
|---|
| 558 |
'div' => $error['message'], |
|---|
| 559 |
); |
|---|
| 560 |
} |
|---|
| 561 |
return $error_display; |
|---|
| 562 |
} |
|---|
| 563 |
|
|---|
| 564 |
function iaxsettings_check_custom_files() { |
|---|
| 565 |
global $amp_conf; |
|---|
| 566 |
$errors = array(); |
|---|
| 567 |
|
|---|
| 568 |
$custom_files[] = $amp_conf['ASTETCDIR']."/iax.conf"; |
|---|
| 569 |
$custom_files[] = $amp_conf['ASTETCDIR']."/iax_general_custom.conf"; |
|---|
| 570 |
$custom_files[] = $amp_conf['ASTETCDIR']."/iax_custom.conf"; |
|---|
| 571 |
|
|---|
| 572 |
foreach ($custom_files as $file) { |
|---|
| 573 |
if (file_exists($file)) { |
|---|
| 574 |
$iax_conf = @parse_ini_file($file,true); |
|---|
| 575 |
$main = true; |
|---|
| 576 |
foreach ($iax_conf as $section => $item) { |
|---|
| 577 |
|
|---|
| 578 |
// |
|---|
| 579 |
if (!is_array($item)) { |
|---|
| 580 |
$msg = sprintf(_("Settings in %s may override these. Those settings should be removed."),"<b>$file</b>"); |
|---|
| 581 |
$errors[] = array( 'js' => '', 'div' => $msg); |
|---|
| 582 |
break; |
|---|
| 583 |
} elseif ($main && is_array($item) && strtolower($section) == 'general' && !empty($item)) { |
|---|
| 584 |
$msg = sprintf(_("File %s should not have any settings in it. Those settings should be removed."),"<b>$file</b>"); |
|---|
| 585 |
$errors[] = array( 'js' => '', 'div' => $msg); |
|---|
| 586 |
break; |
|---|
| 587 |
} |
|---|
| 588 |
$main = false; |
|---|
| 589 |
} |
|---|
| 590 |
} |
|---|
| 591 |
} |
|---|
| 592 |
return $errors; |
|---|
| 593 |
} |
|---|
| 594 |
|
|---|
| 595 |
|
|---|
| 596 |
?> |
|---|
| 597 |
|
|---|