Changeset 8212

Show
Ignore:
Timestamp:
08/27/09 11:39:40 (2 years ago)
Author:
p_lindheimer
Message:

fixes #3831 and fixes #3832 set default codecs for sipsettings and iaxsettings table upon install

Files:

Legend:

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

    r7883 r8212  
    2323global $amp_conf; 
    2424 
     25if (! function_exists("out")) { 
     26  function out($text) { 
     27    echo $text."<br />"; 
     28  } 
     29} 
     30 
     31if (! function_exists("outn")) { 
     32  function outn($text) { 
     33    echo $text; 
     34  } 
     35} 
     36 
    2537$sql = <<< END 
    2638CREATE TABLE IF NOT EXISTS `iaxsettings` ( 
     
    3244) 
    3345END; 
    34 sql($sql); 
    3546 
    36 ?> 
     47outn(_("checking for iaxsettings table..")); 
     48$tsql = "SELECT * FROM `iaxsettings` limit 1"; 
     49$check = $db->getRow($tsql, DB_FETCHMODE_ASSOC); 
     50if(DB::IsError($check)) { 
     51  out(_("none, creating table")); 
     52  // table does not exist, create it 
     53  sql($sql); 
     54 
     55  outn(_("populating default codecs..")); 
     56  $sip_settings =  array( 
     57    array('ulaw'    ,'1', '0'), 
     58    array('alaw'    ,'1', '1'), 
     59    array('slin'    ,'' , '2'), 
     60    array('g726'    ,'' , '3'), 
     61    array('gsm'     ,'1', '4'), 
     62    array('g729'    ,'' , '5'), 
     63    array('ilbc'    ,'' , '6'), 
     64    array('g723'    ,'' , '7'), 
     65    array('g726aal2','' , '8'), 
     66    array('adpcm'   ,'' , '9'), 
     67    array('lpc10'   ,'' ,'10'), 
     68    array('speex'   ,'' ,'11'), 
     69    array('g722'    ,'' ,'12'), 
     70    ); 
     71 
     72  // Now insert minimal codec rows 
     73  $compiled = $db->prepare("INSERT INTO iaxsettings (keyword, data, seq, type) values (?,?,?,'1')"); 
     74  $result = $db->executeMultiple($compiled,$sip_settings); 
     75  if(DB::IsError($result)) { 
     76    out(_("fatal error occured populating defaults, check module")); 
     77  } else { 
     78    out(_("ulaw, alaw, gsm added")); 
     79  } 
     80} else { 
     81  out(_("already exists")); 
     82
  • modules/branches/2.6/iaxsettings/module.xml

    r8081 r8212  
    22  <rawname>iaxsettings</rawname> 
    33  <name>Asterisk IAX Settings</name> 
    4   <version>2.6.0.2</version> 
     4  <version>2.6.0.3</version> 
    55  <publisher>Bandwidth.com</publisher> 
    66  <license>AGPLv3</license> 
     
    1414  </description> 
    1515  <changelog> 
     16    *2.6.0.3* #3832 
    1617    *2.6.0.2* #3811, #3813 
    1718    *2.6.0.1* corrected publisher/lic 
  • modules/branches/2.6/sipsettings/install.php

    r7883 r8212  
    2323global $amp_conf; 
    2424 
     25if (! function_exists("out")) { 
     26  function out($text) { 
     27    echo $text."<br />"; 
     28  } 
     29} 
     30 
     31if (! function_exists("outn")) { 
     32  function outn($text) { 
     33    echo $text; 
     34  } 
     35} 
     36 
    2537$sql = <<< END 
    2638CREATE TABLE IF NOT EXISTS `sipsettings` ( 
     
    3244) 
    3345END; 
    34 sql($sql); 
    3546 
    36 ?> 
     47outn(_("checking for sipsettings table..")); 
     48$tsql = "SELECT * FROM `sipsettings` limit 1"; 
     49$check = $db->getRow($tsql, DB_FETCHMODE_ASSOC); 
     50if(DB::IsError($check)) { 
     51  out(_("none, creating table")); 
     52  // table does not exist, create it 
     53  sql($sql); 
     54 
     55  outn(_("populating default codecs..")); 
     56  $sip_settings =  array( 
     57    array('ulaw'    ,'1', '0'), 
     58    array('alaw'    ,'1', '1'), 
     59    array('slin'    ,'' , '2'), 
     60    array('g726'    ,'' , '3'), 
     61    array('gsm'     ,'1', '4'), 
     62    array('g729'    ,'' , '5'), 
     63    array('ilbc'    ,'' , '6'), 
     64    array('g723'    ,'' , '7'), 
     65    array('g726aal2','' , '8'), 
     66    array('adpcm'   ,'' , '9'), 
     67    array('lpc10'   ,'' ,'10'), 
     68    array('speex'   ,'' ,'11'), 
     69    array('g722'    ,'' ,'12'), 
     70    ); 
     71 
     72  // Now insert minimal codec rows 
     73  $compiled = $db->prepare("INSERT INTO sipsettings (keyword, data, seq, type) values (?,?,?,'1')"); 
     74  $result = $db->executeMultiple($compiled,$sip_settings); 
     75  if(DB::IsError($result)) { 
     76    out(_("fatal error occured populating defaults, check module")); 
     77  } else { 
     78    out(_("ulaw, alaw, gsm added")); 
     79  } 
     80} else { 
     81  out(_("already exists")); 
     82
  • modules/branches/2.6/sipsettings/module.xml

    r8190 r8212  
    22  <rawname>sipsettings</rawname> 
    33  <name>Asterisk SIP Settings</name> 
    4   <version>2.6.0.4</version> 
     4  <version>2.6.0.5</version> 
    55  <publisher>Bandwidth.com</publisher> 
    66  <license>AGPLv3</license> 
     
    1414  </description> 
    1515  <changelog> 
     16    *2.6.0.5* #3831 
    1617    *2.6.0.4* spelling errors 
    1718    *2.6.0.3* #3814