Changeset 7848

Show
Ignore:
Timestamp:
06/20/09 16:43:22 (1 year ago)
Author:
p_lindheimer
Message:

svn cp sipsettings module to iaxsettings module and modify for IAX

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.6/iaxsettings/functions.inc.php

    r7843 r7848  
    2121 
    2222// Use hookGet_config so that everyone (like core) will have written their 
    23 // SIP settings and then we can remove any that we are going to override 
     23// IAX settings and then we can remove any that we are going to override 
    2424// 
    2525 
     
    3030define('CUSTOM','9'); 
    3131 
    32 class sipsettings_validate { 
     32class iaxsettings_validate { 
    3333  var $errors = array(); 
    3434 
    3535  /* checks if value is an integer */ 
    36   function is_int($value, $item, $message) { 
    37     $value = trim($value); 
    38     if ($value != '' && !ctype_digit($value) || $value < 0) { 
    39       $this->errors[] = array('id' => $item, 'value' => $value, 'message' => $message); 
     36  function is_int($value, $item, $message, $negative=false) { 
     37    $value = trim($value); 
     38    if ($value != '' && $negative) { 
     39      $tmp_value = substr($value,0,1) == '-' ? substr($value,1) : $value; 
     40      if (!ctype_digit($tmp_value)) { 
     41        $this->errors[] = array('id' => $item, 'value' => $value, 'message' => $message); 
     42      } 
     43    } elseif (!$negative) { 
     44      if (!ctype_digit($value) || ($value < 0 )) { 
     45        $this->errors[] = array('id' => $item, 'value' => $value, 'message' => $message); 
     46      } 
    4047    } 
    4148    return $value; 
     
    8592} 
    8693 
    87 function sipsettings_hookGet_config($engine) { 
     94function iaxsettings_hookGet_config($engine) { 
    8895  global $core_conf; 
    8996 
     
    9198    case "asterisk": 
    9299      if (isset($core_conf) && is_a($core_conf, "core_conf")) { 
    93         $raw_settings = sipsettings_get(true); 
     100        $raw_settings = iaxsettings_get(true); 
    94101 
    95102        /* TODO: This is example concept code 
     
    101108                                 */ 
    102109        $idx = 0; 
    103         foreach ($core_conf->_sip_general as $entry) { 
     110        foreach ($core_conf->_iax_general as $entry) { 
    104111          switch (strtolower($entry['key'])) { 
    105112            case 'allow': 
    106113            case 'disallow': 
    107               unset($core_conf->_sip_general[$idx]); 
     114              unset($core_conf->_iax_general[$idx]); 
    108115            break; 
    109116          default: 
     
    128135 
    129136            case CUSTOM: 
    130               $sip_settings[] = array($var['keyword'], $var['data']); 
     137              $iax_settings[] = array($var['keyword'], $var['data']); 
    131138            break; 
    132139          default: 
     
    137144 
    138145        /* Codecs First */ 
    139         $core_conf->addSipGeneral('disallow','all'); 
     146        $core_conf->addIaxGeneral('disallow','all'); 
    140147        foreach ($codecs as $codec => $enabled) { 
    141148          if ($enabled == '1') { 
    142             $core_conf->addSipGeneral('allow',$codec); 
     149            $core_conf->addIaxGeneral('allow',$codec); 
    143150          } 
    144151        } 
     
    148155          foreach ($video_codecs as $codec => $enabled) { 
    149156            if ($enabled == '1') { 
    150               $core_conf->addSipGeneral('allow',$codec); 
     157              $core_conf->addIaxGeneral('allow',$codec); 
    151158            } 
    152159          } 
     
    156163        /* next figure out what we need to write out (deal with things like nat combos, etc. */ 
    157164 
    158         $nat_mode = $interim_settings['nat_mode']; 
    159         $jbenable = $interim_settings['jbenable']; 
     165        $jitterbuffer = $interim_settings['jitterbuffer']; 
    160166        foreach ($interim_settings as $key => $value) { 
    161167          switch ($key) { 
    162             case 'nat_mode': 
    163             break; 
    164  
    165             case 'externhost_val': 
    166               if ($nat_mode == 'externhost' && $key != '') { 
    167                 $sip_settings[] = array('externhost', $value); 
     168            case 'videosupport': 
     169            break; 
     170 
     171            case 'maxjitterbuffer': 
     172            case 'maxjitterinterps': 
     173            case 'resyncthreshold': 
     174            case 'forcejitterbuffer': 
     175              if ($jitterbuffer == 'yes' && $key != '') { 
     176                $iax_settings[] = array($key, $value); 
    168177              } 
    169178            break; 
    170179 
    171             case 'externrefresh': 
    172               if ($nat_mode == 'externhost' && $key != '') { 
    173                 $sip_settings[] = array($key, $value); 
     180            case 'bandwidth': 
     181              if ($value != 'unset') { 
     182                $iax_settings[] = array($key, $value); 
    174183              } 
    175184            break; 
    176185 
    177             case 'externip_val': 
    178               if ($nat_mode == 'externip' && $key != '') { 
    179                 $sip_settings[] = array('externip', $value); 
     186            case 'iax_language': 
     187              if ($key != '') { 
     188                $iax_settings[] = array('language', $value); 
    180189              } 
    181190            break; 
    182191 
    183             case 'jbforce': 
    184             case 'jpimpl': 
    185             case 'jbmaxsize': 
    186             case 'jbresyncthreshold': 
    187             case 'jblog': 
    188               if ($jbenable == 'yes' && $key != '') { 
    189                 $sip_settings[] = array($key, $value); 
    190               } 
    191             break; 
    192  
    193             case 'sip_language': 
    194               if ($key != '') { 
    195                 $sip_settings[] = array('language', $value); 
    196               } 
    197             break; 
    198  
    199192            default: 
    200               if (substr($key,0,9) == "localnet_" && $value != '') { 
    201                 if ($nat_mode != 'public') { 
    202                   $seq = substr($key,9); 
    203                   $network = "$value/".$interim_settings["netmask_$seq"]; 
    204                   $sip_settings[] = array('localnet', $network); 
    205                 } 
    206               } else if (substr($key,0,8) == "netmask_") { 
    207                 // do nothing, handled above 
    208               } else { 
    209                 $sip_settings[] = array($key, $value); 
    210               } 
     193              $iax_settings[] = array($key, $value); 
    211194            } 
    212195          } 
    213196          unset($interim_settings); 
    214           foreach ($sip_settings as $entry) { 
     197          foreach ($iax_settings as $entry) { 
    215198            if ($entry[1] != '') { 
    216               $core_conf->addSipGeneral($entry[0],$entry[1]); 
     199              $core_conf->addIaxGeneral($entry[0],$entry[1]); 
    217200            } 
    218201          } 
     
    224207} 
    225208 
    226 function sipsettings_get($raw=false) { 
    227  
    228   $sql = "SELECT `keyword`, `data`, `type`, `seq` FROM `sipsettings` ORDER BY `type`, `seq`"; 
     209function iaxsettings_get($raw=false) { 
     210 
     211  $sql = "SELECT `keyword`, `data`, `type`, `seq` FROM `iaxsettings` ORDER BY `type`, `seq`"; 
    229212  $raw_settings = sql($sql,"getAll",DB_FETCHMODE_ASSOC); 
    230213 
     
    236219  /* Initialize first, then replace with DB, to make sure we have defaults */ 
    237220 
    238   $sip_settings['nat']               = 'yes'; 
    239   $sip_settings['nat_mode']          = 'externip'; 
    240   $sip_settings['externip_val']      = ''; 
    241   $sip_settings['externhost_val']    = ''; 
    242   $sip_settings['externrefresh']     = '120'; 
    243   $sip_settings['localnet_0']        = ''; 
    244   $sip_settings['netmask_0']         = '255.255.255.0'; 
    245  
    246   $sip_settings['codecs']            =  array( 
     221  $iax_settings['codecs']            =  array( 
    247222    'ulaw'     => '1', 
    248223    'alaw'     => '1', 
     
    262237    ); 
    263238 
    264   $sip_settings['g726nonstandard']   = 'no'; 
    265   $sip_settings['t38pt_udptl']       = 'no'; 
    266  
    267   $sip_settings['video_codecs']      = array( 
     239  $iax_settings['video_codecs']      = array( 
    268240    'h261'  => '', 
    269241    'h263'  => '', 
     
    272244    ); 
    273245 
    274   $sip_settings['videosupport']      = 'no'; 
    275   $sip_settings['maxcallbitrate']    = '384'; 
    276  
    277   $sip_settings['canreinvite']       = 'no'; 
    278   $sip_settings['rtptimeout']        = '30'; 
    279   $sip_settings['rtpholdtimeout']    = '300'; 
    280   $sip_settings['rtpkeepalive']      = ''; 
    281  
    282   $sip_settings['checkmwi']          = ''; 
    283   $sip_settings['notifyringing']     = 'yes'; 
    284   $sip_settings['notifyhold']        = 'yes'; 
    285  
    286   $sip_settings['registertimeout']   = '20'; 
    287   $sip_settings['registerattempts']  = '0'; 
    288   $sip_settings['maxexpiry']         = '3600'; 
    289   $sip_settings['minexpiry']         = '60'; 
    290   $sip_settings['defaultexpiry']     = '120'; 
    291  
    292   $sip_settings['jbenable']          = 'no'; 
    293   $sip_settings['jbforce']           = 'no'; 
    294   $sip_settings['jpimpl']            = 'fixed'; 
    295   $sip_settings['jbmaxsize']         = '200'; 
    296   $sip_settings['jbresyncthreshold'] = '1000'; 
    297   $sip_settings['jblog']             = 'no'; 
    298  
    299   $sip_settings['sip_language']      = ''; 
    300   $sip_settings['context']           = ''; 
    301   $sip_settings['bindaddr']          = ''; 
    302   $sip_settings['bindport']          = ''; 
    303   $sip_settings['allowguest']        = 'yes'; 
    304   $sip_settings['srvlookup']         = 'no'; 
    305  
    306   $sip_settings['sip_custom_key_0']  = ''; 
    307   $sip_settings['sip_custom_val_0']  = ''; 
     246  $iax_settings['codecpriority']     = 'host'; 
     247  $iax_settings['bandwidth']         = 'unset'; 
     248  $iax_settings['videosupport']      = 'no'; 
     249 
     250  $iax_settings['minregexpire']      = '60'; 
     251  $iax_settings['maxregexpire']      = '3600'; 
     252 
     253  $iax_settings['jitterbuffer']      = 'no'; 
     254  $iax_settings['forcejitterbuffer'] = 'no'; 
     255  $iax_settings['maxjitterbuffer']   = '200'; 
     256  $iax_settings['resyncthreshold']   = '1000'; 
     257  $iax_settings['maxjitterinterps']  = ''; 
     258 
     259  $iax_settings['iax_language']      = ''; 
     260  $iax_settings['bindaddr']          = ''; 
     261  $iax_settings['bindport']          = ''; 
     262  $iax_settings['delayreject']       = 'yes'; 
     263 
     264  $iax_settings['iax_custom_key_0']  = ''; 
     265  $iax_settings['iax_custom_val_0']  = ''; 
    308266 
    309267  foreach ($raw_settings as $var) { 
    310268    switch ($var['type']) { 
    311269      case NORMAL: 
    312         $sip_settings[$var['keyword']]                 = $var['data']; 
     270        $iax_settings[$var['keyword']]                 = $var['data']; 
    313271      break; 
    314272 
    315273      case CODEC: 
    316         $sip_settings['codecs'][$var['keyword']]       = $var['data']; 
     274        $iax_settings['codecs'][$var['keyword']]       = $var['data']; 
    317275      break; 
    318276 
    319277      case VIDEO_CODEC: 
    320         $sip_settings['video_codecs'][$var['keyword']] = $var['data']; 
     278        $iax_settings['video_codecs'][$var['keyword']] = $var['data']; 
    321279      break; 
    322280 
    323281      case CUSTOM: 
    324         $sip_settings['sip_custom_key_'.$var['seq']]   = $var['keyword']; 
    325         $sip_settings['sip_custom_val_'.$var['seq']]   = $var['data']; 
     282        $iax_settings['iax_custom_key_'.$var['seq']]   = $var['keyword']; 
     283        $iax_settings['iax_custom_val_'.$var['seq']]   = $var['data']; 
    326284      break; 
    327285 
     
    332290  unset($raw_settings); 
    333291 
    334   return $sip_settings; 
     292  return $iax_settings; 
    335293} 
    336294 
    337 // Add a sipsettings 
    338 function sipsettings_edit($sip_settings) { 
     295// Add a iaxsettings 
     296function iaxsettings_edit($iax_settings) { 
    339297  global $db; 
    340298  $save_settings = array(); 
    341   $vd = new  sipsettings_validate(); 
    342  
    343   $codecs = $sip_settings['codecs']; 
    344   $video_codecs = $sip_settings['video_codecs']; 
    345   unset($sip_settings['codecs']); 
    346   unset($sip_settings['video_codecs']); 
    347  
    348   // TODO: this is where I will build validation before saving 
    349         // 
     299  $vd = new  iaxsettings_validate(); 
     300 
     301  $codecs = $iax_settings['codecs']; 
     302  $video_codecs = $iax_settings['video_codecs']; 
     303  unset($iax_settings['codecs']); 
     304  unset($iax_settings['video_codecs']); 
     305 
     306 
     307 
    350308  $integer_msg = _("%s must be a non-negative integer"); 
    351   foreach ($sip_settings as $key => $val) { 
     309  foreach ($iax_settings as $key => $val) { 
    352310    switch ($key) { 
    353311      case 'bindaddr': 
     
    361319      break; 
    362320 
    363       case 'rtpholdtimeout': 
    364         // validation: must be > $sip_settings['rtptimeout'] (and of course a proper number) 
    365         //$vd->log_error(); 
    366         if ($val < $sip_settings['rtptimeout']) { 
    367           $msg = _("rtpholdtimeout must be higher than rtptimeout"); 
    368           $vd->log_error($val, $key, $msg); 
    369         } 
    370         $msg = sprintf($integer_msg,$key); 
    371         $save_settings[] = array($key,$db->escapeSimple($vd->is_int($val, $key, $msg)),'10',NORMAL); 
    372       break; 
    373  
    374       case 'rtptimeout': 
    375       case 'rtpkeepalive': 
    376       case 'checkmwi': 
    377       case 'registertimeout': 
    378       case 'minexpiry': 
    379       case 'maxexpiry': 
    380       case 'defaultexpiry': 
     321      case 'minregexpire': 
     322      case 'maxregexpire': 
    381323        $msg = sprintf($integer_msg,$key); 
    382324        $save_settings[] = array($key,$db->escapeSimple($vd->is_int($val,$key,$msg)),'10',NORMAL); 
    383325      break; 
    384326 
    385       case 'maxcallbitrate': 
    386       case 'registerattempts': 
    387         $msg = sprintf($integer_msg,$key); 
    388         $save_settings[] = array($key,$db->escapeSimple($vd->is_int($val,$key,$msg)),'10',NORMAL); 
    389       break; 
    390  
    391  
    392       case 'sip_language': 
    393         $msg = sprintf(_("Language must be alphanumeric and installed"),$key); 
     327      case 'iax_language': 
     328        $msg = ("Language must be alphanumeric and installed"); 
    394329        $save_settings[] = array($key,$db->escapeSimple($vd->is_alphanumeric($val,$key,$msg)),'0',NORMAL); 
    395330      break; 
    396331 
    397       case 'externrefresh': 
    398         $msg = sprintf($integer_msg,$key); 
    399         $save_settings[] = array($key,$db->escapeSimple($vd->is_int($val,$key,$msg)),'41',NORMAL); 
    400       break; 
    401  
    402       case 'nat': 
    403         $save_settings[] = array($key,$val,'39',NORMAL); 
    404       break; 
    405  
    406       case 'externip_val': 
    407         if (trim($val) == '' && $sip_settings['nat_mode'] == 'externip') { 
    408           $msg = _("External IP can not be blank"); 
    409           $vd->log_error($val, $key, $msg); 
    410          } 
    411         $save_settings[] = array($key,$val,'40',NORMAL); 
    412       break; 
    413  
    414       case 'externhost_val': 
    415         if (trim($val) == '' && $sip_settings['nat_mode'] == 'externhost') { 
    416           $msg = _("Dynamic Host can not be blank"); 
    417           $vd->log_error($val, $key, $msg); 
    418          } 
    419         $save_settings[] = array($key,$val,'40',NORMAL); 
    420       break; 
    421  
    422       case 'jbenable': 
     332      case 'codecpriority': 
     333      case 'delayreject': 
     334      case 'bandwidth': 
     335        $save_settings[] = array($key,$val,'0',NORMAL); 
     336      break; 
     337 
     338      case 'jitterbuffer': 
    423339        $save_settings[] = array($key,$val,'4',NORMAL); 
    424340      break; 
    425341 
    426       case 'jbforce': 
    427       case 'jpimpl': 
    428       case 'jblog': 
     342      case 'forcejitterbuffer': 
    429343        $save_settings[] = array($key,$val,'5',NORMAL); 
    430344      break; 
    431345 
    432       case 'jbmaxsize': 
    433       case 'jbresyncthreshold': 
     346      case 'maxjitterbuffer': 
     347      case 'maxjitterinterps': 
    434348        $msg = sprintf($integer_msg,$key); 
    435349        $save_settings[] = array($key,$db->escapeSimple($vd->is_int($val,$key,$msg)),'5',NORMAL); 
    436350      break; 
    437351 
    438       case 'nat_mode': 
    439       case 'g726nonstandard': 
    440       case 't38pt_udptl': 
     352      case 'resyncthreshold': 
     353        $msg = _("resyncthreshold must be a non-negative integer or -1 to disable"); 
     354        $save_settings[] = array($key,$db->escapeSimple($vd->is_int($val,$key,$msg,true)),'5',NORMAL); 
     355      break; 
     356 
    441357      case 'videosupport': 
    442       case 'canreinvite': 
    443       case 'notifyringing': 
    444       case 'notifyhold': 
    445       case 'allowguest': 
    446       case 'srvlookup': 
    447358        $save_settings[] = array($key,$val,'10',NORMAL); 
    448359      break; 
    449360 
    450361    default: 
    451       if (substr($key,0,9) == "localnet_") { 
    452         // ip validate this and store 
    453         $seq = substr($key,9); 
    454         $msg = _("Localnet setting must be an IP address"); 
    455         $save_settings[] = array($key,$db->escapeSimple($vd->is_ip($val,$key,$msg)),(42+$seq),NORMAL);  
    456       } else if (substr($key,0,8) == "netmask_") { 
    457         // ip validate this and store 
    458         $seq = substr($key,8); 
    459         $msg = _("Localnet netmask must be formated properly (e.g. 255.255.255.0 or 24)"); 
    460         $save_settings[] = array($key,$db->escapeSimple($vd->is_netmask($val,$key,$msg)),$seq,NORMAL);  
    461       } else if (substr($key,0,15) == "sip_custom_key_") { 
     362      } if (substr($key,0,15) == "iax_custom_key_") { 
    462363        $seq = substr($key,15); 
    463         $save_settings[] = array($db->escapeSimple($val),$db->escapeSimple($sip_settings["sip_custom_val_$seq"]),($seq),CUSTOM);  
    464       } else if (substr($key,0,15) == "sip_custom_val_") { 
    465         // skip it, we will seek it out when we see the sip_custom_key 
     364        $save_settings[] = array($db->escapeSimple($val),$db->escapeSimple($iax_settings["iax_custom_val_$seq"]),($seq),CUSTOM);  
     365      } else if (substr($key,0,15) == "iax_custom_val_") { 
     366        // skip it, we will seek it out when we see the iax_custom_key 
    466367      } else { 
    467368        $save_settings[] = array($key,$val,'0',NORMAL); 
     
    487388    //       this time around. 
    488389          // 
    489     sql("DELETE FROM `sipsettings` WHERE 1"); 
    490     $compiled = $db->prepare('INSERT INTO `sipsettings` (`keyword`, `data`, `seq`, `type`) VALUES (?,?,?,?)'); 
     390    sql("DELETE FROM `iaxsettings` WHERE 1"); 
     391    $compiled = $db->prepare('INSERT INTO `iaxsettings` (`keyword`, `data`, `seq`, `type`) VALUES (?,?,?,?)'); 
    491392    $result = $db->executeMultiple($compiled,$save_settings); 
    492393    if(DB::IsError($result)) { 
    493       die_freepbx($result->getDebugInfo()."<br><br>".'error adding to sipsettings table');    } 
     394      die_freepbx($result->getDebugInfo()."<br><br>".'error adding to iaxsettings table');    } 
    494395    return true; 
    495396  } 
  • modules/branches/2.6/iaxsettings/install.php

    r7831 r7848  
    2424 
    2525$sql = <<< END 
    26 CREATE TABLE `sipsettings` ( 
     26CREATE TABLE `iaxsettings` ( 
    2727  `keyword` VARCHAR (50) NOT NULL default '', 
    2828  `data`    VARCHAR (255) NOT NULL default '', 
  • modules/branches/2.6/iaxsettings/module.xml

    r7842 r7848  
    11<module> 
    2         <rawname>sipsettings</rawname> 
    3         <name>SIP Settings</name> 
     2        <rawname>iaxsettings</rawname> 
     3        <name>IAX Settings</name> 
    44        <version>2.6.0beta1.0</version> 
    55        <type>tool</type> 
    66        <category>System Administration</category> 
    77        <menuitems> 
    8                 <sipsettings>SIP Settings</sipsettings> 
     8                <iaxsettings>IAX Settings</iaxsettings> 
    99        </menuitems> 
    1010        <description> 
    11                 Use to configure Various Asterisk SIP Settings in the General section of sip.conf. Also includes an auto-configuration tool to determine NAT settings
     11                Use to configure Various Asterisk IAX Settings in the General section of iax.conf. The module assumes Asterisk version 1.4 or higher. Some settings may not exist in Asterisk 1.2 and will be ignored by Asterisk
    1212        </description> 
    1313        <publisher>Bandwidth.com</publisher> 
     
    1515        <changelog> 
    1616                *2.6.0beta1.0* lots of tweaks, fixed install.php error 
    17                 *2.6.0alpha1.1* Added db 
    18                 *2.6.0alpha1.0* Incomplete screen mockup 
    1917        </changelog> 
    20         <location>release/2.6/sipsettings-2.6.0beta1.0.tgz</location> 
     18        <location>release/2.6/iaxsettings-2.6.0beta1.0.tgz</location> 
    2119        <md5sum>a314cccf002a07868b9a95dd411513c2</md5sum> 
    2220</module> 
  • modules/branches/2.6/iaxsettings/page.sipsettings.php

    r7839 r7848  
    2323  $width          = (100.0 / $cols_per_row); 
    2424  $tabindex       = 0; 
    25   $dispnum        = "sipsettings"; 
     25  $dispnum        = "iaxsettings"; 
    2626  $error_displays = array(); 
    2727 
    2828  $action                            = isset($_POST['action'])?$_POST['action']:''; 
    29  
    30   $sip_settings['nat']               = isset($_POST['nat']) ? $_POST['nat'] : 'yes'; 
    31   $sip_settings['nat_mode']          = isset($_POST['nat_mode']) ? $_POST['nat_mode'] : 'externip'; 
    32   $sip_settings['externip_val']      = isset($_POST['externip_val']) ? htmlspecialchars($_POST['externip_val']) : ''; 
    33   $sip_settings['externhost_val']    = isset($_POST['externhost_val']) ? htmlspecialchars($_POST['externhost_val']) : ''; 
    34   $sip_settings['externrefresh']     = isset($_POST['externrefresh']) ? htmlspecialchars($_POST['externrefresh']) : '120'; 
    35  
    36   $p_idx = 0; 
    37   $n_idx = 0; 
    38   while (isset($_POST["localnet_$p_idx"])) { 
    39     if ($_POST["localnet_$p_idx"] != '') { 
    40       $sip_settings["localnet_$n_idx"] = htmlspecialchars($_POST["localnet_$p_idx"]); 
    41       $sip_settings["netmask_$n_idx"]  = htmlspecialchars($_POST["netmask_$p_idx"]); 
    42       $n_idx++; 
    43     }  
    44     $p_idx++; 
    45   } 
    4629 
    4730  $codecs = array( 
     
    6548    $codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    6649  } 
    67   $sip_settings['codecs']            = $codecs; 
    68   $sip_settings['g726nonstandard']   = isset($_POST['g726nonstandard']) ? $_POST['g726nonstandard'] : 'no'; 
    69   $sip_settings['t38pt_udptl']       = isset($_POST['t38pt_udptl']) ? $_POST['t38pt_udptl'] : 'no'; 
     50  $iax_settings['codecs']            = $codecs; 
    7051 
    7152  $video_codecs = array( 
     
    7859    $video_codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    7960  } 
    80   $sip_settings['video_codecs']      = $video_codecs; 
    81   $sip_settings['videosupport']      = isset($_POST['videosupport']) ? $_POST['videosupport'] : 'no'; 
    82   $sip_settings['maxcallbitrate']    = isset($_POST['maxcallbitrate']) ? htmlspecialchars($_POST['maxcallbitrate']) : '384'; 
    83  
    84   $sip_settings['canreinvite']       = isset($_POST['canreinvite']) ? $_POST['canreinvite'] : 'no'; 
    85   $sip_settings['rtptimeout']        = isset($_POST['rtptimeout']) ? htmlspecialchars($_POST['rtptimeout']) : '30'; 
    86   $sip_settings['rtpholdtimeout']    = isset($_POST['rtpholdtimeout']) ? htmlspecialchars($_POST['rtpholdtimeout']) : '300'; 
    87   $sip_settings['rtpkeepalive']      = isset($_POST['rtpkeepalive']) ? htmlspecialchars($_POST['rtpkeepalive']) : ''; 
    88  
    89   $sip_settings['checkmwi']          = isset($_POST['checkmwi']) ? htmlspecialchars($_POST['checkmwi']) : ''; 
    90   $sip_settings['notifyringing']     = isset($_POST['notifyringing']) ? $_POST['notifyringing'] : 'yes'; 
    91   $sip_settings['notifyhold']        = isset($_POST['notifyhold']) ? $_POST['notifyhold'] : 'yes'; 
    92  
    93   $sip_settings['registertimeout']   = isset($_POST['registertimeout']) ? htmlspecialchars($_POST['registertimeout']) : '20'; 
    94   $sip_settings['registerattempts']  = isset($_POST['registerattempts']) ? htmlspecialchars($_POST['registerattempts']) : '0'; 
    95   $sip_settings['maxexpiry']         = isset($_POST['maxexpiry']) ? htmlspecialchars($_POST['maxexpiry']) : '3600'; 
    96   $sip_settings['minexpiry']         = isset($_POST['minexpiry']) ? htmlspecialchars($_POST['minexpiry']) : '60'; 
    97   $sip_settings['defaultexpiry']     = isset($_POST['defaultexpiry']) ? htmlspecialchars($_POST['defaultexpiry']) : '120'; 
    98  
    99   $sip_settings['jbenable']          = isset($_POST['jbenable']) ? $_POST['jbenable'] : 'no'; 
    100   $sip_settings['jbforce']           = isset($_POST['jbforce']) ? $_POST['jbforce'] : 'no'; 
    101   $sip_settings['jpimpl']            = isset($_POST['jpimpl']) ? $_POST['jpimpl'] : 'fixed'; 
    102   $sip_settings['jbmaxsize']         = isset($_POST['jbmaxsize']) ? htmlspecialchars($_POST['jbmaxsize']) : '200'; 
    103   $sip_settings['jbresyncthreshold'] = isset($_POST['jbresyncthreshold']) ? htmlspecialchars($_POST['jbresyncthreshold']) : '1000'; 
    104   $sip_settings['jblog']             = isset($_POST['jblog']) ? $_POST['jblog'] : 'no'; 
    105  
    106   $sip_settings['sip_language']      = isset($_POST['sip-language']) ? htmlspecialchars($_POST['sip-language']) : ''; 
    107   $sip_settings['context']           = isset($_POST['context']) ? htmlspecialchars($_POST['context']) : ''; 
    108   $sip_settings['bindaddr']          = isset($_POST['bindaddr']) ? htmlspecialchars($_POST['bindaddr']) : ''; 
    109   $sip_settings['bindport']          = isset($_POST['bindport']) ? htmlspecialchars($_POST['bindport']) : ''; 
    110   $sip_settings['allowguest']        = isset($_POST['allowguest']) ? $_POST['allowguest'] : 'yes'; 
    111   $sip_settings['srvlookup']         = isset($_POST['srvlookup']) ? $_POST['srvlookup'] : 'no'; 
     61  $iax_settings['codecpriority']     = isset($_POST['codecpriority']) ? $_POST['codecpriority'] : 'host'; 
     62  $iax_settings['bandwidth']         = isset($_POST['bandwidth']) ? $_POST['bandwidth'] : 'unset'; 
     63  $iax_settings['video_codecs']      = $video_codecs; 
     64  $iax_settings['videosupport']      = isset($_POST['videosupport']) ? $_POST['videosupport'] : 'no'; 
     65 
     66  $iax_settings['maxregexpire']      = isset($_POST['maxregexpire']) ? htmlspecialchars($_POST['maxregexpire']) : '3600'; 
     67  $iax_settings['minregexpire']      = isset($_POST['minregexpire']) ? htmlspecialchars($_POST['minregexpire']) : '60'; 
     68 
     69  $iax_settings['jitterbuffer']      = isset($_POST['jitterbuffer']) ? $_POST['jitterbuffer'] : 'no'; 
     70  $iax_settings['forcejitterbuffer'] = isset($_POST['forcejitterbuffer']) ? $_POST['forcejitterbuffer'] : 'no'; 
     71  $iax_settings['maxjitterbuffer']   = isset($_POST['maxjitterbuffer']) ? htmlspecialchars($_POST['maxjitterbuffer']) : '200'; 
     72  $iax_settings['resyncthreshold']   = isset($_POST['resyncthreshold']) ? htmlspecialchars($_POST['resyncthreshold']) : '1000'; 
     73  $iax_settings['maxjitterinterps']  = isset($_POST['maxjitterinterps']) ? htmlspecialchars($_POST['maxjitterinterps']) : ''; 
     74 
     75  $iax_settings['iax_language']      = isset($_POST['iax_language']) ? htmlspecialchars($_POST['iax_language']) : ''; 
     76  $iax_settings['bindaddr']          = isset($_POST['bindaddr']) ? htmlspecialchars($_POST['bindaddr']) : ''; 
     77  $iax_settings['bindport']          = isset($_POST['bindport']) ? htmlspecialchars($_POST['bindport']) : ''; 
     78  $iax_settings['delayreject']       = isset($_POST['delayreject']) ? htmlspecialchars($_POST['delayreject']) : 'yes'; 
    11279 
    11380  $p_idx = 0; 
    11481  $n_idx = 0; 
    115   while (isset($_POST["sip_custom_key_$p_idx"])) { 
    116     if ($_POST["sip_custom_key_$p_idx"] != '') { 
    117       $sip_settings["sip_custom_key_$n_idx"] = htmlspecialchars($_POST["sip_custom_key_$p_idx"]); 
    118       $sip_settings["sip_custom_val_$n_idx"] = htmlspecialchars($_POST["sip_custom_val_$p_idx"]); 
     82  while (isset($_POST["iax_custom_key_$p_idx"])) { 
     83    if ($_POST["iax_custom_key_$p_idx"] != '') { 
     84      $iax_settings["iax_custom_key_$n_idx"] = htmlspecialchars($_POST["iax_custom_key_$p_idx"]); 
     85      $iax_settings["iax_custom_val_$n_idx"] = htmlspecialchars($_POST["iax_custom_val_$p_idx"]); 
    11986      $n_idx++; 
    12087    }  
     
    12491switch ($action) { 
    12592  case "edit":  //just delete and re-add 
    126     if (($errors = sipsettings_edit($sip_settings)) !== true) { 
     93    if (($errors = iaxsettings_edit($iax_settings)) !== true) { 
    12794      $error_displays = process_errors($errors); 
    12895    } else { 
     
    133100  default: 
    134101    /* only get them if first time load, if they pressed submit, use values from POST */ 
    135     $sip_settings = sipsettings_get(); 
     102    $iax_settings = iaxsettings_get(); 
    136103} 
    137104?> 
     
    143110<?php 
    144111 
    145   /* We massaged these above or they came from sipsettings_get() if this is not 
     112  /* We massaged these above or they came from iaxsettings_get() if this is not 
    146113   * from and edit. So extract them after sorting out the codec sub arrays. 
    147114         */ 
    148   $codecs = $sip_settings['codecs']; 
    149   $video_codecs = $sip_settings['video_codecs']; 
    150   unset($sip_settings['codecs']); 
    151   unset($sip_settings['video_codecs']); 
     115  $codecs = $iax_settings['codecs']; 
     116  $video_codecs = $iax_settings['video_codecs']; 
     117  unset($iax_settings['codecs']); 
     118  unset($iax_settings['video_codecs']); 
    152119 
    153120  /* EXTRACT THE VARIABLE HERE - MAKE SURE THEY ARE ALL MASSAGED ABOVE */ 
    154121        // 
    155   extract($sip_settings); 
    156  
    157 ?> 
    158   <form autocomplete="off" name="editSip" action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> 
     122  extract($iax_settings); 
     123 
     124?> 
     125  <form autocomplete="off" name="editIax" action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> 
    159126  <input type="hidden" name="action" value="edit"> 
    160127  <table width="570px"> 
     
    166133  <tr> 
    167134    <td colspan="2"> 
    168       <div class="sip-errors"> 
     135      <div class="iax-errors"> 
    169136        <p><?php echo _("ERRORS") ?></p> 
    170137        <ul> 
     
    181148  } 
    182149?> 
    183  
    184   <tr> 
    185     <td colspan="2"><h5><?php echo _("NAT Settings") ?><hr></h5></td> 
    186   </tr> 
    187  
    188   <tr> 
    189     <td> 
    190       <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> 
    191     </td> 
    192     <td> 
    193       <table width="100%"> 
    194         <tr> 
    195           <td width="25%"> 
    196             <input id="nat-yes" type="radio" name="nat" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="yes"?"checked=\"yes\"":""?>/> 
    197             <label for="nat-yes">yes</label> 
    198           </td> 
    199           <td width="25%"> 
    200             <input id="nat-no" type="radio" name="nat" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="no"?"checked=\"no\"":""?>/> 
    201             <label for="nat-no">no</label> 
    202           </td> 
    203           <td width="25%"> 
    204             <input id="nat-never" type="radio" name="nat" value="never" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="never"?"checked=\"never\"":""?>/> 
    205             <label for="nat-never">never</label> 
    206           </td> 
    207           <td width="25%"> 
    208             <input id="nat-route" type="radio" name="nat" value="route" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat=="route"?"checked=\"route\"":""?>/> 
    209             <label for="nat-route">route</label> 
    210           </td> 
    211         </tr> 
    212       </table> 
    213     </td> 
    214   </tr> 
    215  
    216   <tr> 
    217     <td> 
    218       <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> 
    219     </td> 
    220     <td> 
    221       <table width="100%"> 
    222         <tr> 
    223           <td> 
    224             <input id="nat-none" type="radio" name="nat_mode" value="public" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="public"?"checked=\"public\"":""?>/> 
    225             <label for="nat-none"><?php echo _("Public IP") ?></label> 
    226  
    227             <input id="externip" type="radio" name="nat_mode" value="externip" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="externip"?"checked=\"externip\"":""?>/> 
    228             <label for="externip"><?php echo _("Static IP") ?></label> 
    229  
    230             <input id="externhost" type="radio" name="nat_mode" value="externhost" tabindex="<?php echo ++$tabindex;?>"<?php echo $nat_mode=="externhost"?"checked=\"externhost\"":""?>/> 
    231             <label for="externhost"><?php echo _("Dynamic IP") ?></label> 
    232           </td> 
    233         </tr> 
    234       </table> 
    235     </td> 
    236   </tr> 
    237  
    238   <tr class="nat-settings externip"> 
    239     <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> 
    240     <td><input type="text" id="externip_val" name="externip_val" value="<?php echo $externip_val ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    241   </tr> 
    242  
    243   <tr class="nat-settings externhost"> 
    244     <td> 
    245       <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> 
    246     </td> 
    247     <td> 
    248       <input type="text" id="externhost_val" name="externhost_val" size="30" value="<?php echo $externhost_val ?>" tabindex="<?php echo ++$tabindex;?>"> 
    249       <input type="text" id="externrefresh" name="externrefresh" size="3" class="validate-int" value="<?php echo $externrefresh ?>" tabindex="<?php echo ++$tabindex;?>"> 
    250       <a href="#" class="info"><small><?php echo _("Refresh Rate")?><span><?php echo _("Asterisk: externrefresh. How often to lookup and refresh the External Host FQDN, in seconds.")?></span></small></a> 
    251     </td> 
    252   </tr> 
    253   <tr class="nat-settings"> 
    254     <td> 
    255       <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 Field button for more fields. Blank fields will be removed upon submitting.")?></span></a> 
    256     </td> 
    257     <td> 
    258       <input type="text" id="localnet_0" name="localnet_0" class="localnet validate=ip" value="<?php echo $localnet_0 ?>" tabindex="<?php echo ++$tabindex;?>"> / 
    259       <input type="text" id="netmask_0" name="netmask_0" class="netmask validate-netmask" value="<?php echo $netmask_0 ?>" tabindex="<?php echo ++$tabindex;?>"> 
    260     </td> 
    261   </tr> 
    262  
    263 <?php 
    264   $idx = 1; 
    265   $var_localnet = "localnet_$idx"; 
    266   $var_netmask = "netmask_$idx"; 
    267   while (isset($$var_localnet)) { 
    268     if ($$var_localnet != '') { 
    269       $tabindex++; 
    270       echo <<< END 
    271   <tr class="nat-settings"> 
    272     <td> 
    273     </td> 
    274     <td> 
    275       <input type="text" id="localnet_$idx" name="localnet_$idx" class="localnet validate-ip" value="{$$var_localnet}" tabindex="$tabindex"> / 
    276 END; 
    277       $tabindex++; 
    278       echo <<< END 
    279       <input type="text" id="netmask_$idx" name="netmask_$idx" class="netmask validate-netmask" value="{$$var_netmask}" tabindex="$tabindex"> 
    280     </td> 
    281   </tr> 
    282 END; 
    283     } 
    284     $idx++; 
    285     $var_localnet = "localnet_$idx"; 
    286     $var_netmask = "netmask_$idx"; 
    287   } 
    288   $tabindex += 40; // make room for dynamic insertion of new fields so we can add tabindexes 
    289 ?> 
    290   <tr class="nat-settings" id="auto-configure-buttons"> 
    291     <td></td> 
    292     <td><br \> 
    293       <input type="button" id="nat-auto-configure"  value="<?php echo _("Auto Configure")?>" class="nat-settings" /> 
    294       <input type="button" id="localnet-add"  value="<?php echo _("Add Local Network Field")?>" class="nat-settings" /> 
    295     </td> 
    296   </tr> 
    297  
    298150  <tr> 
    299151    <td colspan="2"><h5><?php echo _("Audio Codecs")?><hr></h5></td> 
     
    330182  <tr> 
    331183    <td> 
    332       <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> 
    333     </td> 
    334     <td> 
    335       <table width="100%"> 
    336         <tr> 
    337           <td width="25%"> 
    338             <input id="g726nonstandard-yes" type="radio" name="g726nonstandard" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $g726nonstandard=="yes"?"checked=\"yes\"":""?>/> 
    339             <label for="g726nonstandard-yes"><?php echo _("Yes") ?></label> 
    340           </td> 
    341           <td width="25%"> 
    342             <input id="g726nonstandard-no" type="radio" name="g726nonstandard" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $g726nonstandard=="no"?"checked=\"no\"":""?>/> 
    343             <label for="g726nonstandard-no"><?php echo _("No") ?></label> 
    344           </td> 
    345           <td width="25%"> </td><td width="25%"></td> 
    346         </tr> 
    347       </table> 
    348     </td> 
    349   </tr> 
    350  
    351   <tr> 
    352     <td> 
    353       <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> 
    354     </td> 
    355     <td> 
    356       <table width="100%"> 
    357         <tr> 
    358           <td width="25%"> 
    359             <input id="t38pt_udptl-yes" type="radio" name="t38pt_udptl" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $t38pt_udptl=="yes"?"checked=\"yes\"":""?>/> 
    360             <label for="t38pt_udptl-yes"><?php echo _("Yes") ?></label> 
    361           </td> 
    362           <td width="25%"> 
    363             <input id="t38pt_udptl-no" type="radio" name="t38pt_udptl" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $t38pt_udptl=="no"?"checked=\"no\"":""?>/> 
    364             <label for="t38pt_udptl-no"><?php echo _("No") ?></label> 
    365           </td> 
    366           <td width="25%"> </td><td width="25%"></td> 
     184      <a href="#" class="info"><?php echo _("Codec Priority")?><span><?php echo _("Asterisk: codecpriority. Controls the codec negotiation of an inbound IAX call. This option is inherited to all user entities.  It can also be defined in each user entity separately which will override the setting here. The valid values are:<br />host - Consider the host's preferred order ahead of the caller's.<br />caller - Consider the callers preferred order ahead of the host's.<br /> disabled - Disable the consideration of codec preference altogether. (this is the original behaviour before preferences were added)<br />reqonly  - Same as disabled, only do not consider capabilities if the requested format is not available the call will only be accepted if the requested format is available.")?></span></a> 
     185    </td> 
     186    <td> 
     187      <table width="100%"> 
     188        <tr> 
     189          <td width="25%"> 
     190            <input id="codecpriority-host" type="radio" name="codecpriority" value="host" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="host"?"checked=\"host\"":""?>/> 
     191            <label for="codecpriority-host">host</label> 
     192          </td> 
     193          <td width="25%"> 
     194            <input id="codecpriority-caller" type="radio" name="codecpriority" value="caller" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="caller"?"checked=\"caller\"":""?>/> 
     195            <label for="codecpriority-caller">caller</label> 
     196          </td> 
     197          <td width="25%"> 
     198            <input id="codecpriority-disabled" type="radio" name="codecpriority" value="disabled" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="disabled"?"checked=\"disabled\"":""?>/> 
     199            <label for="codecpriority-disabled">disabled</label> 
     200          </td> 
     201          <td width="25%"> 
     202            <input id="codecpriority-regonly" type="radio" name="codecpriority" value="regonly" tabindex="<?php echo ++$tabindex;?>"<?php echo $codecpriority=="regonly"?"checked=\"regonly\"":""?>/> 
     203            <label for="codecpriority-regonly">regonly</label> 
     204          </td> 
     205        </tr> 
     206      </table> 
     207    </td> 
     208  </tr> 
     209 
     210  <tr> 
     211    <td> 
     212      <a href="#" class="info"><?php echo _("Bandwidth")?><span><?php echo _("Asterisk: bandwidth. Specify bandwidth of low, medium, or high to control which codecs are used in general.")?></span></a> 
     213    </td> 
     214    <td> 
     215      <table width="100%"> 
     216        <tr> 
     217          <td width="25%"> 
     218            <input id="bandwidth-low" type="radio" name="bandwidth" value="low" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="low"?"checked=\"low\"":""?>/> 
     219            <label for="bandwidth-low"><?php echo _("low") ?></label> 
     220          </td> 
     221          <td width="25%"> 
     222            <input id="bandwidth-medium" type="radio" name="bandwidth" value="medium" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="medium"?"checked=\"medium\"":""?>/> 
     223            <label for="bandwidth-medium"><?php echo _("medium") ?></label> 
     224          </td> 
     225          <td width="25%"> 
     226            <input id="bandwidth-high" type="radio" name="bandwidth" value="high" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="high"?"checked=\"high\"":""?>/> 
     227            <label for="bandwidth-high"><?php echo _("high") ?></label> 
     228          </td> 
     229          <td width="25%"> 
     230            <input id="bandwidth-unset" type="radio" name="bandwidth" value="" tabindex="<?php echo ++$tabindex;?>"<?php echo $bandwidth=="unset"?"checked=\"unset\"":""?>/> 
     231            <label for="bandwidth-unset"><?php echo _("unset") ?></label> 
     232          </td> 
    367233        </tr> 
    368234      </table> 
     
    423289  </tr> 
    424290 
    425   <tr class="video-codecs"> 
    426     <td> 
    427       <a href="#" class="info"><?php echo _("Max Bit Rate")?><span><?php echo _("Maximum bitrate for video calls in kb/s")?></span></a> 
    428     </td> 
    429     <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> 
    430   </tr> 
    431  
    432   <tr> 
    433     <td colspan="2"><h5><?php echo _("MEDIA & RTP Settings") ?><hr></h5></td> 
    434   </tr> 
    435  
    436   <tr> 
    437     <td> 
    438       <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> 
    439     </td> 
    440     <td> 
    441       <table width="100%"> 
    442         <tr> 
    443           <td width="25%"> 
    444             <input id="canreinvite-yes" type="radio" name="canreinvite" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="yes"?"checked=\"yes\"":""?>/> 
    445             <label for="canreinvite-yes"><?php echo _("Yes") ?></label> 
    446           </td> 
    447           <td width="25%"> 
    448             <input id="canreinvite-no" type="radio" name="canreinvite" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="no"?"checked=\"no\"":""?>/> 
    449             <label for="canreinvite-no"><?php echo _("No") ?></label> 
    450           </td> 
    451           <td width="25%"> 
    452             <input id="canreinvite-nonat" type="radio" name="canreinvite" value="nonat" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="nonat"?"checked=\"nonat\"":""?>/> 
    453             <label for="canreinvite-nonat">never</label> 
    454           </td> 
    455           <td width="25%"> 
    456             <input id="canreinvite-update" type="radio" name="canreinvite" value="update" tabindex="<?php echo ++$tabindex;?>"<?php echo $canreinvite=="update"?"checked=\"update\"":""?>/> 
    457             <label for="canreinvite-update">update</label> 
    458           </td> 
    459         </tr> 
    460       </table> 
    461     </td> 
    462   </tr> 
    463  
    464   <tr> 
    465     <td> 
    466       <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> 
    467     </td> 
    468     <td> 
    469       <input type="text" size="2" id="rtptimeout" name="rtptimeout" class="validate-int" value="<?php echo $rtptimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtptimeout)</small>&nbsp; 
    470       <input type="text" size="2" id="rtpholdtimeout" name="rtpholdtimeout" class="validate-int" value="<?php echo $rtpholdtimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtpholdtimeout)</small>&nbsp; 
    471       <input type="text" size="2" id="rtpkeepalive" name="rtpkeepalive" class="validate-int" value="<?php echo $rtpkeepalive ?>" tabindex="<?php echo ++$tabindex;?>"><small>(rtpkeepalive)</small> 
    472     </td> 
    473   </tr> 
    474  
    475   <tr> 
    476     <td colspan="2"><h5><?php echo _("Notification & MWI")?><hr></h5></td> 
    477   </tr> 
    478  
    479   <tr> 
    480     <td> 
    481       <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> 
    482     </td> 
    483     <td><input type="text" size="3" id="checkmwi" name="checkmwi" class="validate-int" value="<?php echo $checkmwi ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
    484   </tr> 
    485  
    486   <tr> 
    487     <td> 
    488       <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> 
    489     </td> 
    490     <td> 
    491       <table width="100%"> 
    492         <tr> 
    493           <td width="25%"> 
    494             <input id="notifyringing-yes" type="radio" name="notifyringing" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyringing=="yes"?"checked=\"yes\"":""?>/> 
    495             <label for="notifyringing-yes"><?php echo _("Yes") ?></label> 
    496           </td> 
    497           <td width="25%"> 
    498             <input id="notifyringing-no" type="radio" name="notifyringing" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyringing=="no"?"checked=\"no\"":""?>/> 
    499             <label for="notifyringing-no"><?php echo _("No") ?></label> 
     291  <tr> 
     292    <td colspan="2"><h5><?php echo _("Registration Settings") ?><hr></h5></td> 
     293  </tr> 
     294 
     295  <tr> 
     296    <td> 
     297      <a href="#" class="info"><?php echo _("Registration Times")?><span><?php echo _("Asterisk: minregexpire, maxregexpire. Minimum and maximum length of time that IAX peers can request as a registration expiration interval (in seconds).")?></span></a> 
     298    </td> 
     299    <td> 
     300      <input type="text" size="2" id="minregexpire" name="minregexpire" class="validate-int" value="<?php echo $minregexpire ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(minregexpire)</small>&nbsp; 
     301      <input type="text" size="3" id="maxregexpire" name="maxregexpire" class="validate-int" value="<?php echo $maxregexpire ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(maxregexpire)</small>&nbsp; 
     302    </td> 
     303  </tr> 
     304 
     305  <tr> 
     306    <td colspan="2"><h5><?php echo _("Jitter Buffer Settings") ?><hr></h5></td> 
     307  </tr> 
     308 
     309  <tr> 
     310    <td> 
     311       <a href="#" class="info"><?php echo _("Jitter Buffer")?><span><?php echo _("Asterisk: jitterbuffer. You can adjust several parameters relating to the jitter buffer. The jitter buffer's function is to compensate for varying network delay. The jitter buffer works for INCOMING audio - the outbound audio will be dejittered by the jitter buffer at the other end.")?></span></a> 
     312    </td> 
     313    <td> 
     314      <table width="100%"> 
     315        <tr> 
     316          <td width="25%"> 
     317            <input id="jitterbuffer-yes" type="radio" name="jitterbuffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jitterbuffer=="yes"?"checked=\"yes\"":""?>/> 
     318            <label for="jitterbuffer-yes"><?php echo _("Enabled") ?></label> 
     319          </td> 
     320          <td width="25%"> 
     321            <input id="jitterbuffer-no" type="radio" name="jitterbuffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jitterbuffer=="no"?"checked=\"no\"":""?>/> 
     322            <label for="jitterbuffer-no"><?php echo _("Disabled") ?></label> 
    500323          </td> 
    501324          <td width="25%"> </td><td width="25%"></td> 
     
    505328  </tr> 
    506329 
    507   <tr
    508     <td> 
    509       <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> 
    510     </td> 
    511     <td> 
    512       <table width="100%"> 
    513         <tr> 
    514           <td width="25%"> 
    515             <input id="notifyhold-yes" type="radio" name="notifyhold" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyhold=="yes"?"checked=\"yes\"":""?>/> 
    516             <label for="notifyhold-yes"><?php echo _("Yes") ?></label> 
    517           </td> 
    518           <td width="25%"> 
    519             <input id="notifyhold-no" type="radio" name="notifyhold" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $notifyhold=="no"?"checked=\"no\"":""?>/> 
    520             <label for="notifyhold-no"><?php echo _("No") ?></label> 
     330  <tr class="jitter-buffer"
     331    <td> 
     332      <a href="#" class="info"><?php echo _("Force Jitter Buffer")?><span><?php echo _("Asterisk: forcejitterbuffer. Forces the use of a jitterbuffer on the receive side of an IAX channel. Normally the jitter buffer will not be used if receiving a jittery channel but sending it off to another channel such as a SIP channel to an endpoint, since there is typically a jitter buffer at the far end. This will force the use of the jitter buffer before sending the stream on. This is not typically desired as it adds additional latency into the stream.")?></span></a> 
     333    </td> 
     334    <td> 
     335      <table width="100%"> 
     336        <tr> 
     337          <td width="25%"> 
     338            <input id="forcejitterbuffer-yes" type="radio" name="forcejitterbuffer" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $forcejitterbuffer=="yes"?"checked=\"yes\"":""?>/> 
     339            <label for="forcejitterbuffer-yes"><?php echo _("Yes") ?></label> 
     340          </td> 
     341          <td width="25%"> 
     342            <input id="forcejitterbuffer-no" type="radio" name="forcejitterbuffer" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $forcejitterbuffer=="no"?"checked=\"no\"":""?>/> 
     343            <label for="forcejitterbuffer-no"><?php echo _("No") ?></label> 
    521344          </td> 
    522345          <td width="25%"> </td><td width="25%"></td> 
     
    526349  </tr> 
    527350 
    528   <tr> 
    529     <td colspan="2"><h5><?php echo _("Registration Settings") ?><hr></h5></td> 
    530   </tr> 
    531  
    532   <tr> 
    533     <td> 
    534       <a href="#" class="info"><?php echo _("Registrations")?><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> 
    535     </td> 
    536     <td> 
    537       <input type="text" size="2" id="registertimeout" name="registertimeout" class="validate-int" value="<?php echo $registertimeout ?>" tabindex="<?php echo ++$tabindex;?>"><small>(registertimeout)</small>&nbsp; 
    538       <input type="text" size="2" id="registerattempts" name="registerattempts" class="validate-int" value="<?php echo $registerattempts ?>" tabindex="<?php echo ++$tabindex;?>"><small>(registerattempts)</small> 
    539     </td> 
    540   </tr> 
    541  
    542   <tr> 
    543     <td> 
    544       <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> 
    545     </td> 
    546     <td> 
    547       <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; 
    548       <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; 
    549       <input type="text" size="3" id="defaultexpiry" name="defaultexpiry" class="validate-int" value="<?php echo $defaultexpiry ?>" tabindex="<?php echo ++$tabindex;?>"><small>&nbsp;(defaultexpiry)</small> 
    550     </td> 
    551   </tr> 
    552  
    553   <tr> 
    554     <td colspan="2"><h5><?php echo _("Jitter Buffer Settings") ?><hr></h5></td> 
    555   </tr> 
    556  
    557   <tr> 
    558     <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> 
    559     <td> 
    560       <table width="100%"> 
    561         <tr> 
    562           <td width="25%"> 
    563             <input id="jbenable-yes" type="radio" name="jbenable" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbenable=="yes"?"checked=\"yes\"":""?>/> 
    564             <label for="jbenable-yes"><?php echo _("Enabled") ?></label> 
    565           </td> 
    566           <td width="25%"> 
    567             <input id="jbenable-no" type="radio" name="jbenable" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbenable=="no"?"checked=\"no\"":""?>/> 
    568             <label for="jbenable-no"><?php echo _("Disabled") ?></label> 
     351  <tr class="jitter-buffer"> 
     352    <td> 
     353      <a href="#" class="info"><?php echo _("Jitter Buffer Size")?><span><?php echo _("Asterisk: maxjitterbuffer. Max length of the jitterbuffer in milliseconds.<br /> Asterisk: resyncthreshold. When the jitterbuffer notices a significant change in delay that continues over a few frames, it will resync, assuming that the change in delay was caused by a timestamping mix-up. The threshold for noticing a change in delay is measured as twice the measured jitter plus this resync threshold. Resyncing can be disabled by setting this parameter to -1.")?></span></a> 
     354    </td> 
     355    <td> 
     356      <input type="text" size="4" id="maxjitterbuffer" name="maxjitterbuffer" class="jitter-buffer validate-int" value="<?php echo $maxjitterbuffer ?>" tabindex="<?php echo ++$tabindex;?>"><small>(maxjitterbuffer)</small>&nbsp; 
     357      <input type="text" size="4" id="resyncthreshold" name="resyncthreshold" class="jitter-buffer validate-int" value="<?php echo $resyncthreshold ?>" tabindex="<?php echo ++$tabindex;?>"><small>(resyncthreshold)</small>&nbsp; 
     358    </td> 
     359  </tr> 
     360 
     361  <tr class="jitter-buffer"> 
     362    <td> 
     363      <a href="#" class="info"><?php echo _("Max Interpolations")?><span><?php echo _("Asterisk: maxjitterinterps. The maximum number of interpolation frames the jitterbuffer should return in a row. Since some clients do not send CNG/DTX frames to indicate silence, the jitterbuffer will assume silence has begun after returning this many interpolations. This prevents interpolating throughout a long silence.")?></span></a> 
     364    </td> 
     365    <td> 
     366      <input type="text" size="4" id="maxjitterinterps" name="maxjitterinterps" class="jitter-buffer validate-int" value="<?php echo $maxjitterinterps ?>" tabindex="<?php echo ++$tabindex;?>"> 
     367    </td> 
     368  </tr> 
     369 
     370  <tr> 
     371    <td colspan="2"><h5><?php echo _("Advanced General Settings") ?><hr></h5></td> 
     372  </tr> 
     373 
     374  <tr> 
     375    <td> 
     376      <a href="#" class="info"><?php echo _("Language")?><span><?php echo _("Default Language for a channel, Asterisk: language")?></span></a> 
     377    </td> 
     378    <td> 
     379      <input type="text" id="iax_language" name="iax_language" class="validate-alphanumeric" value="<?php echo $iax_language ?>" tabindex="<?php echo ++$tabindex;?>"> 
     380    </td> 
     381  </tr> 
     382 
     383  <tr> 
     384    <td> 
     385      <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. To bind to multiple IP addresses or ports, use the Other 'IAX Settings' fields where you can put settings such as:<br /> bindaddr=192.168.10.100:4555.<br />  It is recommended to leave this blank.")?></span></a> 
     386    </td> 
     387    <td> 
     388      <input type="text" id="bindaddr" name="bindaddr" class="validate-ip" value="<?php echo $bindaddr ?>" tabindex="<?php echo ++$tabindex;?>"> 
     389    </td> 
     390  </tr> 
     391 
     392  <tr> 
     393    <td> 
     394      <a href="#" class="info"><?php echo _("Bind Port")?><span><?php echo _("Asterisk: bindport. Local incoming UDP Port that Asterisk will bind to and listen for IAX messages. The IAX standard is 4569 and in most cases this is what you want. It is recommended to leave this blank.")?></span></a> 
     395    </td> 
     396    <td> 
     397      <input type="text" id="bindport" name="bindport" class="validate-ip-port" value="<?php echo $bindport ?>" tabindex="<?php echo ++$tabindex;?>"> 
     398    </td> 
     399  </tr> 
     400 
     401  <tr> 
     402    <td> 
     403      <a href="#" class="info"><?php echo _("Delay Auth Rejects")?><span><?php echo _("Asterisk: delayreject. For increased security against brute force password attacks enable this which will delay the sending of authentication reject for REGREQ or AUTHREP if there is a password.")?></span></a> 
     404    </td> 
     405    <td> 
     406      <table width="100%"> 
     407        <tr> 
     408          <td width="25%"> 
     409            <input id="delayreject-yes" type="radio" name="delayreject" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $delayreject=="yes"?"checked=\"yes\"":""?>/> 
     410            <label for="delayreject-yes"><?php echo _("Enable") ?></label> 
     411          </td> 
     412          <td width="25%"> 
     413            <input id="delayreject-no" type="radio" name="delayreject" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $delayreject=="no"?"checked=\"no\"":""?>/> 
     414            <label for="delayreject-no"><?php echo _("Disable") ?></label> 
    569415          </td> 
    570416          <td width="25%"> </td><td width="25%"></td> 
     
    574420  </tr> 
    575421 
    576   <tr class="jitter-buffer"> 
    577     <td> 
    578       <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> 
    579     </td> 
    580     <td> 
    581       <table width="100%"> 
    582         <tr> 
    583           <td width="25%"> 
    584             <input id="jbforce-yes" type="radio" name="jbforce" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbforce=="yes"?"checked=\"yes\"":""?>/> 
    585             <label for="jbforce-yes"><?php echo _("Yes") ?></label> 
    586           </td> 
    587           <td width="25%"> 
    588             <input id="jbforce-no" type="radio" name="jbforce" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbforce=="no"?"checked=\"no\"":""?>/> 
    589             <label for="jbforce-no"><?php echo _("No") ?></label> 
    590           </td> 
    591           <td width="25%"> </td><td width="25%"></td> 
    592         </tr> 
    593       </table> 
    594     </td> 
    595   </tr> 
    596  
    597   <tr class="jitter-buffer"> 
    598     <td> 
    599       <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> 
    600     </td> 
    601     <td> 
    602       <table width="100%"> 
    603         <tr> 
    604           <td width="25%"> 
    605             <input id="jbimpl-fixed" type="radio" name="jbimpl" class="jitter-buffer" value="fixed" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbimpl=="fixed"?"checked=\"fixed\"":""?>/> 
    606             <label for="jbimpl-fixed"><?php echo _("Fixed") ?></label> 
    607           </td> 
    608           <td width="25%"> 
    609             <input id="jbimpl-adaptive" type="radio" name="jbimpl" class="jitter-buffer" value="adaptive" tabindex="<?php echo ++$tabindex;?>"<?php echo $jbimpl=="adaptive"?"checked=\"adaptive\"":""?>/> 
    610             <label for="jbimpl-adaptive"><?php echo _("Adaptive") ?></label> 
    611           </td> 
    612           <td width="25%"> </td><td width="25%"></td> 
    613         </tr> 
    614       </table> 
    615     </td> 
    616   </tr> 
    617  
    618   <tr class="jitter-buffer"> 
    619     <td> 
    620       <a href="#" class="info"><?php echo _("Jitter Buffer Logging")?><span><?php echo _("Asterisk: jblog. Enables jitter buffer frame logging.")?></span></a> 
    621     </td> 
    622     <td> 
    623       <table width="100%"> 
    624         <tr> 
    625           <td width="25%"> 
    626             <input id="jblog-yes" type="radio" name="jblog" class="jitter-buffer" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $jblog=="yes"?"checked=\"yes\"":""?>/> 
    627             <label for="jblog-yes"><?php echo _("Enable") ?></label> 
    628           </td> 
    629           <td width="25%"> 
    630             <input id="jblog-no" type="radio" name="jblog" class="jitter-buffer" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $jblog=="no"?"checked=\"no\"":""?>/> 
    631             <label for="jblog-no"><?php echo _("Disable") ?></label> 
    632           </td> 
    633           <td width="25%"> </td><td width="25%"></td> 
    634         </tr> 
    635       </table> 
    636     </td> 
    637   </tr> 
    638  
    639   <tr class="jitter-buffer"> 
    640     <td> 
    641       <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> 
    642     </td> 
    643     <td> 
    644       <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; 
    645       <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; 
    646     </td> 
    647   </tr> 
    648  
    649   <tr> 
    650     <td colspan="2"><h5><?php echo _("Advanced General Settings") ?><hr></h5></td> 
    651   </tr> 
    652  
    653   <tr> 
    654     <td> 
    655       <a href="#" class="info"><?php echo _("Language")?><span><?php echo _("Default Language for a channel, Asterisk: language")?></span></a> 
    656     </td> 
    657     <td> 
    658       <input type="text" id="sip-language" name="sip-language" class="validate-alphanumeric" value="<?php echo $sip_language ?>" tabindex="<?php echo ++$tabindex;?>"> 
    659     </td> 
    660   </tr> 
    661  
    662   <tr> 
    663     <td> 
    664       <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. It is recommended to leave this blank.")?></span></a> 
    665     </td> 
    666     <td> 
    667       <input type="text" id="default-context" name="default-context alpha-numeric" value="<?php echo $context ?>" tabindex="<?php echo ++$tabindex;?>"> 
    668     </td> 
    669   </tr> 
    670  
    671   <tr> 
    672     <td> 
    673       <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. It is recommended to leave this blank.")?></span></a> 
    674     </td> 
    675     <td> 
    676       <input type="text" id="bindaddr" name="bindaddr" class="validate-ip" value="<?php echo $bindaddr ?>" tabindex="<?php echo ++$tabindex;?>"> 
    677     </td> 
    678   </tr> 
    679  
    680   <tr> 
    681     <td> 
    682       <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. It is recommended to leave this blank.")?></span></a> 
    683     </td> 
    684     <td> 
    685       <input type="text" id="bindport" name="bindport" class="validate-ip-port" value="<?php echo $bindport ?>" tabindex="<?php echo ++$tabindex;?>"> 
    686     </td> 
    687   </tr> 
    688  
    689   <tr> 
    690     <td> 
    691       <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> 
    692     </td> 
    693     <td> 
    694       <table width="100%"> 
    695         <tr> 
    696           <td width="25%"> 
    697             <input id="allowguest-yes" type="radio" name="allowguest" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $allowguest=="yes"?"checked=\"yes\"":""?>/> 
    698             <label for="allowguest-yes"><?php echo _("Yes") ?></label> 
    699           </td> 
    700           <td width="25%"> 
    701             <input id="allowguest-no" type="radio" name="allowguest" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $allowguest=="no"?"checked=\"no\"":""?>/> 
    702             <label for="allowguest-no"><?php echo _("No") ?></label> 
    703           </td> 
    704           <td width="25%"> </td><td width="25%"></td> 
    705         </tr> 
    706       </table> 
    707     </td> 
    708   </tr> 
    709  
    710   <tr> 
    711     <td> 
    712       <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> 
    713     </td> 
    714     <td> 
    715       <table width="100%"> 
    716         <tr> 
    717           <td width="25%"> 
    718             <input id="srvlookup-yes" type="radio" name="srvlookup" value="yes" tabindex="<?php echo ++$tabindex;?>"<?php echo $srvlookup=="yes"?"checked=\"yes\"":""?>/> 
    719             <label for="srvlookup-yes"><?php echo _("Enabled") ?></label> 
    720           </td> 
    721           <td width="25%"> 
    722             <input id="srvlookup-no" type="radio" name="srvlookup" value="no" tabindex="<?php echo ++$tabindex;?>"<?php echo $srvlookup=="no"?"checked=\"no\"":""?>/> 
    723             <label for="srvlookup-no"><?php echo _("Disabled") ?></label> 
    724           </td> 
    725           <td width="25%"> </td><td width="25%"></td> 
    726         </tr> 
    727       </table> 
    728     </td> 
    729   </tr> 
    730  
    731422  <tr><td colspan="2"><br /></td></tr> 
    732423 
    733424  <tr> 
    734425    <td> 
    735       <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. Blank boxes will be deleted when submitted.")?></span></a> 
    736     </td> 
    737     <td> 
    738       <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;?>"> = 
    739       <input type="text" id="sip_custom_val_0" name="sip_custom_val_0" value="<?php echo $sip_custom_val_0 ?>" tabindex="<?php echo ++$tabindex;?>"> 
     426      <a href="#" class="info"><?php echo _("Other IAX Settings")?><span><?php echo _("You may set any other IAX settings not present here that are allowed to be configured in the General section of iax.conf. There will be no error checking against these settings so check them carefully. They should be entered as:<br /> [setting] = [value]<br /> in the boxes below. Click the Add Field box to add additional fields. Blank boxes will be deleted when submitted.")?></span></a> 
     427    </td> 
     428    <td> 
     429      <input type="text" id="iax_custom_key_0" name="iax_custom_key_0" class="iax-custom" value="<?php echo $iax_custom_key_0 ?>" tabindex="<?php echo ++$tabindex;?>"> = 
     430      <input type="text" id="iax_custom_val_0" name="iax_custom_val_0" value="<?php echo $iax_custom_val_0 ?>" tabindex="<?php echo ++$tabindex;?>"> 
    740431    </td> 
    741432  </tr> 
     
    743434<?php 
    744435  $idx = 1; 
    745   $var_sip_custom_key = "sip_custom_key_$idx"; 
    746   $var_sip_custom_val = "sip_custom_val_$idx"; 
    747   while (isset($$var_sip_custom_key)) { 
    748     if ($$var_sip_custom_key != '') { 
     436  $var_iax_custom_key = "iax_custom_key_$idx"; 
     437  $var_iax_custom_val = "iax_custom_val_$idx"; 
     438  while (isset($$var_iax_custom_key)) { 
     439    if ($$var_iax_custom_key != '') { 
    749440      $tabindex++; 
    750441      echo <<< END 
     
    753444    </td> 
    754445    <td> 
    755       <input type="text" id="sip_custom_key_$idx" name="sip_custom_key_$idx" class="sip-custom" value="{$$var_sip_custom_key}" tabindex="$tabindex"> = 
     446      <input type="text" id="iax_custom_key_$idx" name="iax_custom_key_$idx" class="iax-custom" value="{$$var_iax_custom_key}" tabindex="$tabindex"> = 
    756447END; 
    757448      $tabindex++; 
    758449      echo <<< END 
    759       <input type="text" id="sip_custom_val_$idx" name="sip_custom_val_$idx" value="{$$var_sip_custom_val}" tabindex="$tabindex"> 
     450      <input type="text" id="iax_custom_val_$idx" name="iax_custom_val_$idx" value="{$$var_iax_custom_val}" tabindex="$tabindex"> 
    760451    </td> 
    761452  </tr> 
     
    763454    } 
    764455    $idx++; 
    765     $var_sip_custom_key = "sip_custom_key_$idx"; 
    766     $var_sip_custom_val = "sip_custom_val_$idx"; 
     456    $var_iax_custom_key = "iax_custom_key_$idx"; 
     457    $var_iax_custom_val = "iax_custom_val_$idx"; 
    767458  } 
    768459  $tabindex += 60; // make room for dynamic insertion of new fields 
    769460?> 
    770   <tr id="sip-custom-buttons"> 
     461  <tr id="iax-custom-buttons"> 
    771462    <td></td> 
    772463    <td><br \> 
    773       <input type="button" id="sip-custom-add"  value="<?php echo _("Add Field")?>" /> 
     464      <input type="button" id="iax-custom-add"  value="<?php echo _("Add Field")?>" /> 
    774465    </td> 
    775466  </tr> 
     
    782473<!-- 
    783474$(document).ready(function(){ 
    784   /* On click ajax to pbx and determine extenral network and localnet settings */ 
    785   $.ajaxTimeout( 10000 ); 
    786   $("#nat-auto-configure").click(function(){ 
    787     $.ajax({ 
    788       type: 'POST', 
    789       url: "<?php echo $_SERVER["PHP_SELF"]; ?>", 
    790       data: "quietmode=1&skip_astman=1&handler=file&module=sipsettings&file=natget.html.php", 
    791       dataType: 'json', 
    792       success: function(data) { 
    793         if (data.status == 'success') { 
    794           $('.netmask').attr("value",""); 
    795           $('.localnet').attr("value",""); 
    796           $('#externip_val').attr("value",data.externip); 
    797           /*  Iterate through each localnet:netmask pair. Put them into any fields on the form 
    798            *  until we have no more, than create new ones 
    799                                          */ 
    800           var fields = $(".localnet").size(); 
    801           var cnt = 0; 
    802           $.each(data.localnet, function(loc,mask){ 
    803             if (cnt < fields) { 
    804               $('#localnet_'+cnt).attr("value",loc); 
    805               $('#netmask_'+cnt).attr("value",mask); 
    806             } else { 
    807               addLocalnet(loc,mask); 
    808             } 
    809             cnt++; 
    810           }); 
    811         } else { 
    812           alert(data.status); 
    813         } 
    814       }, 
    815       error: function(data) { 
    816         alert("<?php echo _("An Error occured trying fetch network configuration and external IP address")?>"); 
    817       }, 
    818     }); 
    819     return false; 
    820   }); 
    821  
    822   /* Add a Local Network / Mask textbox */ 
    823   $("#localnet-add").click(function(){ 
    824     addLocalnet("",""); 
    825   }); 
    826475 
    827476  /* Add a Custom Var / Val textbox */ 
    828   $("#sip-custom-add").click(function(){ 
     477  $("#iax-custom-add").click(function(){ 
    829478    addCustomField("",""); 
    830   }); 
    831  
    832   /* Initialize Nat GUI and respond to radio button presses */ 
    833   if (document.getElementById("externhost").checked) { 
    834     $(".externip").hide(); 
    835   } else if (document.getElementById("externip").checked) { 
    836     $(".externhost").hide(); 
    837   } else { 
    838     $(".nat-settings").hide(); 
    839   } 
    840   $("#nat-none").click(function(){ 
    841     $(".nat-settings").hide(); 
    842   }); 
    843   $("#externip").click(function(){ 
    844     $(".nat-settings").show(); 
    845     $(".externhost").hide(); 
    846   }); 
    847   $("#externhost").click(function(){ 
    848     $(".nat-settings").show(); 
    849     $(".externip").hide(); 
    850479  }); 
    851480 
     
    862491 
    863492  /* Initialize Jitter Buffer settings and show/hide */ 
    864   if (document.getElementById("jbenable-no").checked) { 
     493  if (document.getElementById("jitterbuffer-no").checked) { 
    865494    $(".jitter-buffer").hide(); 
    866495  } 
    867   $("#jbenable-yes").click(function(){ 
     496  $("#jitterbuffer-yes").click(function(){ 
    868497    $(".jitter-buffer").show(); 
    869498  }); 
    870   $("#jbenable-no").click(function(){ 
     499  $("#jitterbuffer-no").click(function(){ 
    871500    $(".jitter-buffer").hide(); 
    872501  }); 
     
    881510}); 
    882511 
    883 var theForm = document.editSip
    884  
    885 /* Insert a localnet/netmask pair of text boxes */ 
    886 function addLocalnet(localnet, netmask) { 
    887   var idx = $(".localnet").size(); 
     512var theForm = document.editIax
     513 
     514/* Insert a iax_setting/iax_value pair of text boxes */ 
     515function addCustomField(key, val) { 
     516  var idx = $(".iax-custom").size(); 
    888517  var idxp = idx - 1; 
    889   var tabindex = parseInt($("#netmask_"+idxp).attr('tabindex')) + 1; 
     518  var tabindex = parseInt($("#iax_custom_val_"+idxp).attr('tabindex')) + 1; 
    890519  var tabindexp = tabindex + 1; 
    891520 
    892   $("#auto-configure-buttons").before('\ 
    893   <tr class="nat-settings">\ 
    894     <td>\ 
    895     </td>\ 
    896     <td>\ 
    897       <input type="text" id="localnet_'+idx+'" name="localnet_'+idx+'" class="localnet" value="'+localnet+'" tabindex="'+tabindex+'"> /\ 
    898       <input type="text" id="netmask_'+idx+'" name="netmask_'+idx+'" class="netmask validate-netmask" value="'+netmask+'" tabindex="'+tabindexp+'">\ 
    899     </td>\ 
    900   </tr>\ 
    901   '); 
    902 
    903  
    904 /* Insert a sip_setting/sip_value pair of text boxes */ 
    905 function addCustomField(key, val) { 
    906   var idx = $(".sip-custom").size(); 
    907   var idxp = idx - 1; 
    908   var tabindex = parseInt($("#sip_custom_val_"+idxp).attr('tabindex')) + 1; 
    909   var tabindexp = tabindex + 1; 
    910  
    911   $("#sip-custom-buttons").before('\ 
     521  $("#iax-custom-buttons").before('\ 
    912522  <tr>\ 
    913523    <td>\ 
    914524    </td>\ 
    915525    <td>\ 
    916       <input type="text" id="sip_custom_key_'+idx+'" name="sip_custom_key_'+idx+'" class="sip-custom" value="'+key+'" tabindex="'+tabindex+'"> =\ 
    917       <input type="text" id="sip_custom_val_'+idx+'" name="sip_custom_val_'+idx+'" value="'+val+'" tabindex="'+tabindexp+'">\ 
     526      <input type="text" id="iax_custom_key_'+idx+'" name="iax_custom_key_'+idx+'" class="iax-custom" value="'+key+'" tabindex="'+tabindex+'"> =\ 
     527      <input type="text" id="iax_custom_val_'+idx+'" name="iax_custom_val_'+idx+'" value="'+val+'" tabindex="'+tabindexp+'">\ 
    918528    </td>\ 
    919529  </tr>\ 
  • modules/branches/2.6/iaxsettings/sipsettings.css

    r7836 r7848  
    22        border:2px solid red; 
    33} 
    4 div.sip-errors { 
     4div.iax-errors { 
    55        border:3px solid red; 
    66        background-repeat: repeat-x; 
    77} 
    8 div.sip-errors p { 
     8div.iax-errors p { 
    99        text-align:center; 
    1010        color:red; 
  • modules/branches/2.6/iaxsettings/uninstall.php

    r7826 r7848  
    2020*/ 
    2121 
    22 sql("DROP TABLE `sipsettings`"); 
     22sql("DROP TABLE `iaxsettings`");