. */ /* Determines how many columns per row for the codecs and formats the table */ $cols_per_row = 4; $width = (100.0 / $cols_per_row); $tabindex = 0; $dispnum = "sipsettings"; $error_displays = array(); $action = isset($_POST['action'])?$_POST['action']:''; $sip_settings['nat'] = isset($_POST['nat']) ? $_POST['nat'] : 'yes'; $sip_settings['nat_mode'] = isset($_POST['nat_mode']) ? $_POST['nat_mode'] : 'externip'; $sip_settings['externip_val'] = isset($_POST['externip_val']) ? htmlspecialchars($_POST['externip_val']) : ''; $sip_settings['externhost_val'] = isset($_POST['externhost_val']) ? htmlspecialchars($_POST['externhost_val']) : ''; $sip_settings['externrefresh'] = isset($_POST['externrefresh']) ? htmlspecialchars($_POST['externrefresh']) : '120'; $p_idx = 0; $n_idx = 0; while (isset($_POST["localnet_$p_idx"])) { if ($_POST["localnet_$p_idx"] != '') { $sip_settings["localnet_$n_idx"] = htmlspecialchars($_POST["localnet_$p_idx"]); $sip_settings["netmask_$n_idx"] = htmlspecialchars($_POST["netmask_$p_idx"]); $n_idx++; } $p_idx++; } $codecs = array( 'ulaw' => '', 'alaw' => '', 'slin' => '', 'g726' => '', 'gsm' => '', 'g729' => '', 'ilbc' => '', 'g723' => '', 'g726aal2' => '', 'adpcm' => '', 'lpc10' => '', 'speex' => '', 'g722' => '', ); foreach (array_keys($codecs) as $codec) { $codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; } $sip_settings['codecs'] = $codecs; $sip_settings['g726nonstandard'] = isset($_POST['g726nonstandard']) ? $_POST['g726nonstandard'] : 'no'; $sip_settings['t38pt_udptl'] = isset($_POST['t38pt_udptl']) ? $_POST['t38pt_udptl'] : 'no'; $video_codecs = array( 'h261' => '', 'h263' => '', 'h263p' => '', 'h264' => '', ); foreach (array_keys($video_codecs) as $codec) { $video_codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; } $sip_settings['video_codecs'] = $video_codecs; $sip_settings['videosupport'] = isset($_POST['videosupport']) ? $_POST['videosupport'] : 'no'; $sip_settings['maxcallbitrate'] = isset($_POST['maxcallbitrate']) ? htmlspecialchars($_POST['maxcallbitrate']) : '384'; $sip_settings['canreinvite'] = isset($_POST['canreinvite']) ? $_POST['canreinvite'] : 'no'; $sip_settings['rtptimeout'] = isset($_POST['rtptimeout']) ? htmlspecialchars($_POST['rtptimeout']) : '30'; $sip_settings['rtpholdtimeout'] = isset($_POST['rtpholdtimeout']) ? htmlspecialchars($_POST['rtpholdtimeout']) : '300'; $sip_settings['rtpkeepalive'] = isset($_POST['rtpkeepalive']) ? htmlspecialchars($_POST['rtpkeepalive']) : '0'; $sip_settings['checkmwi'] = isset($_POST['checkmwi']) ? htmlspecialchars($_POST['checkmwi']) : '10'; $sip_settings['notifyringing'] = isset($_POST['notifyringing']) ? $_POST['notifyringing'] : 'yes'; $sip_settings['notifyhold'] = isset($_POST['notifyhold']) ? $_POST['notifyhold'] : 'yes'; $sip_settings['registertimeout'] = isset($_POST['registertimeout']) ? htmlspecialchars($_POST['registertimeout']) : '20'; $sip_settings['registerattempts'] = isset($_POST['registerattempts']) ? htmlspecialchars($_POST['registerattempts']) : '0'; $sip_settings['maxexpiry'] = isset($_POST['maxexpiry']) ? htmlspecialchars($_POST['maxexpiry']) : '3600'; $sip_settings['minexpiry'] = isset($_POST['minexpiry']) ? htmlspecialchars($_POST['minexpiry']) : '60'; $sip_settings['defaultexpiry'] = isset($_POST['defaultexpiry']) ? htmlspecialchars($_POST['defaultexpiry']) : '120'; $sip_settings['jbenable'] = isset($_POST['jbenable']) ? $_POST['jbenable'] : 'no'; $sip_settings['jbforce'] = isset($_POST['jbforce']) ? $_POST['jbforce'] : 'no'; $sip_settings['jbimpl'] = isset($_POST['jbimpl']) ? $_POST['jbimpl'] : 'fixed'; $sip_settings['jbmaxsize'] = isset($_POST['jbmaxsize']) ? htmlspecialchars($_POST['jbmaxsize']) : '200'; $sip_settings['jbresyncthreshold'] = isset($_POST['jbresyncthreshold']) ? htmlspecialchars($_POST['jbresyncthreshold']) : '1000'; $sip_settings['jblog'] = isset($_POST['jblog']) ? $_POST['jblog'] : 'no'; $sip_settings['sip_language'] = isset($_POST['sip_language']) ? htmlspecialchars($_POST['sip_language']) : ''; $sip_settings['context'] = isset($_POST['context']) ? htmlspecialchars($_POST['context']) : ''; $sip_settings['bindaddr'] = isset($_POST['bindaddr']) ? htmlspecialchars($_POST['bindaddr']) : ''; $sip_settings['bindport'] = isset($_POST['bindport']) ? htmlspecialchars($_POST['bindport']) : ''; $sip_settings['allowguest'] = isset($_POST['allowguest']) ? $_POST['allowguest'] : 'yes'; $sip_settings['srvlookup'] = isset($_POST['srvlookup']) ? $_POST['srvlookup'] : 'no'; $p_idx = 0; $n_idx = 0; while (isset($_POST["sip_custom_key_$p_idx"])) { if ($_POST["sip_custom_key_$p_idx"] != '') { $sip_settings["sip_custom_key_$n_idx"] = htmlspecialchars($_POST["sip_custom_key_$p_idx"]); $sip_settings["sip_custom_val_$n_idx"] = htmlspecialchars($_POST["sip_custom_val_$p_idx"]); $n_idx++; } $p_idx++; } switch ($action) { case "edit": //just delete and re-add if (($errors = sipsettings_edit($sip_settings)) !== true) { $error_displays = process_errors($errors); } else { needreload(); //redirect_standard(); } break; default: /* only get them if first time load, if they pressed submit, use values from POST */ $sip_settings = sipsettings_get(); } $error_displays = array_merge($error_displays,sipsettings_check_custom_files()); ?>

END; } $idx++; $var_localnet = "localnet_$idx"; $var_netmask = "netmask_$idx"; } $tabindex += 40; // make room for dynamic insertion of new fields so we can add tabindexes ?> END; } $idx++; $var_sip_custom_key = "sip_custom_key_$idx"; $var_sip_custom_val = "sip_custom_val_$idx"; } $tabindex += 60; // make room for dynamic insertion of new fields ?>

    ".$div_disp['div'].""; } ?>

yes = Always ignore info and assume NAT
no = Use NAT mode only according to RFC3581
never = Never attempt NAT mode or RFC3581
route = Assume NAT, don't send rport")?>
/> /> /> />
/> /> />
/
/ END; $tabindex++; echo <<< END

" class="nat-settings" /> " class="nat-settings" />

$codec_state) { if ($cols == 0) { echo "\n"; $cols = $cols_per_row; } $cols--; $tabindex++; $codec_trans = _($codec); $codec_checked = $codec_state ? 'checked' : ''; echo <<< END END; } ?>
/> />
/> />

/> />
$codec_state) { if ($cols == 0) { echo "\n"; $cols = $cols_per_row; } $cols--; $tabindex++; $codec_trans = _($codec); $codec_checked = $codec_state ? 'checked' : ''; echo <<< END END; } ?>

/> /> /> />
Asterisk: rtpholdtimeout. Terminate call if rtpholdtimeout seconds of no RTP or RTCP activity on the audio channel when we're on hold (must be > rtptimeout).
Asterisk: rtpkeepalive. Send keepalives in the RTP stream to keep NAT open during periods where no RTP stream may be flowing (like on hold).")?>
 (rtptimeout)   (rtpholdtimeout)   (rtpkeepalive)

/> />
/> />

Asterisk: registrationattempts. Number of times to try and register before giving up. A value of 0 means keep trying forever. Normally this should be set to 0 so that Asterisk will continue to register until successful in the case of network or gateway outages.")?>  (registertimeout)   (registerattempts)
Asterisk: maxepiry. Maximum allowed time of incoming registrations
Asterisk: defaultexpiry. Default length of incoming and outgoing registrations.")?>
 (minexpiry)   (maxexpiry)   (defaultexpiry)

/> />
/> />
fixed: size always equals to jbmaxsize;
adaptive: with variable size (the new jb of IAX2).")?>
/> />
/> />
Asterisk: jbresyncthreshold. Jump in the frame timestamps over which the jitterbuffer is resynchronized. Useful to improve the quality of the voice, with big jumps in/broken timestamps, usually sent from exotic devices and programs. Can be set to -1 to disable.")?>  (jbmaxsize)   (jbresyncthreshold) 

/> />
/> />

[setting] = [value]
in the boxes below. Click the Add Field box to add additional fields. Blank boxes will be deleted when submitted.")?>
=
= END; $tabindex++; echo <<< END

" />

" tabindex="">
"$('#".$error['id']."').addClass('validation-error');\n", 'div' => $error['message'], ); } return $error_display; } function sipsettings_check_custom_files() { global $amp_conf; $errors = array(); $custom_files[] = $amp_conf['ASTETCDIR']."/sip.conf"; $custom_files[] = $amp_conf['ASTETCDIR']."/sip_nat.conf"; $custom_files[] = $amp_conf['ASTETCDIR']."/sip_general_custom.conf"; $custom_files[] = $amp_conf['ASTETCDIR']."/sip_custom.conf"; foreach ($custom_files as $file) { if (file_exists($file)) { $sip_conf = parse_ini_file($file,true); $main = true; // 1 is sip.conf, after that don't care foreach ($sip_conf as $section => $item) { // If setting is an array, then it is a subsection // if (!is_array($item)) { $msg = sprintf(_("Settings in %s may override these. Those settings should be removed."),"$file"); $errors[] = array( 'js' => '', 'div' => $msg); break; } elseif ($main && is_array($item) && strtolower($section) == 'general' && !empty($item)) { $msg = sprintf(_("File %s should not have any settings in it. Those settings should be removed."),"$file"); $errors[] = array( 'js' => '', 'div' => $msg); break; } $main = false; } } } return $errors; } ?>