Changeset 7829

Show
Ignore:
Timestamp:
06/17/09 01:56:10 (4 years ago)
Author:
p_lindheimer
Message:

added tabindex to dynamically inserted fields, add classes for potential validation scheme though looking into jquery validate plugin, and reformatted with spaces in place of tabs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.6/sipsettings/page.sipsettings.php

    r7827 r7829  
    1919*/ 
    2020 
    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       = "sipsettings"; 
    26  
    27  $action                            = isset($_POST['action'])?$_POST['action']:''; 
    28  
    29  $sip_settings['nat']               = isset($_POST['nat']) ? $_POST['nat'] : 'yes'; 
    30  $sip_settings['nat_mode']          = isset($_POST['nat_mode']) ? $_POST['nat_mode'] : 'externip'; 
    31  $sip_settings['externip_val']      = isset($_POST['externip_val']) ? htmlspecialchars($_POST['externip_val']) : ''; 
    32  $sip_settings['externhost_val']    = isset($_POST['externhost_val']) ? htmlspecialchars($_POST['externhost_val']) : ''; 
    33  $sip_settings['externrefresh']     = isset($_POST['externrefresh']) ? htmlspecialchars($_POST['externrefresh']) : '120'; 
    34  
    35  $p_idx = 0; 
    36  $n_idx = 0; 
    37  while (isset($_POST["localnet-$p_idx"])) { 
    38    if ($_POST["localnet-$p_idx"] != '') { 
    39      $sip_settings["localnet_$n_idx"] = htmlspecialchars($_POST["localnet-$p_idx"]); 
    40      $sip_settings["netmask_$n_idx"]  = htmlspecialchars($_POST["netmask-$p_idx"]); 
    41      $n_idx++; 
    42    }  
    43    $p_idx++; 
    44 
    45  
    46  $codecs = array( 
    47    'ulaw'     => '', 
    48    'alaw'     => '', 
    49    'slin'     => '', 
    50    'g726'     => '', 
    51    'gsm'      => '', 
    52    'g729'     => '', 
    53    'ilbc'     => '', 
    54    'g723'     => '', 
    55    'g726aal2' => '', 
    56    'adpcm'    => '', 
    57    'lpc10'    => '', 
    58    'speex'    => '', 
    59    'g722'     => '', 
    60    'jpeg'     => '', 
    61    'png'      => '', 
    62    ); 
    63  foreach (array_keys($codecs) as $codec) { 
    64    $codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    65 
    66  $sip_settings['codecs']            = $codecs; 
    67  $sip_settings['g726nonstandard']   = isset($_POST['g726nonstandard']) ? $_POST['g726nonstandard'] : 'no'; 
    68  $sip_settings['t38pt_udptl']       = isset($_POST['t38pt_udptl']) ? $_POST['t38pt_udptl'] : 'no'; 
    69  
    70  $video_codecs = array( 
    71    'h261'  => '', 
    72    'h263'  => '', 
    73    'h263p' => '', 
    74    'h264'  => '', 
    75    ); 
    76  foreach (array_keys($video_codecs) as $codec) { 
    77    $video_codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    78 
    79  $sip_settings['video_codecs']      = $video_codecs; 
    80  $sip_settings['videosupport']      = isset($_POST['videosupport']) ? $_POST['videosupport'] : 'no'; 
    81  $sip_settings['maxcallbitrate']    = isset($_POST['maxcallbitrate']) ? htmlspecialchars($_POST['maxcallbitrate']) : '384'; 
    82  
    83  $sip_settings['canreinvite']       = isset($_POST['canreinvite']) ? $_POST['canreinvite'] : 'no'; 
    84  $sip_settings['rtptimeout']        = isset($_POST['rtptimeout']) ? htmlspecialchars($_POST['rtptimeout']) : '30'; 
    85  $sip_settings['rtpholdtimeout']    = isset($_POST['rtpholdtimeout']) ? htmlspecialchars($_POST['rtpholdtimeout']) : '300'; 
    86  $sip_settings['rtpkeepalive']      = isset($_POST['rtpkeepalive']) ? htmlspecialchars($_POST['rtpkeepalive']) : ''; 
    87  
    88  $sip_settings['checkmwi']          = isset($_POST['checkmwi']) ? htmlspecialchars($_POST['checkmwi']) : ''; 
    89  $sip_settings['notifyringing']     = isset($_POST['notifyringing']) ? $_POST['notifyringing'] : 'no'; 
    90  $sip_settings['notifyhold']        = isset($_POST['notifyhold']) ? $_POST['notifyhold'] : 'no'; 
    91  
    92  $sip_settings['registertimeout']   = isset($_POST['registertimeout']) ? htmlspecialchars($_POST['registertimeout']) : '20'; 
    93  $sip_settings['registerattempts']  = isset($_POST['registerattempts']) ? htmlspecialchars($_POST['registerattempts']) : '0'; 
    94  $sip_settings['maxexpiry']         = isset($_POST['maxexpiry']) ? htmlspecialchars($_POST['maxexpiry']) : '3600'; 
    95  $sip_settings['minexpiry']         = isset($_POST['minexpiry']) ? htmlspecialchars($_POST['minexpiry']) : '60'; 
    96  $sip_settings['defaultexpiry']     = isset($_POST['defaultexpiry']) ? htmlspecialchars($_POST['defaultexpiry']) : '120'; 
    97  
    98  $sip_settings['jbenable']          = isset($_POST['jbenable']) ? $_POST['jbenable'] : 'no'; 
    99  $sip_settings['jbforce']           = isset($_POST['jbforce']) ? $_POST['jbforce'] : 'no'; 
    100  $sip_settings['jpimpl']            = isset($_POST['jpimpl']) ? $_POST['jpimpl'] : 'fixed'; 
    101  $sip_settings['jbmaxsize']         = isset($_POST['jbmaxsize']) ? htmlspecialchars($_POST['jbmaxsize']) : '200'; 
    102  $sip_settings['jbresyncthreshold'] = isset($_POST['jbresyncthreshold']) ? htmlspecialchars($_POST['jbresyncthreshold']) : '1000'; 
    103  $sip_settings['jblog']             = isset($_POST['jblog']) ? $_POST['jblog'] : 'no'; 
    104  
    105  $sip_settings['sip_language']      = isset($_POST['sip-language']) ? htmlspecialchars($_POST['sip-language']) : ''; 
    106  $sip_settings['context']           = isset($_POST['context']) ? htmlspecialchars($_POST['context']) : 'from-sip-external'; 
    107  $sip_settings['bindaddr']          = isset($_POST['bindaddr']) ? htmlspecialchars($_POST['bindaddr']) : '0.0.0.0'; 
    108  $sip_settings['bindport']          = isset($_POST['bindport']) ? htmlspecialchars($_POST['bindport']) : '5060'; 
    109  $sip_settings['allowguest']        = isset($_POST['allowguest']) ? $_POST['allowguest'] : 'yes'; 
    110  $sip_settings['srvlookup']         = isset($_POST['srvlookup']) ? $_POST['srvlookup'] : 'no'; 
    111  
    112  $p_idx = 0; 
    113  $n_idx = 0; 
    114  while (isset($_POST["sip-custom-key-$p_idx"])) { 
    115    if ($_POST["sip-custom-key-$p_idx"] != '') { 
    116      $sip_settings["sip_custom_key_$n_idx"] = htmlspecialchars($_POST["sip-custom-key-$p_idx"]); 
    117      $sip_settings["sip_custom_val_$n_idx"] = htmlspecialchars($_POST["sip-custom-val-$p_idx"]); 
    118      $n_idx++; 
    119    }  
    120    $p_idx++; 
    121 
     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       = "sipsettings"; 
     26 
     27  $action                            = isset($_POST['action'])?$_POST['action']:''; 
     28 
     29  $sip_settings['nat']               = isset($_POST['nat']) ? $_POST['nat'] : 'yes'; 
     30  $sip_settings['nat_mode']          = isset($_POST['nat_mode']) ? $_POST['nat_mode'] : 'externip'; 
     31  $sip_settings['externip_val']      = isset($_POST['externip_val']) ? htmlspecialchars($_POST['externip_val']) : ''; 
     32  $sip_settings['externhost_val']    = isset($_POST['externhost_val']) ? htmlspecialchars($_POST['externhost_val']) : ''; 
     33  $sip_settings['externrefresh']     = isset($_POST['externrefresh']) ? htmlspecialchars($_POST['externrefresh']) : '120'; 
     34 
     35  $p_idx = 0; 
     36  $n_idx = 0; 
     37  while (isset($_POST["localnet-$p_idx"])) { 
     38    if ($_POST["localnet-$p_idx"] != '') { 
     39      $sip_settings["localnet_$n_idx"] = htmlspecialchars($_POST["localnet-$p_idx"]); 
     40      $sip_settings["netmask_$n_idx"]  = htmlspecialchars($_POST["netmask-$p_idx"]); 
     41      $n_idx++; 
     42    }  
     43    $p_idx++; 
     44 
     45 
     46  $codecs = array( 
     47    'ulaw'     => '', 
     48    'alaw'     => '', 
     49    'slin'     => '', 
     50    'g726'     => '', 
     51    'gsm'      => '', 
     52    'g729'     => '', 
     53    'ilbc'     => '', 
     54    'g723'     => '', 
     55    'g726aal2' => '', 
     56    'adpcm'    => '', 
     57    'lpc10'    => '', 
     58    'speex'    => '', 
     59    'g722'     => '', 
     60    'jpeg'     => '', 
     61    'png'      => '', 
     62    ); 
     63  foreach (array_keys($codecs) as $codec) { 
     64    $codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
     65 
     66  $sip_settings['codecs']            = $codecs; 
     67  $sip_settings['g726nonstandard']   = isset($_POST['g726nonstandard']) ? $_POST['g726nonstandard'] : 'no'; 
     68  $sip_settings['t38pt_udptl']       = isset($_POST['t38pt_udptl']) ? $_POST['t38pt_udptl'] : 'no'; 
     69 
     70  $video_codecs = array( 
     71    'h261'  => '', 
     72    'h263'  => '', 
     73    'h263p' => '', 
     74    'h264'  => '', 
     75    ); 
     76  foreach (array_keys($video_codecs) as $codec) { 
     77    $video_codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
     78 
     79  $sip_settings['video_codecs']      = $video_codecs; 
     80  $sip_settings['videosupport']      = isset($_POST['videosupport']) ? $_POST['videosupport'] : 'no'; 
     81  $sip_settings['maxcallbitrate']    = isset($_POST['maxcallbitrate']) ? htmlspecialchars($_POST['maxcallbitrate']) : '384'; 
     82 
     83  $sip_settings['canreinvite']       = isset($_POST['canreinvite']) ? $_POST['canreinvite'] : 'no'; 
     84  $sip_settings['rtptimeout']        = isset($_POST['rtptimeout']) ? htmlspecialchars($_POST['rtptimeout']) : '30'; 
     85  $sip_settings['rtpholdtimeout']    = isset($_POST['rtpholdtimeout']) ? htmlspecialchars($_POST['rtpholdtimeout']) : '300'; 
     86  $sip_settings['rtpkeepalive']      = isset($_POST['rtpkeepalive']) ? htmlspecialchars($_POST['rtpkeepalive']) : ''; 
     87 
     88  $sip_settings['checkmwi']          = isset($_POST['checkmwi']) ? htmlspecialchars($_POST['checkmwi']) : ''; 
     89  $sip_settings['notifyringing']     = isset($_POST['notifyringing']) ? $_POST['notifyringing'] : 'no'; 
     90  $sip_settings['notifyhold']        = isset($_POST['notifyhold']) ? $_POST['notifyhold'] : 'no'; 
     91 
     92  $sip_settings['registertimeout']   = isset($_POST['registertimeout']) ? htmlspecialchars($_POST['registertimeout']) : '20'; 
     93  $sip_settings['registerattempts']  = isset($_POST['registerattempts']) ? htmlspecialchars($_POST['registerattempts']) : '0'; 
     94  $sip_settings['maxexpiry']         = isset($_POST['maxexpiry']) ? htmlspecialchars($_POST['maxexpiry']) : '3600'; 
     95  $sip_settings['minexpiry']         = isset($_POST['minexpiry']) ? htmlspecialchars($_POST['minexpiry']) : '60'; 
     96  $sip_settings['defaultexpiry']     = isset($_POST['defaultexpiry']) ? htmlspecialchars($_POST['defaultexpiry']) : '120'; 
     97 
     98  $sip_settings['jbenable']          = isset($_POST['jbenable']) ? $_POST['jbenable'] : 'no'; 
     99  $sip_settings['jbforce']           = isset($_POST['jbforce']) ? $_POST['jbforce'] : 'no'; 
     100  $sip_settings['jpimpl']            = isset($_POST['jpimpl']) ? $_POST['jpimpl'] : 'fixed'; 
     101  $sip_settings['jbmaxsize']         = isset($_POST['jbmaxsize']) ? htmlspecialchars($_POST['jbmaxsize']) : '200'; 
     102  $sip_settings['jbresyncthreshold'] = isset($_POST['jbresyncthreshold']) ? htmlspecialchars($_POST['jbresyncthreshold']) : '1000'; 
     103  $sip_settings['jblog']             = isset($_POST['jblog']) ? $_POST['jblog'] : 'no'; 
     104 
     105  $sip_settings['sip_language']      = isset($_POST['sip-language']) ? htmlspecialchars($_POST['sip-language']) : ''; 
     106  $sip_settings['context']           = isset($_POST['context']) ? htmlspecialchars($_POST['context']) : 'from-sip-external'; 
     107  $sip_settings['bindaddr']          = isset($_POST['bindaddr']) ? htmlspecialchars($_POST['bindaddr']) : '0.0.0.0'; 
     108  $sip_settings['bindport']          = isset($_POST['bindport']) ? htmlspecialchars($_POST['bindport']) : '5060'; 
     109  $sip_settings['allowguest']        = isset($_POST['allowguest']) ? $_POST['allowguest'] : 'yes'; 
     110  $sip_settings['srvlookup']         = isset($_POST['srvlookup']) ? $_POST['srvlookup'] : 'no'; 
     111 
     112  $p_idx = 0; 
     113  $n_idx = 0; 
     114  while (isset($_POST["sip-custom-key-$p_idx"])) { 
     115    if ($_POST["sip-custom-key-$p_idx"] != '') { 
     116      $sip_settings["sip_custom_key_$n_idx"] = htmlspecialchars($_POST["sip-custom-key-$p_idx"]); 
     117      $sip_settings["sip_custom_val_$n_idx"] = htmlspecialchars($_POST["sip-custom-val-$p_idx"]); 
     118      $n_idx++; 
     119    }  
     120    $p_idx++; 
     121 
    122122 
    123123switch ($action) { 
    124  case "edit":  //just delete and re-add 
    125    if (($errors = sipsettings_edit($sip_settings)) !== true) { 
    126      sippsettings_process_errors($errors); 
    127    } else { 
    128      needreload(); 
    129      //redirect_standard(); 
    130    
    131  break; 
    132  default: 
    133    $sip_settings = sipsettings_get(); 
     124  case "edit":  //just delete and re-add 
     125    if (($errors = sipsettings_edit($sip_settings)) !== true) { 
     126      sippsettings_process_errors($errors); 
     127    } else { 
     128      needreload(); 
     129      //redirect_standard(); 
     130   
     131  break; 
     132  default: 
     133    $sip_settings = sipsettings_get(); 
    134134} 
    135135?> 
     
    138138 
    139139<div class="content"> 
    140  <h2><?php echo _("Edit Settings"); ?></h2> 
     140  <h2><?php echo _("Edit Settings"); ?></h2> 
    141141<?php 
    142142 
    143  /* We massaged these above or they came from sipsettings_get() if this is not 
    144  * from and edit. So extract them after sorting out the codec sub arrays. 
     143  /* We massaged these above or they came from sipsettings_get() if this is not 
     144  * from and edit. So extract them after sorting out the codec sub arrays. 
    145145   */ 
    146  $codecs = $sip_settings['codecs']; 
    147  $video_codecs = $sip_settings['video_codecs']; 
    148  unset($sip_settings['codecs']); 
    149  unset($sip_settings['video_codecs']); 
    150  
    151  /* EXTRACT THE VARIABLE HERE - MAKE SURE THEY ARE ALL MASSAGED ABOVE */ 
     146  $codecs = $sip_settings['codecs']; 
     147  $video_codecs = $sip_settings['video_codecs']; 
     148  unset($sip_settings['codecs']); 
     149  unset($sip_settings['video_codecs']); 
     150 
     151  /* EXTRACT THE VARIABLE HERE - MAKE SURE THEY ARE ALL MASSAGED ABOVE */ 
    152152  // 
    153  extract($sip_settings); 
     153  extract($sip_settings); 
    154154 
    155155?> 
    156   <form autocomplete="off" name="editSip" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkConf();"> 
    157   <input type="hidden" name="action" value="edit"> 
    158   <table width="570px"> 
    159  
    160   <tr> 
    161     <td colspan="2"><h5><?php echo _("NAT Settings") ?><hr></h5></td> 
    162   </tr> 
    163  
    164   <tr> 
    165     <td> 
    166       <a href="#" class="info"><?php echo _("Nat")?><span><?php echo _("Asterisk nat setting:<br /> yes = Always ignore info and assume NAT<br /> no = Use NAT mode only according to RFC3581 <br /> never = Never attempt NAT mode or RFC3581 <br /> route = Assume NAT, don't send rport")?></span></a> 
    167     </td> 
    168     <td>  
    169       <table width="100%"> 
    170         <tr> 
    171           <td width="25%"> 
    172             <input id="nat-yes" type="radio" name="nat" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="yes"?"checked=\"yes\"":""?>/> 
    173             <label for="nat-yes">yes</label> 
    174           </td> 
    175  
    176           <td width="25%"> 
    177             <input id="nat-no" type="radio" name="nat" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="no"?"checked=\"no\"":""?>/> 
    178             <label for="nat-no">no</label> 
    179           </td> 
    180  
    181           <td width="25%"> 
    182             <input id="nat-never" type="radio" name="nat" value="never" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="never"?"checked=\"never\"":""?>/> 
    183             <label for="nat-never">never</label> 
    184           </td> 
    185  
    186           <td width="25%"> 
    187             <input id="nat-route" type="radio" name="nat" value="route" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="route"?"checked=\"route\"":""?>/> 
    188             <label for="nat-route">route</label> 
    189           </td> 
    190         </tr> 
    191       </table> 
    192     </td> 
    193   </tr> 
    194  
    195   <tr> 
    196     <td> 
    197       <a href="#" class="info"><?php echo _("IP Configuration")?><span><?php echo _("Indicate whether the box has a public IP or requires NAT settings. Automatic onfiguration of what is often put in sip_nat.conf")?></span></a> 
    198     </td> 
    199     <td> 
    200       <table width="100%"> 
    201         <tr> 
    202           <td> 
    203             <input id="nat-none" type="radio" name="nat_mode" value="public" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="public"?"checked=\"public\"":""?>/> 
    204             <label for="nat-none"><?php echo _("Public") ?></label> 
    205  
    206             <input id="externip" type="radio" name="nat_mode" value="externip" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="externip"?"checked=\"externip\"":""?>/> 
    207             <label for="externip"><?php echo _("Static") ?></label> 
    208  
    209             <input id="externhost" type="radio" name="nat_mode" value="externhost" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="externhost"?"checked=\"externhost\"":""?>/> 
    210             <label for="externhost"><?php echo _("Dynamic") ?></label> 
    211           </td> 
    212         </tr> 
    213       </table> 
    214     </td> 
    215   </tr> 
    216  
    217   <tr class="nat-settings externip"> 
    218     <td><a href="#" class="info"><?php echo _("External IP")?><span><?php echo _("External Static IP or FQDN as seen on the WAN side of the router. (asterisk: externip)")?></span></a></td> 
    219     <td><input type="text" id="externip_val" name="externip_val" value="<?php echo $externip_val ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    220   </tr> 
    221  
    222   <tr class="nat-settings externhost"> 
    223     <td> 
    224       <a href="#" class="info"><?php echo _("Dynamic Host")?><span><?php echo _("External FQDN as seen on the WAN side of the router and updated dynamically, e.g. mydomain.dyndns.com. (asterisk: externhost)")?></span></a> 
    225     </td> 
    226     <td> 
    227       <input type="text" id="externhost_val" name="externhost_val" size="34" value="<?php echo $externhost_val ?>" tabindex="<?php echo ++$tabindex;?>"> 
    228       <input type="text" id="externrefresh" name="externrefresh" size="3" value="<?php echo $externrefresh ?>" tabindex="<?php echo ++$tabindex;?>"> 
    229       <a href="#" class="info"><small><?php echo _("External Refresh")?><span><?php echo _("How often to refresh the External Host FQDN.")?></span></small></a> 
    230     </td> 
    231   </tr> 
    232   <tr class="nat-settings"> 
    233     <td> 
    234       <a href="#" class="info"><?php echo _("Local Networks")?><span><?php echo _("Local network settings (Asterisk: localnet) in the form of ip/mask such as 192.168.1.0/255.255.255.0. For networks with more 1 lan subnets, use the Add Local Network button for more fields.")?></span></a> 
    235     </td> 
    236     <td> 
    237       <input type="text" id="localnet-0" name="localnet-0" class="localnet" value="<?php echo $localnet_0 ?>" tabindex="<?php echo ++$tabindex;?>"> / 
    238       <input type="text" id="netmask-0" name="netmask-0" value="<?php echo $netmask_0 ?>" tabindex="<?php echo ++$tabindex;?>"> 
    239     </td> 
    240   </tr> 
     156  <form autocomplete="off" name="editSip" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" onsubmit="return checkConf();"> 
     157  <input type="hidden" name="action" value="edit"> 
     158  <table width="570px"> 
     159 
     160  <tr> 
     161    <td colspan="2"><h5><?php echo _("NAT Settings") ?><hr></h5></td> 
     162  </tr> 
     163 
     164  <tr> 
     165    <td> 
     166      <a href="#" class="info"><?php echo _("Nat")?><span><?php echo _("Asterisk nat setting:<br /> yes = Always ignore info and assume NAT<br /> no = Use NAT mode only according to RFC3581 <br /> never = Never attempt NAT mode or RFC3581 <br /> route = Assume NAT, don't send rport")?></span></a> 
     167    </td> 
     168    <td> 
     169      <table width="100%"> 
     170        <tr> 
     171          <td width="25%"> 
     172            <input id="nat-yes" type="radio" name="nat" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="yes"?"checked=\"yes\"":""?>/> 
     173            <label for="nat-yes">yes</label> 
     174          </td> 
     175          <td width="25%"> 
     176            <input id="nat-no" type="radio" name="nat" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="no"?"checked=\"no\"":""?>/> 
     177            <label for="nat-no">no</label> 
     178          </td> 
     179          <td width="25%"> 
     180            <input id="nat-never" type="radio" name="nat" value="never" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="never"?"checked=\"never\"":""?>/> 
     181            <label for="nat-never">never</label> 
     182          </td> 
     183          <td width="25%"> 
     184            <input id="nat-route" type="radio" name="nat" value="route" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="route"?"checked=\"route\"":""?>/> 
     185            <label for="nat-route">route</label> 
     186          </td> 
     187        </tr> 
     188      </table> 
     189    </td> 
     190  </tr> 
     191 
     192  <tr> 
     193    <td> 
     194      <a href="#" class="info"><?php echo _("IP Configuration")?><span><?php echo _("Indicate whether the box has a public IP or requires NAT settings. Automatic onfiguration of what is often put in sip_nat.conf")?></span></a> 
     195    </td> 
     196    <td> 
     197      <table width="100%"> 
     198        <tr> 
     199          <td> 
     200            <input id="nat-none" type="radio" name="nat_mode" value="public" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="public"?"checked=\"public\"":""?>/> 
     201            <label for="nat-none"><?php echo _("Public") ?></label> 
     202 
     203            <input id="externip" type="radio" name="nat_mode" value="externip" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="externip"?"checked=\"externip\"":""?>/> 
     204            <label for="externip"><?php echo _("Static") ?></label> 
     205 
     206            <input id="externhost" type="radio" name="nat_mode" value="externhost" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="externhost"?"checked=\"externhost\"":""?>/> 
     207            <label for="externhost"><?php echo _("Dynamic") ?></label> 
     208          </td> 
     209        </tr> 
     210      </table> 
     211    </td> 
     212  </tr> 
     213 
     214  <tr class="nat-settings externip"> 
     215    <td><a href="#" class="info"><?php echo _("External IP")?><span><?php echo _("External Static IP or FQDN as seen on the WAN side of the router. (asterisk: externip)")?></span></a></td> 
     216    <td><input type="text" id="externip_val" name="externip_val" value="<?php echo $externip_val ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
     217  </tr> 
     218 
     219  <tr class="nat-settings externhost"> 
     220    <td> 
     221      <a href="#" class="info"><?php echo _("Dynamic Host")?><span><?php echo _("External FQDN as seen on the WAN side of the router and updated dynamically, e.g. mydomain.dyndns.com. (asterisk: externhost)")?></span></a> 
     222    </td> 
     223    <td> 
     224      <input type="text" id="externhost_val" name="externhost_val" size="34" value="<?php echo $externhost_val ?>" tabindex="<?php echo ++$tabindex;?>"> 
     225      <input type="text" id="externrefresh" name="externrefresh" size="3" class="validate-int" value="<?php echo $externrefresh ?>" tabindex="<?php echo ++$tabindex;?>"> 
     226      <a href="#" class="info"><small><?php echo _("External Refresh")?><span><?php echo _("How often to refresh the External Host FQDN.")?></span></small></a> 
     227    </td> 
     228  </tr> 
     229  <tr class="nat-settings"> 
     230    <td> 
     231      <a href="#" class="info"><?php echo _("Local Networks")?><span><?php echo _("Local network settings (Asterisk: localnet) in the form of ip/mask such as 192.168.1.0/255.255.255.0. For networks with more 1 lan subnets, use the Add Local Network button for more fields.")?></span></a> 
     232    </td> 
     233    <td> 
     234      <input type="text" id="localnet-0" name="localnet-0" class="localnet validate=ip" value="<?php echo $localnet_0 ?>" tabindex="<?php echo ++$tabindex;?>"> / 
     235      <input type="text" id="netmask-0" name="netmask-0" class="validate-netmask" value="<?php echo $netmask_0 ?>" tabindex="<?php echo ++$tabindex;?>"> 
     236    </td> 
     237  </tr> 
    241238 
    242239<?php 
    243  $idx = 1; 
    244  $var_localnet = "localnet_$idx"; 
    245  $var_netmask = "netmask_$idx"; 
    246  while (isset($$var_localnet)) { 
    247    if ($$var_localnet != '') { 
    248      $tabindex++; 
    249      echo <<< END 
    250  <tr class="nat-settings"> 
    251    <td> 
    252    </td> 
    253    <td> 
    254      <input type="text" id="localnet-$idx" name="localnet-$idx" class="localnet" value="{$$var_localnet}" tabindex="$tabindex"> / 
     240  $idx = 1; 
     241  $var_localnet = "localnet_$idx"; 
     242  $var_netmask = "netmask_$idx"; 
     243  while (isset($$var_localnet)) { 
     244    if ($$var_localnet != '') { 
     245      $tabindex++; 
     246      echo <<< END 
     247  <tr class="nat-settings"> 
     248    <td> 
     249    </td> 
     250    <td> 
     251      <input type="text" id="localnet-$idx" name="localnet-$idx" class="localnet validate-ip" value="{$$var_localnet}" tabindex="$tabindex"> / 
    255252END; 
    256      $tabindex++; 
    257      echo <<< END 
    258      <input type="text" id="netmask-$idx" name="netmask-$idx" value="{$$var_netmask}" tabindex="$tabindex"> 
    259    </td> 
    260  </tr> 
     253      $tabindex++; 
     254      echo <<< END 
     255      <input type="text" id="netmask-$idx" name="netmask-$idx" class="validate-netmask" value="{$$var_netmask}" tabindex="$tabindex"> 
     256    </td> 
     257  </tr> 
    261258END; 
    262   } 
    263   $idx++; 
    264   $var_localnet = "localnet_$idx"; 
    265   $var_netmask = "netmask_$idx"; 
    266   } 
     259    } 
     260    $idx++; 
     261    $var_localnet = "localnet_$idx"; 
     262    $var_netmask = "netmask_$idx"; 
     263  } 
     264  $tabindex += 40; // make room for dynamic insertion of new fields so we can add tabindexes 
    267265?> 
    268  <tr class="nat-settings" id="auto-configure-buttons"> 
    269    <td></td> 
    270    <td><br \> 
    271      <input type="button" id="nat-auto-configure"  value="<?php echo _("Auto Configure")?>" class="nat-settings" /> 
    272      <input type="button" id="localnet-add"  value="<?php echo _("Add Local Network")?>" class="nat-settings" /> 
    273    </td> 
    274  </tr> 
    275  
    276  <tr> 
    277    <td colspan="2"><h5><?php echo _("Audio Codecs")?><hr></h5></td> 
    278  </tr> 
    279  <tr> 
    280    <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.")?></span></a></td> 
    281    <td> 
    282    <table width="100%"> 
    283      <tr> 
     266  <tr class="nat-settings" id="auto-configure-buttons"> 
     267    <td></td> 
     268    <td><br \> 
     269      <input type="button" id="nat-auto-configure"  value="<?php echo _("Auto Configure")?>" class="nat-settings" /> 
     270      <input type="button" id="localnet-add"  value="<?php echo _("Add Local Network")?>" class="nat-settings" /> 
     271    </td> 
     272  </tr> 
     273 
     274  <tr> 
     275    <td colspan="2"><h5><?php echo _("Audio Codecs")?><hr></h5></td> 
     276  </tr> 
     277  <tr> 
     278    <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.")?></span></a></td> 
     279    <td> 
     280      <table width="100%"> 
     281        <tr> 
    284282<?php 
    285  $cols = $cols_per_row; 
    286  foreach ($codecs as $codec => $codec_state) { 
    287    if ($cols == 0) { 
    288      echo "</tr><tr>\n"; 
    289      $cols = $cols_per_row; 
    290    
    291    $cols--; 
    292    $tabindex++; 
    293    $codec_trans = _($codec); 
    294    $codec_checked = $codec_state ? 'checked' : ''; 
    295    echo <<< END 
    296        <td width="$width%"> 
    297          <input type="checkbox" value="1" name="$codec" id="$codec" class="audio-codecs" tabindex="$tabindex" $codec_checked /> 
    298          <label for="$codec"> <small>$codec_trans</small> </label> 
    299        </td> 
     283  $cols = $cols_per_row; 
     284  foreach ($codecs as $codec => $codec_state) { 
     285    if ($cols == 0) { 
     286      echo "</tr><tr>\n"; 
     287      $cols = $cols_per_row; 
     288   
     289    $cols--; 
     290    $tabindex++; 
     291    $codec_trans = _($codec); 
     292    $codec_checked = $codec_state ? 'checked' : ''; 
     293    echo <<< END 
     294          <td width="$width%"> 
     295            <input type="checkbox" value="1" name="$codec" id="$codec" class="audio-codecs" tabindex="$tabindex" $codec_checked /> 
     296            <label for="$codec"> <small>$codec_trans</small> </label> 
     297          </td> 
    300298END; 
    301 
     299 
    302300?> 
    303       </tr> 
    304     </table> 
    305     </td> 
    306   </tr> 
    307  
    308   <tr> 
    309     <td> 
    310       <a href="#" class="info"><?php echo _("Non-Standard g726")?><span><?php echo _("Asterisk: g726nonstandard. If the peer negotiates G726-32 audio, use AAL2 packing order instead of RFC3551 packing order (this is required for Sipura and Grandstream ATAs, among others). This is contrary to the RFC3551 specification, the peer _should_ be negotiating AAL2-G726-32 instead.")?></span></a> 
    311     </td> 
    312     <td>  
    313       <table width="100%"> 
    314         <tr> 
    315           <td width="25%"> 
    316             <input id="g726nonstandard-yes" type="radio" name="g726nonstandard" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $g726nonstandard=="yes"?"checked=\"yes\"":""?>/> 
    317             <label for="g726nonstandard-yes"><?php echo _("Yes") ?></label> 
    318           </td> 
    319  
    320           <td width="25%"> 
    321             <input id="g726nonstandard-no" type="radio" name="g726nonstandard" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $g726nonstandard=="no"?"checked=\"no\"":""?>/> 
    322             <label for="g726nonstandard-no"><?php echo _("No") ?></label> 
    323           </td> 
    324  
    325           <td width="25%"> </td><td width="25%"></td> 
    326         </tr> 
    327       </table> 
    328     </td> 
    329   </tr> 
    330  
    331   <tr> 
    332     <td> 
    333       <a href="#" class="info"><?php echo _("T38 Pass-Through")?><span><?php echo _("Asterisk: t38pt_udptl. Enables T38 passthrough if enabled. This SIP channels that support sending/receiving T38 Fax codecs to pass the call. Asterisk can not process the media.")?></span></a> 
    334     </td> 
    335     <td>  
    336       <table width="100%"> 
    337         <tr> 
    338           <td width="25%"> 
    339             <input id="t38pt_udptl-yes" type="radio" name="t38pt_udptl" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $t38pt_udptl=="yes"?"checked=\"yes\"":""?>/> 
    340             <label for="t38pt_udptl-yes"><?php echo _("Yes") ?></label> 
    341           </td> 
    342  
    343           <td width="25%"> 
    344             <input id="t38pt_udptl-no" type="radio" name="t38pt_udptl" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $t38pt_udptl=="no"?"checked=\"no\"":""?>/> 
    345             <label for="t38pt_udptl-no"><?php echo _("No") ?></label> 
    346           </td> 
    347  
    348           <td width="25%"> </td><td width="25%"></td> 
    349         </tr> 
    350       </table> 
    351     </td> 
    352   </tr> 
    353  
    354   <tr> 
    355     <td colspan="2"><h5><?php echo _("Video Codecs")?><hr></h5></td> 
    356   </tr> 
    357  
    358   <tr> 
    359     <td><a href="#" class="info"><?php echo _("Video Support")?><span><?php echo _("Check to enable and then choose allowed codecs.")?></span></a></td> 
    360     <td>  
    361       <table width="100%"> 
    362         <tr> 
    363           <td width="25%"> 
    364             <input id="videosupport-yes" type="radio" name="videosupport" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $videosupport=="yes"?"checked=\"yes\"":""?>/> 
    365             <label for="videosupport-yes"><?php echo _("Enabled") ?></label> 
    366           </td> 
    367  
    368           <td width="25%"> 
    369             <input id="videosupport-no" type="radio" name="videosupport" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $videosupport=="no"?"checked=\"no\"":""?>/> 
    370             <label for="videosupport-no"><?php echo _("Disabled") ?></label> 
    371           </td> 
    372  
    373           <td width="25%"> </td><td width="25%"></td> 
    374         </tr> 
    375       </table> 
    376     </td> 
    377   </tr> 
    378   <tr class="video-codecs"> 
    379     <td></td> 
    380     <td> 
    381     <table width="100%"> 
    382       <tr> 
     301        </tr> 
     302      </table> 
     303    </td> 
     304  </tr> 
     305 
     306  <tr> 
     307    <td> 
     308      <a href="#" class="info"><?php echo _("Non-Standard g726")?><span><?php echo _("Asterisk: g726nonstandard. If the peer negotiates G726-32 audio, use AAL2 packing order instead of RFC3551 packing order (this is required for Sipura and Grandstream ATAs, among others). This is contrary to the RFC3551 specification, the peer _should_ be negotiating AAL2-G726-32 instead.")?></span></a> 
     309    </td> 
     310    <td> 
     311      <table width="100%"> 
     312        <tr> 
     313          <td width="25%"> 
     314            <input id="g726nonstandard-yes" type="radio" name="g726nonstandard" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $g726nonstandard=="yes"?"checked=\"yes\"":""?>/> 
     315            <label for="g726nonstandard-yes"><?php echo _("Yes") ?></label> 
     316          </td> 
     317          <td width="25%"> 
     318            <input id="g726nonstandard-no" type="radio" name="g726nonstandard" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $g726nonstandard=="no"?"checked=\"no\"":""?>/> 
     319            <label for="g726nonstandard-no"><?php echo _("No") ?></label> 
     320          </td> 
     321          <td width="25%"> </td><td width="25%"></td> 
     322        </tr> 
     323      </table> 
     324    </td> 
     325  </tr> 
     326 
     327  <tr> 
     328    <td> 
     329      <a href="#" class="info"><?php echo _("T38 Pass-Through")?><span><?php echo _("Asterisk: t38pt_udptl. Enables T38 passthrough if enabled. This SIP channels that support sending/receiving T38 Fax codecs to pass the call. Asterisk can not process the media.")?></span></a> 
     330    </td> 
     331    <td> 
     332      <table width="100%"> 
     333        <tr> 
     334          <td width="25%"> 
     335            <input id="t38pt_udptl-yes" type="radio" name="t38pt_udptl" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $t38pt_udptl=="yes"?"checked=\"yes\"":""?>/> 
     336            <label for="t38pt_udptl-yes"><?php echo _("Yes") ?></label> 
     337          </td> 
     338          <td width="25%"> 
     339            <input id="t38pt_udptl-no" type="radio" name="t38pt_udptl" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $t38pt_udptl=="no"?"checked=\"no\"":""?>/> 
     340            <label for="t38pt_udptl-no"><?php echo _("No") ?></label> 
     341          </td> 
     342          <td width="25%"> </td><td width="25%"></td> 
     343        </tr> 
     344      </table> 
     345    </td> 
     346  </tr> 
     347 
     348  <tr> 
     349    <td colspan="2"><h5><?php echo _("Video Codecs")?><hr></h5></td> 
     350  </tr> 
     351 
     352  <tr> 
     353    <td> 
     354      <a href="#" class="info"><?php echo _("Video Support")?><span><?php echo _("Check to enable and then choose allowed codecs.")?></span></a> 
     355    </td> 
     356    <td> 
     357      <table width="100%"> 
     358        <tr> 
     359          <td width="25%"> 
     360            <input id="videosupport-yes" type="radio" name="videosupport" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $videosupport=="yes"?"checked=\"yes\"":""?>/> 
     361            <label for="videosupport-yes"><?php echo _("Enabled") ?></label> 
     362          </td> 
     363          <td width="25%"> 
     364            <input id="videosupport-no" type="radio" name="videosupport" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $videosupport=="no"?"checked=\"no\"":""?>/> 
     365            <label for="videosupport-no"><?php echo _("Disabled") ?></label> 
     366          </td> 
     367          <td width="25%"> </td><td width="25%"></td> 
     368        </tr> 
     369      </table> 
     370    </td> 
     371  </tr> 
     372  <tr class="video-codecs"> 
     373    <td></td> 
     374    <td> 
     375      <table width="100%"> 
     376        <tr> 
    383377<?php 
    384  $cols = $cols_per_row; 
    385  foreach ($video_codecs as $codec => $codec_state) { 
    386    if ($cols == 0) { 
    387      echo "</tr><tr class=\"video-codecs\">\n"; 
    388      $cols = $cols_per_row; 
    389    
    390    $cols--; 
    391    $tabindex++; 
    392    $codec_trans = _($codec); 
    393    $codec_checked = $codec_state ? 'checked' : ''; 
    394    echo <<< END 
    395        <td width="$width%"> 
    396          <input type="checkbox" value="1" name="$codec" id="$codec" class="video-codecs" tabindex="$tabindex" $codec_checked /> 
    397          <label for="$codec"><small> $codec_trans </small></label> 
    398        </td> 
     378  $cols = $cols_per_row; 
     379  foreach ($video_codecs as $codec => $codec_state) { 
     380    if ($cols == 0) { 
     381      echo "</tr><tr class=\"video-codecs\">\n"; 
     382      $cols = $cols_per_row; 
     383   
     384    $cols--; 
     385    $tabindex++; 
     386    $codec_trans = _($codec); 
     387    $codec_checked = $codec_state ? 'checked' : ''; 
     388    echo <<< END 
     389          <td width="$width%"> 
     390            <input type="checkbox" value="1" name="$codec" id="$codec" class="video-codecs" tabindex="$tabindex" $codec_checked /> 
     391            <label for="$codec"><small> $codec_trans </small></label> 
     392          </td> 
    399393END; 
    400 
     394 
    401395?> 
    402       </tr> 
    403     </table> 
    404  
    405     </td> 
    406   </tr> 
    407  
    408   <tr class="video-codecs"> 
    409     <td> 
    410       <a href="#" class="info"><?php echo _("Max Bit Rate")?><span><?php echo _("Maximum bitrate for video calls in kb/s")?></span></a> 
    411     </td> 
    412     <td><input type="text" size="3" id="maxcallbitrate" name="maxcallbitrate" class="video-codecs" value="<?php echo $maxcallbitrate ?>" tabindex="<?php echo ++$tabindex;?>"> <small><?php echo _("kb/s") ?></small></td> 
    413   </tr> 
    414  
    415   <tr> 
    416     <td colspan="2"><h5><?php echo _("MEDIA & RTP Settings") ?><hr></h5></td> 
    417   </tr> 
    418  
    419   <tr> 
    420     <td> 
    421       <a href="#" class="info"><?php echo _("Reinvite Behavior")?><span><?php echo _("Asterisk: canreinvite. yes: standard reinvites; no: never; nonat: An additional option is to allow media path redirection (reinvite) but only when the peer where the media is being sent is known to not be behind a NAT (as the RTP core can determine it based on the apparent IP address the media arrives from; update: use UPDATE for media path redirection, instead of INVITE. (yes = update + nonat)")?></span></a> 
    422     </td> 
    423     <td>  
    424       <table width="100%"> 
    425         <tr> 
    426           <td width="25%"> 
    427             <input id="canreinvite-yes" type="radio" name="canreinvite" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="yes"?"checked=\"yes\"":""?>/> 
    428             <label for="canreinvite-yes"><?php echo _("Yes") ?></label> 
    429           </td> 
    430  
    431           <td width="25%"> 
    432             <input id="canreinvite-no" type="radio" name="canreinvite" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="no"?"checked=\"no\"":""?>/> 
    433             <label for="canreinvite-no"><?php echo _("No") ?></label> 
    434           </td> 
    435  
    436           <td width="25%"> 
    437             <input id="canreinvite-nonat" type="radio" name="canreinvite" value="nonat" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="nonat"?"checked=\"nonat\"":""?>/> 
    438             <label for="canreinvite-nonat">never</label> 
    439           </td> 
    440  
    441           <td width="25%"> 
    442             <input id="canreinvite-update" type="radio" name="canreinvite" value="update" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="update"?"checked=\"update\"":""?>/> 
    443             <label for="canreinvite-update">update</label> 
    444           </td> 
    445         </tr> 
    446       </table> 
    447     </td> 
    448   </tr> 
    449  
    450   <tr> 
    451     <td> 
    452       <a href="#" class="info"><?php echo _("RTP Timers")?><span><?php echo _("Asterisk: rtptimeout. Terminate call if rtptimeout seconds of no RTP or RTCP activity on the audio channel when we're not on hold. This is to be able to hangup a call in the case of a phone disappearing from the net, like a powerloss or someone tripping over a cable.<br /> 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). <br /> Asterisk: rtpkeepalive. Send keepalives in the RTP stream to keep NAT open during periods where no RTP stream may be flowing (like on hold).")?></span></a> 
    453     </td> 
    454     <td> 
    455         <input type="text" size="2" id="rtptimeout" name="rtptimeout" value="<?php echo $rtptimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtptimeout)</small>&nbsp; 
    456         <input type="text" size="2" id="rtpholdtimeout" name="rtpholdtimeout" value="<?php echo $rtpholdtimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtpholdtimeout)</small>&nbsp; 
    457         <input type="text" size="2" id="rtpkeepalive" name="rtpkeepalive" value="<?php echo $rtpkeepalive ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtpkeepalive)</small> 
    458     </td> 
    459   </tr> 
    460  
    461   <tr> 
    462     <td colspan="2"><h5><?php echo _("Notification & MWI")?><hr></h5></td> 
    463   </tr> 
    464  
    465   <tr> 
    466     <td> 
    467       <a href="#" class="info"><?php echo _("MWI Polling Freq")?><span><?php echo _("Frequency in seconds to check if MWI state has changed and inform peers.")?></span></a> 
    468     </td> 
    469     <td><input type="text" size="3" id="checkmwi" name="checkmwi" value="<?php echo $checkmwi ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    470   </tr> 
    471  
    472   <tr> 
    473     <td> 
    474       <a href="#" class="info"><?php echo _("Notify Ringing")?><span><?php echo _("Control whether subscriptions already INUSE get sent RINGING when another call is sent. Useful when using BLF.")?></span></a> 
    475     </td> 
    476     <td>  
    477       <table width="100%"> 
    478         <tr> 
    479           <td width="25%"> 
    480             <input id="notifyringing-yes" type="radio" name="notifyringing" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyringing=="yes"?"checked=\"yes\"":""?>/> 
    481             <label for="notifyringing-yes"><?php echo _("Yes") ?></label> 
    482           </td> 
    483  
    484           <td width="25%"> 
    485             <input id="notifyringing-no" type="radio" name="notifyringing" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyringing=="no"?"checked=\"no\"":""?>/> 
    486             <label for="notifyringing-no"><?php echo _("No") ?></label> 
    487           </td> 
    488  
    489           <td width="25%"> </td><td width="25%"></td> 
    490         </tr> 
    491       </table> 
    492     </td> 
    493   </tr> 
    494  
    495   <tr> 
    496     <td> 
    497       <a href="#" class="info"><?php echo _("Notify Hold")?><span><?php echo _("Control whether subscriptions INUSE get sent ONHOLD when call is placed on hold. Useful when using BLF.")?></span></a> 
    498     </td> 
    499     <td>  
    500       <table width="100%"> 
    501         <tr> 
    502           <td width="25%"> 
    503             <input id="notifyhold-yes" type="radio" name="notifyhold" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyhold=="yes"?"checked=\"yes\"":""?>/> 
    504             <label for="notifyhold-yes"><?php echo _("Yes") ?></label> 
    505           </td> 
    506  
    507           <td width="25%"> 
    508             <input id="notifyhold-no" type="radio" name="notifyhold" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyhold=="no"?"checked=\"no\"":""?>/> 
    509             <label for="notifyhold-no"><?php echo _("No") ?></label> 
    510           </td> 
    511  
    512           <td width="25%"> </td><td width="25%"></td> 
    513         </tr> 
    514       </table> 
    515     </td> 
    516   </tr> 
    517  
    518   <tr> 
    519     <td colspan="2"><h5><?php echo _("Registration Settings") ?><hr></h5></td> 
    520   </tr> 
    521  
    522   <tr> 
    523     <td> 
    524       <a href="#" class="info"><?php echo _("Registration Attempts")?><span><?php echo _("Asterisk: registertimeout. Retry registration attempts every registertimeout seconds until successful or until registrationattempts tries have been made.<br /> 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 outagages.")?></span></a> 
    525     </td> 
    526     <td> 
    527         <input type="text" size="2" id="registertimeout" name="registertimeout" value="<?php echo $registertimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(registertimeout)</small>&nbsp; 
    528         <input type="text" size="2" id="registerattempts" name="registerattempts" value="<?php echo $registerattempts ?>" tabindex="<?php echo ++$tabindex;?>"><small>(registerattempts)</small> 
    529     </td> 
    530   </tr> 
    531  
    532   <tr> 
    533     <td> 
    534       <a href="#" class="info"><?php echo _("Registration Times")?><span><?php echo _("Asterisk: minexpiry. Minimum length of registrations/subscriptions.<br /> Asterisk: maxepiry. Maximum allowed time of incoming registrations<br /> Asterisk: defaultexpiry. Default length of incoming and outgoing registrations.")?></span></a> 
    535     </td> 
    536     <td> 
    537         <input type="text" size="2" id="minexpiry" name="minexpiry" value="<?php echo $minexpiry ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(minexpiry)</small>&nbsp; 
    538         <input type="text" size="3" id="maxexpiry" name="maxexpiry" value="<?php echo $maxexpiry ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(maxexpiry)</small>&nbsp; 
    539         <input type="text" size="3" id="defaultexpiry" name="defaultexpiry" value="<?php echo $defaultexpiry ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(defaultexpiry)</small> 
    540     </td> 
    541   </tr> 
    542  
    543   <tr> 
    544     <td colspan="2"><h5><?php echo _("Jitter Buffer Settings") ?><hr></h5></td> 
    545   </tr> 
    546  
    547   <tr> 
    548     <td><a href="#" class="info"><?php echo _("Jitter Buffer")?><span><?php echo _("Asterisk: jbenable. Enables the use of a jitterbuffer on the receiving side of a SIP channel. An enabled jitterbuffer will be used only if the sending side can create and the receiving side can not accept jitter. The SIP channel can accept jitter, thus a jitterbuffer on the receive SIP side will be used only if it is forced and enabled. An example is if receiving from a jittery channel to voicemail, the jitter buffer will be used if enabled. However, it will not be used when sending to a SIP endpoint since they usually have their own jitter buffers. See jbforce to force it's use always.")?></span></a></td> 
    549     <td>  
    550       <table width="100%"> 
    551         <tr> 
    552           <td width="25%"> 
    553             <input id="jbenable-yes" type="radio" name="jbenable" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbenable=="yes"?"checked=\"yes\"":""?>/> 
    554             <label for="jbenable-yes"><?php echo _("Enabled") ?></label> 
    555           </td> 
    556  
    557           <td width="25%"> 
    558             <input id="jbenable-no" type="radio" name="jbenable" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbenable=="no"?"checked=\"no\"":""?>/> 
    559             <label for="jbenable-no"><?php echo _("Disabled") ?></label> 
    560           </td> 
    561  
    562           <td width="25%"> </td><td width="25%"></td> 
    563         </tr> 
    564       </table> 
    565     </td> 
    566   </tr> 
    567  
    568   <tr class="jitter-buffer"> 
    569     <td><a href="#" class="info"><?php echo _("Force Jitter Buffer")?><span><?php echo _("Asterisk: jbforce. Forces the use of a jitterbuffer on the receive side of a SIP channel. Normally the jitter buffer will not be used if receiving a jittery channel but sending it off to another channel such as another 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></td> 
    570     <td>  
    571       <table width="100%"> 
    572         <tr> 
    573           <td width="25%"> 
    574             <input id="jbforce-yes" type="radio" name="jbforce" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbforce=="yes"?"checked=\"yes\"":""?>/> 
    575             <label for="jbforce-yes"><?php echo _("Yes") ?></label> 
    576           </td> 
    577  
    578           <td width="25%"> 
    579             <input id="jbforce-no" type="radio" name="jbforce" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbforce=="no"?"checked=\"no\"":""?>/> 
    580             <label for="jbforce-no"><?php echo _("No") ?></label> 
    581           </td> 
    582  
    583           <td width="25%"> </td><td width="25%"></td> 
    584         </tr> 
    585       </table> 
    586     </td> 
    587   </tr> 
    588  
    589   <tr class="jitter-buffer"> 
    590     <td><a href="#" class="info"><?php echo _("Implementation")?><span><?php echo _("Asterisk: jbimpl. Jitterbuffer implementation, used on the receiving side of a SIP channel. Two implementations are currently available:<br /> fixed: size always equals to jbmaxsize;<br />) adaptive: with variable size (the new jb of IAX2).")?></span></a></td> 
    591     <td>  
    592       <table width="100%"> 
    593         <tr> 
    594           <td width="25%"> 
    595             <input id="jbimpl-fixed" type="radio" name="jbimpl" class="jitter-buffer" value="fixed" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbimpl=="fixed"?"checked=\"fixed\"":""?>/> 
    596             <label for="jbimpl-fixed"><?php echo _("Fixed") ?></label> 
    597           </td> 
    598  
    599           <td width="25%"> 
    600             <input id="jbimpl-adaptive" type="radio" name="jbimpl" class="jitter-buffer" value="adaptive" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbimpl=="adaptive"?"checked=\"adaptive\"":""?>/> 
    601             <label for="jbimpl-adaptive"><?php echo _("Adaptive") ?></label> 
    602           </td> 
    603  
    604           <td width="25%"> </td><td width="25%"></td> 
    605         </tr> 
    606       </table> 
    607     </td> 
    608   </tr> 
    609  
    610   <tr class="jitter-buffer"> 
    611     <td><a href="#" class="info"><?php echo _("Jitter Buffer Logging")?><span><?php echo _("Asterisk: jblog. Enables jitter buffer frame logging.")?></span></a></td> 
    612     <td>  
    613       <table width="100%"> 
    614         <tr> 
    615           <td width="25%"> 
    616             <input id="jblog-yes" type="radio" name="jblog" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jblog=="yes"?"checked=\"yes\"":""?>/> 
    617             <label for="jblog-yes"><?php echo _("Enable") ?></label> 
    618           </td> 
    619  
    620           <td width="25%"> 
    621             <input id="jblog-no" type="radio" name="jblog" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jblog=="no"?"checked=\"no\"":""?>/> 
    622             <label for="jblog-no"><?php echo _("Disable") ?></label> 
    623           </td> 
    624  
    625           <td width="25%"> </td><td width="25%"></td> 
    626         </tr> 
    627       </table> 
    628     </td> 
    629   </tr> 
    630  
    631   <tr class="jitter-buffer"> 
    632     <td><a href="#" class="info"><?php echo _("Jitter Buffer Size")?><span><?php echo _("Asterisk: jbmaxsize. Max length of the jitterbuffer in milliseconds.<br /> 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.")?></span></a></td> 
    633     <td> 
    634       <input type="text" size="4" id="jbmaxsize" name="jbmaxsize" class="jitter-buffer" value="<?php echo $jbmaxsize ?>" tabindex="<?php echo ++$tabindex;?>"><small>(jbmaxsize)</small>&nbsp; 
    635       <input type="text" size="4" id="jbresyncthreshold" name="jbresyncthreshold" class="jitter-buffer" value="<?php echo $jbresyncthreshold ?>" tabindex="<?php echo ++$tabindex;?>"><small>(jbresyncthreshold)</small>&nbsp; 
    636     </td> 
    637   </tr> 
    638  
    639   <tr> 
    640     <td colspan="2"><h5><?php echo _("Advanced General Settings") ?><hr></h5></td> 
    641   </tr> 
    642   <tr> 
    643     <td> 
    644       <a href="#" class="info"><?php echo _("Language")?><span><?php echo _("Default Language for a channel, Asterisk: language")?></span></a> 
    645     </td> 
    646     <td><input type="text" id="sip-language" name="sip-language" value="<?php echo $sip_language ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    647   </tr> 
    648  
    649   <tr> 
    650     <td> 
    651       <a href="#" class="info"><?php echo _("Default Context")?><span><?php echo _("Asterisk: context. Default context for incoming calls if not specified. FreePBX sets this to from-sip-extenral which is used in conjunction with the Allow Anonymous SIP calls. If you change this you will effect that behavior.")?></span></a> 
    652     </td> 
    653     <td><input type="text" id="default-context" name="default-context" value="<?php echo $context ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    654   </tr> 
    655  
    656   <tr> 
    657     <td> 
    658       <a href="#" class="info"><?php echo _("Bind Address")?><span><?php echo _("Asterisk: bindaddr. The IP adderss to bind to and listen for calls on the Bind Port. If set to 0.0.0.0 Asterisk will listen on all addresses.")?></span></a> 
    659     </td> 
    660     <td><input type="text" id="bindaddr" name="bindaddr" value="<?php echo $bindaddr ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    661   </tr> 
    662  
    663   <tr> 
    664     <td> 
    665       <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 SIP messages. The SIP standard is 5060 and in most cases this is what you want.")?></span></a> 
    666     </td> 
    667     <td><input type="text" id="bindaddr" name="bindport" value="<?php echo $bindport ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    668   </tr> 
    669  
    670   <tr> 
    671     <td> 
    672       <a href="#" class="info"><?php echo _("Allow SIP Guests")?><span><?php echo _("Asterisk: allowguest. When set Asterisk will allow Guest SIP calls and send them to the Default SIP context. Turning this off will keep anonymous SIP calls from entering the system. However, the Allow Anonymous SIP calls from the General Settings section will not function. Allowing guest calls but rejecting the Anonymous SIP calls in the General Section will enable you to see the call attempts and debug incoming calls that may be mis-configured and appearing as guests.")?></span></a> 
    673     </td> 
    674     <td>  
    675       <table width="100%"> 
    676         <tr> 
    677           <td width="25%"> 
    678             <input id="allowguest-yes" type="radio" name="allowguest" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $allowguest=="yes"?"checked=\"yes\"":""?>/> 
    679             <label for="allowguest-yes"><?php echo _("Yes") ?></label> 
    680           </td> 
    681  
    682           <td width="25%"> 
    683             <input id="allowguest-no" type="radio" name="allowguest" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $allowguest=="no"?"checked=\"no\"":""?>/> 
    684             <label for="allowguest-no"><?php echo _("No") ?></label> 
    685           </td> 
    686  
    687           <td width="25%"> </td><td width="25%"></td> 
    688         </tr> 
    689       </table> 
    690     </td> 
    691   </tr> 
    692  
    693   <tr> 
    694     <td> 
    695       <a href="#" class="info"><?php echo _("SRV Lookup")?><span><?php echo _("Enable Asterisk srvlookup. See current version of Asterisk for limitations on SRV functionality.")?></span></a> 
    696     </td> 
    697     <td>  
    698       <table width="100%"> 
    699         <tr> 
    700           <td width="25%"> 
    701             <input id="srvlookup-yes" type="radio" name="srvlookup" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $srvlookup=="yes"?"checked=\"yes\"":""?>/> 
    702             <label for="srvlookup-yes"><?php echo _("Enabled") ?></label> 
    703           </td> 
    704  
    705           <td width="25%"> 
    706             <input id="srvlookup-no" type="radio" name="srvlookup" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $srvlookup=="no"?"checked=\"no\"":""?>/> 
    707             <label for="srvlookup-no"><?php echo _("Disabled") ?></label> 
    708           </td> 
    709  
    710           <td width="25%"> </td><td width="25%"></td> 
    711         </tr> 
    712       </table> 
    713     </td> 
    714   </tr> 
    715  
    716   <tr><td colspan="2"><br /></td></tr> 
    717  
    718   <tr> 
    719     <td> 
    720       <a href="#" class="info"><?php echo _("Other SIP Settings")?><span><?php echo _("You may set any other SIP settings not present here that are allowed to be configured in the General section of sip.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.")?></span></a> 
    721     </td> 
    722     <td> 
    723       <input type="text" id="sip-custom-key-0" name="sip-custom-key-0" class="sip-custom" value="<?php echo $sip_custom_key_0 ?>" tabindex="<?php echo ++$tabindex;?>"> = 
    724       <input type="text" id="sip-custom-val-0" name="sip-custom-val-0" value="<?php echo $sip_custom_val_0 ?>" tabindex="<?php echo ++$tabindex;?>"> 
    725     </td> 
    726   </tr> 
     396        </tr> 
     397      </table> 
     398    </td> 
     399  </tr> 
     400 
     401  <tr class="video-codecs"> 
     402    <td> 
     403      <a href="#" class="info"><?php echo _("Max Bit Rate")?><span><?php echo _("Maximum bitrate for video calls in kb/s")?></span></a> 
     404    </td> 
     405    <td><input type="text" size="3" id="maxcallbitrate" name="maxcallbitrate" class="video-codecs validate-int" value="<?php echo $maxcallbitrate ?>" tabindex="<?php echo ++$tabindex;?>"> <small><?php echo _("kb/s") ?></small></td> 
     406  </tr> 
     407 
     408  <tr> 
     409    <td colspan="2"><h5><?php echo _("MEDIA & RTP Settings") ?><hr></h5></td> 
     410  </tr> 
     411 
     412  <tr> 
     413    <td> 
     414      <a href="#" class="info"><?php echo _("Reinvite Behavior")?><span><?php echo _("Asterisk: canreinvite. yes: standard reinvites; no: never; nonat: An additional option is to allow media path redirection (reinvite) but only when the peer where the media is being sent is known to not be behind a NAT (as the RTP core can determine it based on the apparent IP address the media arrives from; update: use UPDATE for media path redirection, instead of INVITE. (yes = update + nonat)")?></span></a> 
     415    </td> 
     416    <td> 
     417      <table width="100%"> 
     418        <tr> 
     419          <td width="25%"> 
     420            <input id="canreinvite-yes" type="radio" name="canreinvite" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="yes"?"checked=\"yes\"":""?>/> 
     421            <label for="canreinvite-yes"><?php echo _("Yes") ?></label> 
     422          </td> 
     423          <td width="25%"> 
     424            <input id="canreinvite-no" type="radio" name="canreinvite" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="no"?"checked=\"no\"":""?>/> 
     425            <label for="canreinvite-no"><?php echo _("No") ?></label> 
     426          </td> 
     427          <td width="25%"> 
     428            <input id="canreinvite-nonat" type="radio" name="canreinvite" value="nonat" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="nonat"?"checked=\"nonat\"":""?>/> 
     429            <label for="canreinvite-nonat">never</label> 
     430          </td> 
     431          <td width="25%"> 
     432            <input id="canreinvite-update" type="radio" name="canreinvite" value="update" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="update"?"checked=\"update\"":""?>/> 
     433            <label for="canreinvite-update">update</label> 
     434          </td> 
     435        </tr> 
     436      </table> 
     437    </td> 
     438  </tr> 
     439 
     440  <tr> 
     441    <td> 
     442      <a href="#" class="info"><?php echo _("RTP Timers")?><span><?php echo _("Asterisk: rtptimeout. Terminate call if rtptimeout seconds of no RTP or RTCP activity on the audio channel when we're not on hold. This is to be able to hangup a call in the case of a phone disappearing from the net, like a powerloss or someone tripping over a cable.<br /> 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). <br /> Asterisk: rtpkeepalive. Send keepalives in the RTP stream to keep NAT open during periods where no RTP stream may be flowing (like on hold).")?></span></a> 
     443    </td> 
     444    <td> 
     445      <input type="text" size="2" id="rtptimeout" name="rtptimeout" class="validate-int" value="<?php echo $rtptimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtptimeout)</small>&nbsp; 
     446      <input type="text" size="2" id="rtpholdtimeout" name="rtpholdtimeout" class="validate-int" value="<?php echo $rtpholdtimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtpholdtimeout)</small>&nbsp; 
     447      <input type="text" size="2" id="rtpkeepalive" name="rtpkeepalive" class="validate-int" value="<?php echo $rtpkeepalive ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtpkeepalive)</small> 
     448    </td> 
     449  </tr> 
     450 
     451  <tr> 
     452    <td colspan="2"><h5><?php echo _("Notification & MWI")?><hr></h5></td> 
     453  </tr> 
     454 
     455  <tr> 
     456    <td> 
     457      <a href="#" class="info"><?php echo _("MWI Polling Freq")?><span><?php echo _("Frequency in seconds to check if MWI state has changed and inform peers.")?></span></a> 
     458    </td> 
     459    <td><input type="text" size="3" id="checkmwi" name="checkmwi" class="validate-int" value="<?php echo $checkmwi ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
     460  </tr> 
     461 
     462  <tr> 
     463    <td> 
     464      <a href="#" class="info"><?php echo _("Notify Ringing")?><span><?php echo _("Control whether subscriptions already INUSE get sent RINGING when another call is sent. Useful when using BLF.")?></span></a> 
     465    </td> 
     466    <td> 
     467      <table width="100%"> 
     468        <tr> 
     469          <td width="25%"> 
     470            <input id="notifyringing-yes" type="radio" name="notifyringing" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyringing=="yes"?"checked=\"yes\"":""?>/> 
     471            <label for="notifyringing-yes"><?php echo _("Yes") ?></label> 
     472          </td> 
     473          <td width="25%"> 
     474            <input id="notifyringing-no" type="radio" name="notifyringing" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyringing=="no"?"checked=\"no\"":""?>/> 
     475            <label for="notifyringing-no"><?php echo _("No") ?></label> 
     476          </td> 
     477          <td width="25%"> </td><td width="25%"></td> 
     478        </tr> 
     479      </table> 
     480    </td> 
     481  </tr> 
     482 
     483  <tr> 
     484    <td> 
     485      <a href="#" class="info"><?php echo _("Notify Hold")?><span><?php echo _("Control whether subscriptions INUSE get sent ONHOLD when call is placed on hold. Useful when using BLF.")?></span></a> 
     486    </td> 
     487    <td> 
     488      <table width="100%"> 
     489        <tr> 
     490          <td width="25%"> 
     491            <input id="notifyhold-yes" type="radio" name="notifyhold" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyhold=="yes"?"checked=\"yes\"":""?>/> 
     492            <label for="notifyhold-yes"><?php echo _("Yes") ?></label> 
     493          </td> 
     494          <td width="25%"> 
     495            <input id="notifyhold-no" type="radio" name="notifyhold" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyhold=="no"?"checked=\"no\"":""?>/> 
     496            <label for="notifyhold-no"><?php echo _("No") ?></label> 
     497          </td> 
     498          <td width="25%"> </td><td width="25%"></td> 
     499        </tr> 
     500      </table> 
     501    </td> 
     502  </tr> 
     503 
     504  <tr> 
     505    <td colspan="2"><h5><?php echo _("Registration Settings") ?><hr></h5></td> 
     506  </tr> 
     507 
     508  <tr> 
     509    <td> 
     510      <a href="#" class="info"><?php echo _("Registration Attempts")?><span><?php echo _("Asterisk: registertimeout. Retry registration attempts every registertimeout seconds until successful or until registrationattempts tries have been made.<br /> 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 outagages.")?></span></a> 
     511    </td> 
     512    <td> 
     513      <input type="text" size="2" id="registertimeout" name="registertimeout" class="validate-int" value="<?php echo $registertimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(registertimeout)</small>&nbsp; 
     514      <input type="text" size="2" id="registerattempts" name="registerattempts" class="validate-int" value="<?php echo $registerattempts ?>" tabindex="<?php echo ++$tabindex;?>"><small>(registerattempts)</small> 
     515    </td> 
     516  </tr> 
     517 
     518  <tr> 
     519    <td> 
     520      <a href="#" class="info"><?php echo _("Registration Times")?><span><?php echo _("Asterisk: minexpiry. Minimum length of registrations/subscriptions.<br /> Asterisk: maxepiry. Maximum allowed time of incoming registrations<br /> Asterisk: defaultexpiry. Default length of incoming and outgoing registrations.")?></span></a> 
     521    </td> 
     522    <td> 
     523      <input type="text" size="2" id="minexpiry" name="minexpiry" class="validate-int" value="<?php echo $minexpiry ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(minexpiry)</small>&nbsp; 
     524      <input type="text" size="3" id="maxexpiry" name="maxexpiry" class="validate-int" value="<?php echo $maxexpiry ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(maxexpiry)</small>&nbsp; 
     525      <input type="text" size="3" id="defaultexpiry" name="defaultexpiry" class="validate-int" value="<?php echo $defaultexpiry ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(defaultexpiry)</small> 
     526    </td> 
     527  </tr> 
     528 
     529  <tr> 
     530    <td colspan="2"><h5><?php echo _("Jitter Buffer Settings") ?><hr></h5></td> 
     531  </tr> 
     532 
     533  <tr> 
     534    <td><a href="#" class="info"><?php echo _("Jitter Buffer")?><span><?php echo _("Asterisk: jbenable. Enables the use of a jitterbuffer on the receiving side of a SIP channel. An enabled jitterbuffer will be used only if the sending side can create and the receiving side can not accept jitter. The SIP channel can accept jitter, thus a jitterbuffer on the receive SIP side will be used only if it is forced and enabled. An example is if receiving from a jittery channel to voicemail, the jitter buffer will be used if enabled. However, it will not be used when sending to a SIP endpoint since they usually have their own jitter buffers. See jbforce to force it's use always.")?></span></a></td> 
     535    <td> 
     536      <table width="100%"> 
     537        <tr> 
     538          <td width="25%"> 
     539            <input id="jbenable-yes" type="radio" name="jbenable" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbenable=="yes"?"checked=\"yes\"":""?>/> 
     540            <label for="jbenable-yes"><?php echo _("Enabled") ?></label> 
     541          </td> 
     542          <td width="25%"> 
     543            <input id="jbenable-no" type="radio" name="jbenable" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbenable=="no"?"checked=\"no\"":""?>/> 
     544            <label for="jbenable-no"><?php echo _("Disabled") ?></label> 
     545          </td> 
     546          <td width="25%"> </td><td width="25%"></td> 
     547        </tr> 
     548      </table> 
     549    </td> 
     550  </tr> 
     551 
     552  <tr class="jitter-buffer"> 
     553    <td> 
     554      <a href="#" class="info"><?php echo _("Force Jitter Buffer")?><span><?php echo _("Asterisk: jbforce. Forces the use of a jitterbuffer on the receive side of a SIP channel. Normally the jitter buffer will not be used if receiving a jittery channel but sending it off to another channel such as another 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> 
     555    </td> 
     556    <td> 
     557      <table width="100%"> 
     558        <tr> 
     559          <td width="25%"> 
     560            <input id="jbforce-yes" type="radio" name="jbforce" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbforce=="yes"?"checked=\"yes\"":""?>/> 
     561            <label for="jbforce-yes"><?php echo _("Yes") ?></label> 
     562          </td> 
     563          <td width="25%"> 
     564            <input id="jbforce-no" type="radio" name="jbforce" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbforce=="no"?"checked=\"no\"":""?>/> 
     565            <label for="jbforce-no"><?php echo _("No") ?></label> 
     566          </td> 
     567          <td width="25%"> </td><td width="25%"></td> 
     568        </tr> 
     569      </table> 
     570    </td> 
     571  </tr> 
     572 
     573  <tr class="jitter-buffer"> 
     574    <td> 
     575      <a href="#" class="info"><?php echo _("Implementation")?><span><?php echo _("Asterisk: jbimpl. Jitterbuffer implementation, used on the receiving side of a SIP channel. Two implementations are currently available:<br /> fixed: size always equals to jbmaxsize;<br />) adaptive: with variable size (the new jb of IAX2).")?></span></a> 
     576    </td> 
     577    <td> 
     578      <table width="100%"> 
     579        <tr> 
     580          <td width="25%"> 
     581            <input id="jbimpl-fixed" type="radio" name="jbimpl" class="jitter-buffer" value="fixed" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbimpl=="fixed"?"checked=\"fixed\"":""?>/> 
     582            <label for="jbimpl-fixed"><?php echo _("Fixed") ?></label> 
     583          </td> 
     584          <td width="25%"> 
     585            <input id="jbimpl-adaptive" type="radio" name="jbimpl" class="jitter-buffer" value="adaptive" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbimpl=="adaptive"?"checked=\"adaptive\"":""?>/> 
     586            <label for="jbimpl-adaptive"><?php echo _("Adaptive") ?></label> 
     587          </td> 
     588          <td width="25%"> </td><td width="25%"></td> 
     589        </tr> 
     590      </table> 
     591    </td> 
     592  </tr> 
     593 
     594  <tr class="jitter-buffer"> 
     595    <td> 
     596      <a href="#" class="info"><?php echo _("Jitter Buffer Logging")?><span><?php echo _("Asterisk: jblog. Enables jitter buffer frame logging.")?></span></a> 
     597    </td> 
     598    <td> 
     599      <table width="100%"> 
     600        <tr> 
     601          <td width="25%"> 
     602            <input id="jblog-yes" type="radio" name="jblog" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jblog=="yes"?"checked=\"yes\"":""?>/> 
     603            <label for="jblog-yes"><?php echo _("Enable") ?></label> 
     604          </td> 
     605          <td width="25%"> 
     606            <input id="jblog-no" type="radio" name="jblog" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jblog=="no"?"checked=\"no\"":""?>/> 
     607            <label for="jblog-no"><?php echo _("Disable") ?></label> 
     608          </td> 
     609          <td width="25%"> </td><td width="25%"></td> 
     610        </tr> 
     611      </table> 
     612    </td> 
     613  </tr> 
     614 
     615  <tr class="jitter-buffer"> 
     616    <td> 
     617      <a href="#" class="info"><?php echo _("Jitter Buffer Size")?><span><?php echo _("Asterisk: jbmaxsize. Max length of the jitterbuffer in milliseconds.<br /> 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.")?></span></a> 
     618    </td> 
     619    <td> 
     620      <input type="text" size="4" id="jbmaxsize" name="jbmaxsize" class="jitter-buffer validate-int" value="<?php echo $jbmaxsize ?>" tabindex="<?php echo ++$tabindex;?>"><small>(jbmaxsize)</small>&nbsp; 
     621      <input type="text" size="4" id="jbresyncthreshold" name="jbresyncthreshold" class="jitter-buffer validate-int" value="<?php echo $jbresyncthreshold ?>" tabindex="<?php echo ++$tabindex;?>"><small>(jbresyncthreshold)</small>&nbsp; 
     622    </td> 
     623  </tr> 
     624 
     625  <tr> 
     626    <td colspan="2"><h5><?php echo _("Advanced General Settings") ?><hr></h5></td> 
     627  </tr> 
     628 
     629  <tr> 
     630    <td> 
     631      <a href="#" class="info"><?php echo _("Language")?><span><?php echo _("Default Language for a channel, Asterisk: language")?></span></a> 
     632    </td> 
     633    <td> 
     634      <input type="text" id="sip-language" name="sip-language" class="validate-alphanumeric" value="<?php echo $sip_language ?>" tabindex="<?php echo ++$tabindex;?>"> 
     635    </td> 
     636  </tr> 
     637 
     638  <tr> 
     639    <td> 
     640      <a href="#" class="info"><?php echo _("Default Context")?><span><?php echo _("Asterisk: context. Default context for incoming calls if not specified. FreePBX sets this to from-sip-extenral which is used in conjunction with the Allow Anonymous SIP calls. If you change this you will effect that behavior.")?></span></a> 
     641    </td> 
     642    <td> 
     643      <input type="text" id="default-context" name="default-context alpha-numeric" value="<?php echo $context ?>" tabindex="<?php echo ++$tabindex;?>"> 
     644    </td> 
     645  </tr> 
     646 
     647  <tr> 
     648    <td> 
     649      <a href="#" class="info"><?php echo _("Bind Address")?><span><?php echo _("Asterisk: bindaddr. The IP adderss to bind to and listen for calls on the Bind Port. If set to 0.0.0.0 Asterisk will listen on all addresses.")?></span></a> 
     650    </td> 
     651    <td> 
     652      <input type="text" id="bindaddr" name="bindaddr" class="validate-ip" value="<?php echo $bindaddr ?>" tabindex="<?php echo ++$tabindex;?>"> 
     653    </td> 
     654  </tr> 
     655 
     656  <tr> 
     657    <td> 
     658      <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 SIP messages. The SIP standard is 5060 and in most cases this is what you want.")?></span></a> 
     659    </td> 
     660    <td> 
     661      <input type="text" id="bindaddr" name="bindport" class="validate-ip-port" value="<?php echo $bindport ?>" tabindex="<?php echo ++$tabindex;?>"> 
     662    </td> 
     663  </tr> 
     664 
     665  <tr> 
     666    <td> 
     667      <a href="#" class="info"><?php echo _("Allow SIP Guests")?><span><?php echo _("Asterisk: allowguest. When set Asterisk will allow Guest SIP calls and send them to the Default SIP context. Turning this off will keep anonymous SIP calls from entering the system. However, the Allow Anonymous SIP calls from the General Settings section will not function. Allowing guest calls but rejecting the Anonymous SIP calls in the General Section will enable you to see the call attempts and debug incoming calls that may be mis-configured and appearing as guests.")?></span></a> 
     668    </td> 
     669    <td> 
     670      <table width="100%"> 
     671        <tr> 
     672          <td width="25%"> 
     673            <input id="allowguest-yes" type="radio" name="allowguest" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $allowguest=="yes"?"checked=\"yes\"":""?>/> 
     674            <label for="allowguest-yes"><?php echo _("Yes") ?></label> 
     675          </td> 
     676          <td width="25%"> 
     677            <input id="allowguest-no" type="radio" name="allowguest" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $allowguest=="no"?"checked=\"no\"":""?>/> 
     678            <label for="allowguest-no"><?php echo _("No") ?></label> 
     679          </td> 
     680          <td width="25%"> </td><td width="25%"></td> 
     681        </tr> 
     682      </table> 
     683    </td> 
     684  </tr> 
     685 
     686  <tr> 
     687    <td> 
     688      <a href="#" class="info"><?php echo _("SRV Lookup")?><span><?php echo _("Enable Asterisk srvlookup. See current version of Asterisk for limitations on SRV functionality.")?></span></a> 
     689    </td> 
     690    <td> 
     691      <table width="100%"> 
     692        <tr> 
     693          <td width="25%"> 
     694            <input id="srvlookup-yes" type="radio" name="srvlookup" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $srvlookup=="yes"?"checked=\"yes\"":""?>/> 
     695            <label for="srvlookup-yes"><?php echo _("Enabled") ?></label> 
     696          </td> 
     697          <td width="25%"> 
     698            <input id="srvlookup-no" type="radio" name="srvlookup" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $srvlookup=="no"?"checked=\"no\"":""?>/> 
     699            <label for="srvlookup-no"><?php echo _("Disabled") ?></label> 
     700          </td> 
     701          <td width="25%"> </td><td width="25%"></td> 
     702        </tr> 
     703      </table> 
     704    </td> 
     705  </tr> 
     706 
     707  <tr><td colspan="2"><br /></td></tr> 
     708 
     709  <tr> 
     710    <td> 
     711      <a href="#" class="info"><?php echo _("Other SIP Settings")?><span><?php echo _("You may set any other SIP settings not present here that are allowed to be configured in the General section of sip.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.")?></span></a> 
     712    </td> 
     713    <td> 
     714      <input type="text" id="sip-custom-key-0" name="sip-custom-key-0" class="sip-custom" value="<?php echo $sip_custom_key_0 ?>" tabindex="<?php echo ++$tabindex;?>"> = 
     715      <input type="text" id="sip-custom-val-0" name="sip-custom-val-0" value="<?php echo $sip_custom_val_0 ?>" tabindex="<?php echo ++$tabindex;?>"> 
     716    </td> 
     717  </tr> 
    727718 
    728719<?php 
    729  $idx = 1; 
    730  $var_sip_custom_key = "sip_custom_key_$idx"; 
    731  $var_sip_custom_val = "sip_custom_val_$idx"; 
    732  while (isset($$var_sip_custom_key)) { 
    733    if ($$var_sip_custom_key != '') { 
    734      $tabindex++; 
    735      echo <<< END 
    736  <tr> 
    737    <td> 
    738    </td> 
    739    <td> 
    740      <input type="text" id="sip-custom-key-$idx" name="sip-custom-key-$idx" class="sip-custom" value="{$$var_sip_custom_key}" tabindex="$tabindex"> = 
     720  $idx = 1; 
     721  $var_sip_custom_key = "sip_custom_key_$idx"; 
     722  $var_sip_custom_val = "sip_custom_val_$idx"; 
     723  while (isset($$var_sip_custom_key)) { 
     724    if ($$var_sip_custom_key != '') { 
     725      $tabindex++; 
     726      echo <<< END 
     727  <tr> 
     728    <td> 
     729    </td> 
     730    <td> 
     731      <input type="text" id="sip-custom-key-$idx" name="sip-custom-key-$idx" class="sip-custom" value="{$$var_sip_custom_key}" tabindex="$tabindex"> = 
    741732END; 
    742      $tabindex++; 
    743      echo <<< END 
    744      <input type="text" id="sip-custom-val-$idx" name="sip-custom-val-$idx" value="{$$var_sip_custom_val}" tabindex="$tabindex"> 
    745    </td> 
    746  </tr> 
     733      $tabindex++; 
     734      echo <<< END 
     735      <input type="text" id="sip-custom-val-$idx" name="sip-custom-val-$idx" value="{$$var_sip_custom_val}" tabindex="$tabindex"> 
     736    </td> 
     737  </tr> 
    747738END; 
    748     } 
    749     $idx++; 
    750     $var_sip_custom_key = "sip_custom_key_$idx"; 
    751     $var_sip_custom_val = "sip_custom_val_$idx"; 
    752   } 
     739    } 
     740    $idx++; 
     741    $var_sip_custom_key = "sip_custom_key_$idx"; 
     742    $var_sip_custom_val = "sip_custom_val_$idx"; 
     743  } 
     744  $tabindex += 60; // make room for dynamic insertion of new fields 
    753745?> 
    754  <tr id="sip-custom-buttons"> 
    755    <td></td> 
    756    <td><br \> 
    757      <input type="button" id="sip-custom-add"  value="<?php echo _("Add Field")?>" /> 
    758    </td> 
    759  </tr> 
    760  
    761  <tr> 
    762     <td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td>    
    763  </tr> 
    764  </table> 
     746  <tr id="sip-custom-buttons"> 
     747    <td></td> 
     748    <td><br \> 
     749      <input type="button" id="sip-custom-add"  value="<?php echo _("Add Field")?>" /> 
     750    </td> 
     751  </tr> 
     752 
     753  <tr> 
     754    <td colspan="2"><br><h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></h6></td> 
     755  </tr> 
     756</table> 
    765757<script language="javascript"> 
    766758<!-- 
    767759$(document).ready(function(){ 
    768  /* On click ajax to pbx and determine extenral network and localnet settings */ 
    769  $.ajaxTimeout( 10000 ); 
    770  $("#nat-auto-configure").click(function(){ 
    771    $.ajax({ 
    772      type: 'POST', 
    773      url: "<?php echo $_SERVER["PHP_SELF"]; ?>", 
    774      data: "quietmode=1&skip_astman=1&handler=file&module=sipsettings&file=natget.html.php", 
    775      dataType: 'json', 
    776      success: function(data) { 
    777        if (data.status == 'success') { 
    778          $('#externip_val').attr("value",data.externip); 
    779          $('#externhost_val').attr("value",data.externhost); 
    780          /*  Iterate through each localnet:netmask pair. Put them into any fields on the form 
    781           *  until we have no more, than create new ones 
     760  /* On click ajax to pbx and determine extenral network and localnet settings */ 
     761  $.ajaxTimeout( 10000 ); 
     762  $("#nat-auto-configure").click(function(){ 
     763    $.ajax({ 
     764      type: 'POST', 
     765      url: "<?php echo $_SERVER["PHP_SELF"]; ?>", 
     766      data: "quietmode=1&skip_astman=1&handler=file&module=sipsettings&file=natget.html.php", 
     767      dataType: 'json', 
     768      success: function(data) { 
     769        if (data.status == 'success') { 
     770          $('#externip_val').attr("value",data.externip); 
     771          $('#externhost_val').attr("value",data.externhost); 
     772          /*  Iterate through each localnet:netmask pair. Put them into any fields on the form 
     773          *  until we have no more, than create new ones 
    782774           */ 
    783          var fields = $(".localnet").size(); 
    784          var cnt = 0; 
    785          $.each(data.localnet, function(loc,mask){ 
    786            if (cnt < fields) { 
    787              $('#localnet-'+cnt).attr("value",loc); 
    788              $('#netmask-'+cnt).attr("value",mask); 
    789            } else { 
    790              addLocalnet(loc,mask); 
    791            
    792            cnt++; 
    793          }); 
    794        } else { 
    795          alert(data.status); 
    796        
    797      }, 
    798      error: function(data) { 
    799        alert("<?php echo _("An Error occured trying fetch network configuration and external IP address")?>"); 
    800      }, 
    801    }); 
    802    return false; 
    803  }); 
    804  
    805  /* Add a Local Network / Mask textbox */ 
    806  $("#localnet-add").click(function(){ 
    807    addLocalnet("",""); 
    808  }); 
    809  
    810  /* Add a Custom Var / Val textbox */ 
    811  $("#sip-custom-add").click(function(){ 
    812    addCustomField("",""); 
    813  }); 
    814  
    815  /* Initialize Nat GUI and respond to radio button presses */ 
    816  if (document.getElementById("externhost").checked) { 
    817    $(".externip").hide(); 
    818  } else if (document.getElementById("externip").checked) { 
    819    $(".externhost").hide(); 
    820  } else { 
    821    $(".nat-settings").hide(); 
    822 
    823  $("#nat-none").click(function(){ 
    824    $(".nat-settings").hide(); 
    825  }); 
    826  $("#externip").click(function(){ 
    827    $(".nat-settings").show(); 
    828    $(".externhost").hide(); 
    829  }); 
    830  $("#externhost").click(function(){ 
    831    $(".nat-settings").show(); 
    832    $(".externip").hide(); 
    833  }); 
    834  
    835  /* Initialize Video Support settings and show/hide */ 
    836  if (document.getElementById("videosupport-no").checked) { 
    837    $(".video-codecs").hide(); 
    838 
    839  $("#videosupport-yes").click(function(){ 
    840    $(".video-codecs").show(); 
    841  }); 
    842  $("#videosupport-no").click(function(){ 
    843    $(".video-codecs").hide(); 
    844  }); 
    845  
    846  /* Initialize Jitter Buffer settings and show/hide */ 
    847  if (document.getElementById("jbenable-no").checked) { 
    848    $(".jitter-buffer").hide(); 
    849 
    850  $("#jbenable-yes").click(function(){ 
    851    $(".jitter-buffer").show(); 
    852  }); 
    853  $("#jbenable-no").click(function(){ 
    854    $(".jitter-buffer").hide(); 
    855  }); 
     775          var fields = $(".localnet").size(); 
     776          var cnt = 0; 
     777          $.each(data.localnet, function(loc,mask){ 
     778            if (cnt < fields) { 
     779              $('#localnet-'+cnt).attr("value",loc); 
     780              $('#netmask-'+cnt).attr("value",mask); 
     781            } else { 
     782              addLocalnet(loc,mask); 
     783           
     784            cnt++; 
     785          }); 
     786        } else { 
     787          alert(data.status); 
     788       
     789      }, 
     790      error: function(data) { 
     791        alert("<?php echo _("An Error occured trying fetch network configuration and external IP address")?>"); 
     792      }, 
     793    }); 
     794    return false; 
     795  }); 
     796 
     797  /* Add a Local Network / Mask textbox */ 
     798  $("#localnet-add").click(function(){ 
     799    addLocalnet("",""); 
     800  }); 
     801 
     802  /* Add a Custom Var / Val textbox */ 
     803  $("#sip-custom-add").click(function(){ 
     804    addCustomField("",""); 
     805  }); 
     806 
     807  /* Initialize Nat GUI and respond to radio button presses */ 
     808  if (document.getElementById("externhost").checked) { 
     809    $(".externip").hide(); 
     810  } else if (document.getElementById("externip").checked) { 
     811    $(".externhost").hide(); 
     812  } else { 
     813    $(".nat-settings").hide(); 
     814 
     815  $("#nat-none").click(function(){ 
     816    $(".nat-settings").hide(); 
     817  }); 
     818  $("#externip").click(function(){ 
     819    $(".nat-settings").show(); 
     820    $(".externhost").hide(); 
     821  }); 
     822  $("#externhost").click(function(){ 
     823    $(".nat-settings").show(); 
     824    $(".externip").hide(); 
     825  }); 
     826 
     827  /* Initialize Video Support settings and show/hide */ 
     828  if (document.getElementById("videosupport-no").checked) { 
     829    $(".video-codecs").hide(); 
     830 
     831  $("#videosupport-yes").click(function(){ 
     832    $(".video-codecs").show(); 
     833  }); 
     834  $("#videosupport-no").click(function(){ 
     835    $(".video-codecs").hide(); 
     836  }); 
     837 
     838  /* Initialize Jitter Buffer settings and show/hide */ 
     839  if (document.getElementById("jbenable-no").checked) { 
     840    $(".jitter-buffer").hide(); 
     841 
     842  $("#jbenable-yes").click(function(){ 
     843    $(".jitter-buffer").show(); 
     844  }); 
     845  $("#jbenable-no").click(function(){ 
     846    $(".jitter-buffer").hide(); 
     847  }); 
    856848}); 
    857849 
     
    860852/* Insert a localnet/netmask pair of text boxes */ 
    861853function addLocalnet(localnet, netmask) { 
    862   var idx = $(".localnet").size(); 
    863  
    864   $("#auto-configure-buttons").before('\ 
    865   <tr class="nat-settings">\ 
    866     <td>\ 
    867     </td>\ 
    868     <td>\ 
    869       <input type="text" id="localnet-'+idx+'" name="localnet-'+idx+'" class="localnet" value="'+localnet+'"> /\ 
    870       <input type="text" id="netmask-'+idx+'" name="netmask-'+idx+'" value="'+netmask+'">\ 
    871     </td>\ 
    872   </tr>\ 
    873   '); 
     854  var idx = $(".localnet").size(); 
     855  var idxp = idx - 1; 
     856  var tabindex = parseInt($("#netmask-"+idxp).attr('tabindex')) + 1; 
     857  var tabindexp = tabindex + 1; 
     858 
     859  $("#auto-configure-buttons").before('\ 
     860  <tr class="nat-settings">\ 
     861    <td>\ 
     862    </td>\ 
     863    <td>\ 
     864      <input type="text" id="localnet-'+idx+'" name="localnet-'+idx+'" class="localnet" value="'+localnet+'" tabindex="'+tabindex+'"> /\ 
     865      <input type="text" id="netmask-'+idx+'" name="netmask-'+idx+'" value="'+netmask+'" tabindex="'+tabindexp+'">\ 
     866    </td>\ 
     867  </tr>\ 
     868  '); 
    874869} 
    875870 
    876871/* Insert a sip_setting/sip_value pair of text boxes */ 
    877872function addCustomField(key, val) { 
    878   var idx = $(".sip-custom").size(); 
    879  
    880   $("#sip-custom-buttons").before('\ 
    881   <tr>\ 
    882     <td>\ 
    883     </td>\ 
    884     <td>\ 
    885       <input type="text" id="sip-custom-key-'+idx+'" name="sip-custom-key-'+idx+'" class="sip-custom" value="'+key+'"> =\ 
    886       <input type="text" id="sip-custom-val-'+idx+'" name="sip-custom-val-'+idx+'" value="'+val+'">\ 
    887     </td>\ 
    888   </tr>\ 
    889   '); 
     873  var idx = $(".sip-custom").size(); 
     874  var idxp = idx - 1; 
     875  var tabindex = parseInt($("#sip-custom-val-"+idxp).attr('tabindex')) + 1; 
     876  var tabindexp = tabindex + 1; 
     877 
     878  $("#sip-custom-buttons").before('\ 
     879  <tr>\ 
     880    <td>\ 
     881    </td>\ 
     882    <td>\ 
     883      <input type="text" id="sip-custom-key-'+idx+'" name="sip-custom-key-'+idx+'" class="sip-custom" value="'+key+'" tabindex="'+tabindex+'"> =\ 
     884      <input type="text" id="sip-custom-val-'+idx+'" name="sip-custom-val-'+idx+'" value="'+val+'" tabindex="'+tabindexp+'">\ 
     885    </td>\ 
     886  </tr>\ 
     887  '); 
    890888} 
    891889 
    892890/* TODO: All The ERROR Checking client side */ 
     891 
     892/* Validation classes: (blanks all ok) 
     893  * 
     894  * validate-int 
     895  * is integer only, can be 0 
     896  * 
     897  * validate-ip 
     898  * is proper ip format: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 
     899  * 
     900  * validate-ip-port 
     901  * warning if is integer between 0-1023 TODO: or do we just error this out? 
     902  * error if not integer or > 65535 
     903  * 
     904  * validate-netmask 
     905  * is integer 8-24 or is proper ip format 255\.\d{1,3}\.\d{1,3}\.\d{1,3} 
     906  * 
     907  * validate-alphanumeric 
     908  * valid alphanumerics that asterisk is ok with (probably no punctuations) 
     909  * 
     910 */ 
    893911function checkConf() 
    894912{ 
    895   return true; 
     913 
     914  /* 
     915     TODO: look at jquery validate and/or finish below 
     916 
     917  $('validation-error').removeClass('validation-error'); 
     918 
     919  $('validate-int').each(function(){ 
     920    // regex this.value for integer 
     921    if (!is_integer(this.value)) { 
     922      $('#'+this.id).addClass('validation-error'); 
     923    } 
     924  }); 
     925  $('validate-ip').each(function(){ 
     926    // regex this.value for ip 
     927    $('#'+this.id).addClass('validation-error'); 
     928  }); 
     929  $('validate-ip-port').each(function(){ 
     930    // number 1024 <= this.value < 65536 
     931    $('#'+this.id).addClass('validation-error'); 
     932  }); 
     933  $('validate-netmask').each(function(){ 
     934    // number 8 <= this.value <= 24 
     935    // or regex ip format 255\.\d{1,3}\.\d{1,3}\.\d{1,3} 
     936    $('#'+this.id).addClass('validation-error'); 
     937  }); 
     938  $('validate-alphanumeric').each(function(){ 
     939    // regex this.value for alphanumeric 
     940    $('#'+this.id).addClass('validation-error'); 
     941  }); 
     942   */ 
     943 
     944  return true; 
    896945} 
     946 
    897947 
    898948//--> 
    899949</script> 
    900  </form> 
     950</form> 
    901951<?php    
    902952     
    903953function sippsettings_process_errors($errors) { 
    904  /* TODO: process the array of errors and show issues somewhere */ 
     954  /* TODO: process the array of errors and show issues somewhere */ 
    905955} 
    906956?>