| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|