Changeset 8792

Show
Ignore:
Timestamp:
02/08/10 17:50:52 (1 month ago)
Author:
p_lindheimer
Message:

closes #3976 adds a way to force codec priorities

Files:

Legend:

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

    r8275 r8792  
    146146        $core_conf->addIaxGeneral('disallow','all'); 
    147147        foreach ($codecs as $codec => $enabled) { 
    148           if ($enabled == '1') { 
     148          if ($enabled != '') { 
    149149            $core_conf->addIaxGeneral('allow',$codec); 
    150150          } 
     
    154154        if ($interim_settings['videosupport'] == 'yes') { 
    155155          foreach ($video_codecs as $codec => $enabled) { 
    156             if ($enabled == '1') { 
     156            if ($enabled != '') { 
    157157              $core_conf->addIaxGeneral('allow',$codec); 
    158158            } 
     
    221221  $iax_settings['codecs']            =  array( 
    222222    'ulaw'     => '1', 
    223     'alaw'     => '1', 
     223    'alaw'     => '2', 
    224224    'slin'     => '', 
    225225    'g726'     => '', 
    226     'gsm'      => '1', 
     226    'gsm'      => '3', 
    227227    'g729'     => '', 
    228228    'ilbc'     => '', 
  • modules/branches/2.7/iaxsettings/install.php

    r8668 r8792  
    5656  $sip_settings =  array( 
    5757    array('ulaw'    ,'1', '0'), 
    58     array('alaw'    ,'1', '1'), 
     58    array('alaw'    ,'2', '1'), 
    5959    array('slin'    ,'' , '2'), 
    6060    array('g726'    ,'' , '3'), 
    61     array('gsm'     ,'1', '4'), 
     61    array('gsm'     ,'3', '4'), 
    6262    array('g729'    ,'' , '5'), 
    6363    array('ilbc'    ,'' , '6'), 
  • modules/branches/2.7/iaxsettings/module.xml

    r8282 r8792  
    22        <rawname>iaxsettings</rawname> 
    33        <name>Asterisk IAX Settings</name> 
    4         <version>2.6.0.5</version> 
     4        <version>2.7.0.0</version> 
    55        <publisher>Bandwidth.com</publisher> 
    66        <license>AGPLv3</license> 
     
    1414        </description> 
    1515        <changelog> 
     16                *2.7.0.0* #3976 allows codec priorities 
    1617                *2.6.0.5* #3866 
    1718                *2.6.0.4* localizations, misc 
  • modules/branches/2.7/iaxsettings/page.iaxsettings.php

    r8250 r8792  
    4646    $codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    4747  } 
     48  uasort($codecs, 'cmp'); 
    4849  $iax_settings['codecs']            = $codecs; 
    4950 
     
    5758    $video_codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    5859  } 
     60  uasort($video_codecs, 'cmp'); 
    5961  $iax_settings['codecpriority']     = isset($_POST['codecpriority']) ? $_POST['codecpriority'] : 'host'; 
    6062  $iax_settings['bandwidth']         = isset($_POST['bandwidth']) ? $_POST['bandwidth'] : 'unset'; 
     
    8688    $p_idx++; 
    8789  } 
     90  function cmp($a, $b) { 
     91    if ($a == $b) { 
     92      return 0; 
     93    } 
     94    if ($a == '') { 
     95      return 1; 
     96    } elseif ($b == '') { 
     97      return -1; 
     98    } else { 
     99      return ($a > $b) ? 1 : -1; 
     100    } 
     101  } 
    88102 
    89103switch ($action) { 
     
    114128         */ 
    115129  $codecs = $iax_settings['codecs']; 
     130  unset($iax_settings['codecs']); 
     131  uasort($codecs, 'cmp'); 
     132 
    116133  $video_codecs = $iax_settings['video_codecs']; 
    117   unset($iax_settings['codecs']); 
    118134  unset($iax_settings['video_codecs']); 
     135  uasort($video_codecs, 'cmp'); 
    119136 
    120137  /* EXTRACT THE VARIABLE HERE - MAKE SURE THEY ARE ALL MASSAGED ABOVE */ 
     
    152169  </tr> 
    153170  <tr> 
    154     <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> 
     171    <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.")._(" If you clear each codec and then add them one at a time, submitting with each addition, they will be added in order which will effect the codec priority.")?></span></a></td> 
    155172    <td> 
    156173      <table width="100%"> 
     
    158175<?php 
    159176  $cols = $cols_per_row; 
     177  $seq = 1; 
    160178  foreach ($codecs as $codec => $codec_state) { 
    161179    if ($cols == 0) { 
     
    169187    echo <<< END 
    170188          <td width="$width%"> 
    171             <input type="checkbox" value="1" name="$codec" id="$codec" class="audio-codecs" tabindex="$tabindex" $codec_checked /> 
     189            <input type="checkbox" value="$seq" name="$codec" id="$codec" class="audio-codecs" tabindex="$tabindex" $codec_checked /> 
    172190            <label for="$codec"> <small>$codec_trans</small> </label> 
    173191          </td> 
    174192END; 
     193    $seq++; 
    175194  } 
    176195?> 
     
    242261  <tr> 
    243262    <td> 
    244       <a href="#" class="info"><?php echo _("Video Support")?><span><?php echo _("Check to enable and then choose allowed codecs.")?></span></a> 
     263      <a href="#" class="info"><?php echo _("Video Support")?><span><?php echo _("Check to enable and then choose allowed codecs.")._(" If you clear each codec and then add them one at a time, submitting with each addition, they will be added in order which will effect the codec priority.")?></span></a> 
    245264    </td> 
    246265    <td> 
     
    267286<?php 
    268287  $cols = $cols_per_row; 
     288  $seq = 1; 
    269289  foreach ($video_codecs as $codec => $codec_state) { 
    270290    if ($cols == 0) { 
     
    278298    echo <<< END 
    279299          <td width="$width%"> 
    280             <input type="checkbox" value="1" name="$codec" id="$codec" class="video-codecs" tabindex="$tabindex" $codec_checked /> 
     300            <input type="checkbox" value="$seq" name="$codec" id="$codec" class="video-codecs" tabindex="$tabindex" $codec_checked /> 
    281301            <label for="$codec"><small> $codec_trans </small></label> 
    282302          </td> 
    283303END; 
     304  $seq++; 
    284305  } 
    285306?> 
  • modules/branches/2.7/sipsettings/functions.inc.php

    r8275 r8792  
    147147        $core_conf->addSipGeneral('disallow','all'); 
    148148        foreach ($codecs as $codec => $enabled) { 
    149           if ($enabled == '1') { 
     149          if ($enabled != '') { 
    150150            $core_conf->addSipGeneral('allow',$codec); 
    151151          } 
     
    155155        if ($interim_settings['videosupport'] == 'yes') { 
    156156          foreach ($video_codecs as $codec => $enabled) { 
    157             if ($enabled == '1') { 
     157            if ($enabled != '') { 
    158158              $core_conf->addSipGeneral('allow',$codec); 
    159159            } 
     
    255255  $sip_settings['codecs']            =  array( 
    256256    'ulaw'     => '1', 
    257     'alaw'     => '1', 
     257    'alaw'     => '2', 
    258258    'slin'     => '', 
    259259    'g726'     => '', 
    260     'gsm'      => '1', 
     260    'gsm'      => '3', 
    261261    'g729'     => '', 
    262262    'ilbc'     => '', 
  • modules/branches/2.7/sipsettings/install.php

    r8243 r8792  
    5656  $sip_settings =  array( 
    5757    array('ulaw'    ,'1', '0'), 
    58     array('alaw'    ,'1', '1'), 
     58    array('alaw'    ,'2', '1'), 
    5959    array('slin'    ,'' , '2'), 
    6060    array('g726'    ,'' , '3'), 
    61     array('gsm'     ,'1', '4'), 
     61    array('gsm'     ,'3', '4'), 
    6262    array('g729'    ,'' , '5'), 
    6363    array('ilbc'    ,'' , '6'), 
  • modules/branches/2.7/sipsettings/module.xml

    r8285 r8792  
    22        <rawname>sipsettings</rawname> 
    33        <name>Asterisk SIP Settings</name> 
    4         <version>2.6.0.7</version> 
     4        <version>2.7.0.0</version> 
    55        <publisher>Bandwidth.com</publisher> 
    66        <license>AGPLv3</license> 
     
    1414        </description> 
    1515        <changelog> 
     16                *2.7.0.0* #3976 allows codec priorities 
    1617                *2.6.0.7* #3866 
    1718                *2.6.0.6* #3722, localizations 
  • modules/branches/2.7/sipsettings/page.sipsettings.php

    r8244 r8792  
    4343    }  
    4444    $p_idx++; 
     45  } 
     46  function cmp($a, $b) { 
     47    if ($a == $b) { 
     48      return 0; 
     49    } 
     50    if ($a == '') { 
     51      return 1; 
     52    } elseif ($b == '') { 
     53      return -1; 
     54    } else { 
     55      return ($a > $b) ? 1 : -1; 
     56    } 
    4557  } 
    4658 
     
    6375    $codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    6476  } 
     77  uasort($codecs, 'cmp'); 
    6578  $sip_settings['codecs']            = $codecs; 
    6679  $sip_settings['g726nonstandard']   = isset($_POST['g726nonstandard']) ? $_POST['g726nonstandard'] : 'no'; 
     
    7689    $video_codecs[$codec] = isset($_POST[$codec]) ? $_POST[$codec] : ''; 
    7790  } 
     91  uasort($video_codecs, 'cmp'); 
    7892  $sip_settings['video_codecs']      = $video_codecs; 
    7993  $sip_settings['videosupport']      = isset($_POST['videosupport']) ? $_POST['videosupport'] : 'no'; 
     
    147161         */ 
    148162  $codecs = $sip_settings['codecs']; 
     163  unset($sip_settings['codecs']); 
     164  uasort($codecs, 'cmp'); 
     165 
    149166  $video_codecs = $sip_settings['video_codecs']; 
    150   unset($sip_settings['codecs']); 
    151167  unset($sip_settings['video_codecs']); 
     168  uasort($video_codecs, 'cmp'); 
    152169 
    153170  /* EXTRACT THE VARIABLE HERE - MAKE SURE THEY ARE ALL MASSAGED ABOVE */ 
     
    300317  </tr> 
    301318  <tr> 
    302     <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> 
     319    <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.")._(" If you clear each codec and then add them one at a time, submitting with each addition, they will be added in order which will effect the codec priority.")?></span></a></td> 
    303320    <td> 
    304321      <table width="100%"> 
     
    306323<?php 
    307324  $cols = $cols_per_row; 
     325  $seq = 1; 
    308326  foreach ($codecs as $codec => $codec_state) { 
    309327    if ($cols == 0) { 
     
    317335    echo <<< END 
    318336          <td width="$width%"> 
    319             <input type="checkbox" value="1" name="$codec" id="$codec" class="audio-codecs" tabindex="$tabindex" $codec_checked /> 
     337            <input type="checkbox" value="$seq" name="$codec" id="$codec" class="audio-codecs" tabindex="$tabindex" $codec_checked /> 
    320338            <label for="$codec"> <small>$codec_trans</small> </label> 
    321339          </td> 
    322340END; 
     341    $seq++; 
    323342  } 
    324343?> 
     
    376395  <tr> 
    377396    <td> 
    378       <a href="#" class="info"><?php echo _("Video Support")?><span><?php echo _("Check to enable and then choose allowed codecs.")?></span></a> 
     397      <a href="#" class="info"><?php echo _("Video Support")?><span><?php echo _("Check to enable and then choose allowed codecs.")._(" If you clear each codec and then add them one at a time, submitting with each addition, they will be added in order which will effect the codec priority.")?></span></a> 
    379398    </td> 
    380399    <td> 
     
    401420<?php 
    402421  $cols = $cols_per_row; 
     422  $seq = 1; 
    403423  foreach ($video_codecs as $codec => $codec_state) { 
    404424    if ($cols == 0) { 
     
    412432    echo <<< END 
    413433          <td width="$width%"> 
    414             <input type="checkbox" value="1" name="$codec" id="$codec" class="video-codecs" tabindex="$tabindex" $codec_checked /> 
     434            <input type="checkbox" value="$seq" name="$codec" id="$codec" class="video-codecs" tabindex="$tabindex" $codec_checked /> 
    415435            <label for="$codec"><small> $codec_trans </small></label> 
    416436          </td> 
    417437END; 
     438  $seq++; 
    418439  } 
    419440?>