root/modules/branches/2.10/iaxsettings/install.php

Revision 11109, 2.2 kB (checked in by p_lindheimer, 2 years ago)

remove functions now always included by utility.functions.php

Line 
1 <?php
2 /* $Id:$ */
3
4 // Original Release by Philippe Lindheimer
5 // Copyright Philippe Lindheimer (2009)
6 // Copyright Bandwidth.com (2009)
7 /*
8     This program is free software: you can redistribute it and/or modify
9     it under the terms of the GNU Affero General Public License as
10     published by the Free Software Foundation, either version 3 of the
11     License, or (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU Affero General Public License for more details.
17
18     You should have received a copy of the GNU Affero General Public License
19     along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 global $db;
23 global $amp_conf;
24
25 $sql = <<< END
26 CREATE TABLE IF NOT EXISTS `iaxsettings` (
27   `keyword` VARCHAR (50) NOT NULL default '',
28   `data`    VARCHAR (255) NOT NULL default '',
29   `seq`     TINYINT (1),
30   `type`    TINYINT (1) NOT NULL default '0',
31   PRIMARY KEY (`keyword`,`seq`,`type`)
32 )
33 END;
34
35 outn(_("checking for iaxsettings table.."));
36 $tsql = "SELECT * FROM `iaxsettings` limit 1";
37 $check = $db->getRow($tsql, DB_FETCHMODE_ASSOC);
38 if(DB::IsError($check)) {
39     out(_("none, creating table"));
40     // table does not exist, create it
41     sql($sql);
42
43     outn(_("populating default codecs.."));
44   $sip_settings =  array(
45     array('ulaw'    ,'1', '0'),
46     array('alaw'    ,'2', '1'),
47     array('slin'    ,'' , '2'),
48     array('g726'    ,'' , '3'),
49     array('gsm'     ,'3', '4'),
50     array('g729'    ,'' , '5'),
51     array('ilbc'    ,'' , '6'),
52     array('g723'    ,'' , '7'),
53     array('g726aal2','' , '8'),
54     array('adpcm'   ,'' , '9'),
55     array('lpc10'   ,'' ,'10'),
56     array('speex'   ,'' ,'11'),
57     array('g722'    ,'' ,'12'),
58     );
59
60     // Now insert minimal codec rows
61     $compiled = $db->prepare("INSERT INTO iaxsettings (keyword, data, seq, type) values (?,?,?,'1')");
62     $result = $db->executeMultiple($compiled,$sip_settings);
63     if(DB::IsError($result)) {
64         out(_("fatal error occurred populating defaults, check module"));
65     } else {
66         out(_("ulaw, alaw, gsm added"));
67     }
68 } else {
69     out(_("already exists"));
70 }
71
Note: See TracBrowser for help on using the browser.