CREATE TEMPORARY TABLE sip_backup(id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0);
INSERT INTO sip_backup SELECT * from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '');
INSERT INTO sip (id,name,server_address,user,secret,type,def) SELECT * FROM sip_backup;
DROP TABLE sip_backup;

CREATE TEMPORARY TABLE general_backup(id INTEGER PRIMARY KEY , logserver VARCHAR(60) NOT NULL DEFAULT  '', logging_active INTEGER NOT NULL DEFAULT  1, msp_device_ip VARCHAR(60), loglevel INTEGER DEFAULT 0);
INSERT INTO general_backup SELECT id,logserver,logging_active,msp_device_ip,loglevel FROM general;
CREATE TEMPORARY TABLE udpports_backup(udpports VARCHAR(255));
INSERT INTO udpports_backup SELECT udpports FROM general;
DROP TABLE general;
CREATE TABLE general ( id INTEGER PRIMARY KEY , logserver VARCHAR(60) NOT NULL DEFAULT  '', logging_active INTEGER NOT NULL DEFAULT  1, msp_device_ip VARCHAR(60), loglevel INTEGER DEFAULT 0);
INSERT INTO general SELECT * FROM general_backup;
CREATE TABLE sip_general ( id INTEGER PRIMARY KEY , udpports VARCHAR(255), bindport VARCHAR(50) DEFAULT '');
INSERT INTO sip_general (udpports) SELECT * FROM udpports_backup;
UPDATE sip_general set bindport='5060';
DROP TABLE general_backup;
DROP TABLE udpports_backup;
CREATE TABLE version (id INTEGER PRIMARY KEY, vnum INTEGER);
INSERT INTO version (vnum) VALUES(0);

VERSION 0

CREATE TABLE set_app (show_app INTEGER DEFAULT 0);
INSERT INTO set_app (show_app) VALUES(0);

VERSION 1

CREATE TEMPORARY TABLE isdn_backup(type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY,
gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te',
ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1',
clock VARCHAR(1) NOT NULL DEFAULT '0');
insert into isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te',  ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]');
insert into isdn (type,lif,port,gr,ptp,ntteHW,ntteSW,config,lt,clock) SELECT * FROM isdn_backup;
DROP TABLE isdn_backup;

VERSION 2

CREATE TEMPORARY TABLE sip_backup ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60),
user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0,
config VARCHAR(255) DEFAULT '');
INSERT INTO sip_backup SELECT * from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT "", externip VARCHAR(25) NOT NULL DEFAULT "");
INSERT INTO sip (id,name,server_address,user,secret,type,def,config) SELECT * FROM sip_backup;
DROP TABLE sip_backup;

VERSION 3

CREATE TEMPORARY TABLE sip_general_backup ( id INTEGER PRIMARY KEY , udpports VARCHAR(255), bindport VARCHAR(50));
INSERT INTO sip_general_backup SELECT * from sip_general;
DROP TABLE sip_general;
CREATE TABLE sip_general ( id INTEGER PRIMARY KEY , udpports VARCHAR(255), bindport VARCHAR(50), externip VARCHAR(50));
INSERT INTO sip_general (id,udpports,bindport) SELECT * FROM sip_general_backup;
DROP TABLE sip_general_backup;

VERSION 4

CREATE TEMPORARY TABLE isdn_backup(type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]');
insert into isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn (type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]');
insert into isdn SELECT * from isdn_backup;
DROP TABLE isdn_backup;

CREATE TEMPORARY TABLE sip_backup ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '');
INSERT INTO sip_backup SELECT * from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '');
INSERT INTO sip SELECT * from sip_backup;
DROP TABLE sip_backup;

VERSION 5

CREATE TEMPORARY TABLE isdn_backup(type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]');
insert into isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn (type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15');
insert into isdn(type, lif, port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones) select * from isdn_backup;
DROP TABLE isdn_backup;

VERSION 6

CREATE TEMPORARY TABLE isdn_backup(type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15');
insert into isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn (type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1');
insert into isdn(type, lif , port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones, odt, odt_empty_dad) select * from isdn_backup;
DROP TABLE isdn_backup;

VERSION 7

CREATE TABLE key_val ( key VARCHAR(50), value VARCHAR(50));

VERSION 8

CREATE TEMPORARY TABLE dialplan_backup (id INTEGER PRIMARY KEY, direction VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255));
insert into dialplan_backup SELECT * from dialplan;
DROP TABLE dialplan;
CREATE TABLE dialplan (id INTEGER PRIMARY KEY, direction VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255), isdnid VARCHAR(100) NOT NULL DEFAULT '');
insert into dialplan (id, direction, fromId, toId, dest, newDest, src, newSrc, config) select * from dialplan_backup;
DROP TABLE dialplan_backup;

VERSION 9

CREATE TEMPORARY TABLE isdn_backup (type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1');
insert into isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn (type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT 'no');
insert into isdn(type, lif , port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones, odt, odt_empty_dad, master) select * from isdn_backup;
DROP TABLE isdn_backup;

VERSION 10

CREATE TEMPORARY TABLE general_backup ( id INTEGER PRIMARY KEY , logserver VARCHAR(60) NOT NULL DEFAULT  '', logging_active INTEGER NOT NULL DEFAULT  1, msp_device_ip VARCHAR(60), loglevel INTEGER DEFAULT 0);
insert into general_backup SELECT * from general;
DROP TABLE general;
CREATE TABLE general ( id INTEGER PRIMARY KEY , logserver VARCHAR(60) NOT NULL DEFAULT  '', logging_active INTEGER NOT NULL DEFAULT  1, msp_device_ip VARCHAR(60), loglevel INTEGER DEFAULT 0, telnet_acl VARCHAR (50) DEFAULT '127.0.0.1/32') ;
insert into general (id,logserver,logging_active,msp_device_ip,loglevel) select * from general_backup;
DROP TABLE general_backup;


VERSION 11

CREATE TEMPORARY TABLE isdn_backup (type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT 'no');
insert into isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0');
insert into isdn(type, lif , port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones, odt, odt_empty_dad, master, overlap_dialing) select * from isdn_backup;
DROP TABLE isdn_backup;

VERSION 12

VERSION 13

VERSION 14

CREATE TEMPORARY TABLE dialplan_backup(id INTEGER PRIMARY KEY, direction VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255), isdnid VARCHAR(100) NOT NULL DEFAULT '');
insert into dialplan_backup SELECT * from dialplan;
DROP TABLE dialplan;
CREATE TABLE dialplan (id INTEGER PRIMARY KEY, direction VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255), isdnid VARCHAR(100) NOT NULL DEFAULT '', posId INTEGER NOT NULL DEFAULT 0);
insert into dialplan (id, direction, fromId, toId, dest, newDest, src, newSrc, config, isdnid) select * from dialplan_backup;
DROP TABLE dialplan_backup;

VERSION 15


CREATE TEMPORARY TABLE isdn_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0');
insert into isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT 'no', qsig VARCHAR (3) NOT NULL DEFAULT '0', port_type VARCHAR(4) NOT NULL DEFAULT '');
insert into isdn(type, lif , port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones, odt, odt_empty_dad, master, overlap_dialing, qsig) select * from isdn_backup;
DROP TABLE isdn_backup;
UPDATE isdn SET port_type='PRI' where type='bf1E1' or type='bf2E1';
UPDATE isdn SET port_type='BRI' where type='bf4S0';

VERSION 16

CREATE TEMPORARY TABLE dialplan_backup (id INTEGER PRIMARY KEY, direction VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255), isdnid VARCHAR(100) NOT NULL DEFAULT '', posId INTEGER NOT NULL DEFAULT 0);
insert into dialplan_backup SELECT * from dialplan;
DROP TABLE dialplan;
CREATE TABLE dialplan (id INTEGER PRIMARY KEY, direction VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255), isdnid VARCHAR(100) NOT NULL DEFAULT '', posId INTEGER NOT NULL DEFAULT 0, comment VARCHAR(110) NOT NULL DEFAULT '');
insert into dialplan (id, direction, fromId, toId, dest, newDest, src, newSrc, config, isdnid, posId) select * from dialplan_backup;
DROP TABLE dialplan_backup;

VERSION 17

CREATE TABLE firewall (id INTEGER PRIMARY KEY, ip_address VARCHAR(50));

VERSION 18

CREATE TEMPORARY TABLE sip_backup ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '');
INSERT INTO sip_backup SELECT * from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60);
INSERT INTO sip (id, name, server_address, user, secret, type, def, config, stunserver, externip) SELECT * from sip_backup;
DROP TABLE sip_backup;

VERSION 19

CREATE TEMPORARY TABLE sip_backup ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60);
INSERT INTO sip_backup SELECT * from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60, failover VARCHAR(25) NOT NULL DEFAULT '');
INSERT INTO sip (id, name, server_address, user, secret, type, def, config, stunserver, externip, regrefresh) SELECT * from sip_backup;
DROP TABLE sip_backup;

VERSION 20

CREATE TEMPORARY TABLE analog_backup (type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '');
INSERT INTO analog_backup SELECT * from analog;
DROP TABLE analog;
CREATE TABLE analog ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', overlap_dial_timeout_empty_dad INTEGER NOT NULL DEFAULT '15', overlap_dial_timeout INTEGER NOT NULL DEFAULT '3', tones VARCHAR(20) NOT NULL DEFAULT '[de]', fxo_connect VARCHAR(20) NOT NULL DEFAULT 'instant', fxo_wait_for_oad VARCHAR(20) NOT NULL DEFAULT 'wait', fxo_dialtone_passthrough INTEGER NOT NULL DEFAULT '0', fxo_call_ending_signal VARCHAR(20) NOT NULL DEFAULT 'unobtainable');
INSERT INTO analog (type, port, gr, config, master, port_type) SELECT * from analog_backup;
DROP TABLE analog_backup;

VERSION 21

DELETE FROM key_val WHERE key='causes_active';
DELETE FROM key_val WHERE key='causes_default';
CREATE TABLE isgw_causes ( id INTEGER PRIMARY KEY, direction VARCHAR(50) NOT NULL, to_cause VARCHAR(50) NOT NULL, from_cause VARCHAR(50) NOT NULL, sip_response_message VARCHAR(255) NOT NULL);
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISGW','901','503','No channel processing resources');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISGW','902','503','No free ISDN channels');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISGW','903','503','No resources');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISGW','904','404','Number not in dialplan');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISGW','905','603','Invalid number');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISDN','1','404','Unallocated number');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISDN','17','486','User busy');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISDN','21','603','Call rejected');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('SIP-ISDN','ANY','486','Busy here');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-ISGW','901','17','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-ISGW','902','17','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-ISGW','903','17','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-ISGW','904','17','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-ISGW','905','17','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-SIP','404','1','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-SIP','486','17','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-SIP','603','17','');
INSERT into isgw_causes (direction, to_cause, from_cause, sip_response_message) VALUES('ISDN-SIP','ANY','17','');

VERSION 22

CREATE TEMPORARY TABLE sip_backup ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60, failover VARCHAR(25) NOT NULL DEFAULT '');
INSERT INTO sip_backup SELECT * from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '', def INTEGER DEFAULT 0, config VARCHAR(255) DEFAULT '', stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60, failover VARCHAR(25) NOT NULL DEFAULT '', register_option VARCHAR(25) NOT NULL DEFAULT 'validate');
INSERT INTO sip (id, name, server_address, user, secret, type, def, config, stunserver, externip, regrefresh, failover) SELECT * from sip_backup;
DROP TABLE sip_backup;

VERSION 23

create temporary table dialplan_backup ( id INTEGER PRIMARY KEY, fromDirection VARCHAR(15), toDirection VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255), isdnid VARCHAR(100) NOT NULL DEFAULT '', posId INTEGER NOT NULL DEFAULT 0, comment VARCHAR(110) NOT NULL DEFAULT '');
INSERT INTO dialplan_backup SELECT * from dialplan;
DROP TABLE dialplan;
create table dialplan ( id INTEGER PRIMARY KEY, fromDirection VARCHAR(15), toDirection VARCHAR(15), fromId VARCHAR(60), toId VARCHAR(60), dest VARCHAR(60), newDest VARCHAR(100), src VARCHAR(60), newSrc VARCHAR(100), config VARCHAR(255), isdnid VARCHAR(100) NOT NULL DEFAULT '', posId INTEGER NOT NULL DEFAULT 0, comment VARCHAR(110) NOT NULL DEFAULT '', activ INTEGER NOT NULL DEFAULT 1);
insert into dialplan (id, fromDirection, toDirection, fromId, toId, dest, newDest, src, newSrc, config, isdnid, posId, comment) select * from dialplan_backup;
DROP TABLE dialplan_backup;

VERSION 24

CREATE TABLE callprogress (id INTEGER PRIMARY KEY, name VARCHAR(50) NOT NULL, direction VARCHAR(30) NOT NULL);
CREATE TABLE callprogress_entries (id INTEGER PRIMARY KEY, type VARCHAR(50) NOT NULL, sip_resp VARCHAR(30) NOT NULL, resp_text VARCHAR(150) NOT NULL, isdn_event VARCHAR (250) NOT NULL, chann_det VARCHAR (50) NOT NULL, id_name INTEGER);

VERSION 25

UPDATE sip SET type='0' WHERE type='proxy';
UPDATE sip SET type='1' WHERE type='registrar' or type='both';

VERSION 26

INSERT into key_val VALUES('http_acl','0.0.0.0/0');
INSERT into key_val VALUES('sip_acl','0.0.0.0/0');
INSERT into key_val VALUES('rtp_acl','0.0.0.0/0');
INSERT into key_val VALUES('bfdetect_acl','0.0.0.0/0');
DROP TABLE firewall;

VERSION 27

CREATE TEMPORARY TABLE sip_backup ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '0', def INTEGER DEFAULT 0, config VARCHAR(255), stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60, register_option VARCHAR(25) NOT NULL DEFAULT 'validate');
INSERT INTO sip_backup SELECT id, name, server_address, user, secret, type, def, config, stunserver, externip, regrefresh, register_option from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '0', def INTEGER DEFAULT 0, config VARCHAR(255), stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60, register_option VARCHAR(25) NOT NULL DEFAULT 'validate');
INSERT INTO sip SELECT * from sip_backup;
DROP TABLE sip_backup;

VERSION 28

CREATE TEMPORARY TABLE analog_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', overlap_dial_timeout_empty_dad INTEGER NOT NULL DEFAULT '15', overlap_dial_timeout INTEGER NOT NULL DEFAULT '3', tones VARCHAR(20) NOT NULL DEFAULT '[de]', fxo_connect VARCHAR(20) NOT NULL DEFAULT 'instant', fxo_wait_for_oad VARCHAR(20) NOT NULL DEFAULT 'wait', fxo_dialtone_passthrough INTEGER NOT NULL DEFAULT '0', fxo_call_ending_signal VARCHAR(20) NOT NULL DEFAULT 'unobtainable');
INSERT INTO analog_backup SELECT * from analog;
DROP TABLE analog;
CREATE TABLE analog ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', overlap_dial_timeout_empty_dad INTEGER NOT NULL DEFAULT '15', overlap_dial_timeout INTEGER NOT NULL DEFAULT '3', tones VARCHAR(20) NOT NULL DEFAULT '[de]', fxo_connect VARCHAR(20) NOT NULL DEFAULT 'instant', fxo_wait_for_oad VARCHAR(20) NOT NULL DEFAULT 'wait', fxo_dialtone_passthrough INTEGER NOT NULL DEFAULT '0', fxo_call_ending_signal VARCHAR(20) NOT NULL DEFAULT 'unobtainable', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0');
INSERT INTO analog ( type, lif, port, gr , config , master, port_type, overlap_dial_timeout_empty_dad, overlap_dial_timeout, tones, fxo_connect, fxo_wait_for_oad, fxo_dialtone_passthrough, fxo_call_ending_signal) SELECT * from analog_backup;
DROP TABLE analog_backup;

VERSION 29

CREATE TEMPORARY TABLE isdn_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0', port_type VARCHAR(4) NOT NULL DEFAULT '');
INSERT INTO isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0', port_type VARCHAR(4) NOT NULL DEFAULT '', portpullup INTEGER DEFAULT 1);
INSERT INTO isdn ( type, lif, port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones, odt, odt_empty_dad, master, overlap_dialing, qsig, port_type) SELECT * from isdn_backup;
DROP TABLE isdn_backup;

VERSION 30

CREATE TEMPORARY TABLE analog_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', overlap_dial_timeout_empty_dad INTEGER NOT NULL DEFAULT '15', overlap_dial_timeout INTEGER NOT NULL DEFAULT '3', tones VARCHAR(20) NOT NULL DEFAULT '[de]', fxo_connect VARCHAR(20) NOT NULL DEFAULT 'instant', fxo_wait_for_oad VARCHAR(20) NOT NULL DEFAULT 'wait', fxo_dialtone_passthrough INTEGER NOT NULL DEFAULT '0', fxo_call_ending_signal VARCHAR(20) NOT NULL DEFAULT 'unobtainable', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0');
INSERT INTO analog_backup SELECT * from analog;
DROP TABLE analog;
CREATE TABLE analog ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', overlap_dial_timeout_empty_dad INTEGER NOT NULL DEFAULT '15', overlap_dial_timeout INTEGER NOT NULL DEFAULT '3', tones VARCHAR(20) NOT NULL DEFAULT '[de]', fxo_connect VARCHAR(20) NOT NULL DEFAULT 'instant', fxo_wait_for_oad VARCHAR(20) NOT NULL DEFAULT 'wait', fxo_dialtone_passthrough INTEGER NOT NULL DEFAULT '0', fxo_call_ending_signal VARCHAR(20) NOT NULL DEFAULT 'unobtainable', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', fxo_extension VARCHAR(128) NOT NULL DEFAULT '');
INSERT INTO analog ( type, lif, port, gr , config , master, port_type, overlap_dial_timeout_empty_dad, overlap_dial_timeout, tones, fxo_connect, fxo_wait_for_oad, fxo_dialtone_passthrough, fxo_call_ending_signal, overlap_dialing) SELECT * from analog_backup;
DROP TABLE analog_backup;

VERSION 31

CREATE TEMPORARY TABLE isdn_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0', port_type VARCHAR(4) NOT NULL DEFAULT '', portpullup INTEGER DEFAULT 1);
INSERT INTO isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE  TABLE isdn ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0', port_type VARCHAR(4) NOT NULL DEFAULT '', portpullup INTEGER DEFAULT 1, crc INTEGER DEFAULT 1);
INSERT INTO isdn ( type, lif, port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones, odt, odt_empty_dad, master, overlap_dialing, qsig, port_type, portpullup) SELECT * from isdn_backup;
DROP TABLE isdn_backup;

VERSION 32

CREATE TEMPORARY TABLE analog_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', overlap_dial_timeout_empty_dad INTEGER NOT NULL DEFAULT '15', overlap_dial_timeout INTEGER NOT NULL DEFAULT '3', tones VARCHAR(20) NOT NULL DEFAULT '[de]', fxo_connect VARCHAR(20) NOT NULL DEFAULT 'instant', fxo_wait_for_oad VARCHAR(20) NOT NULL DEFAULT 'wait', fxo_dialtone_passthrough INTEGER NOT NULL DEFAULT '0', fxo_call_ending_signal VARCHAR(20) NOT NULL DEFAULT 'unobtainable', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0');
INSERT INTO analog_backup SELECT type, lif, port, gr, config, master, port_type, overlap_dial_timeout_empty_dad, overlap_dial_timeout, tones, fxo_connect, fxo_wait_for_oad, fxo_dialtone_passthrough, fxo_call_ending_signal, overlap_dialing from analog;
DROP TABLE analog;
CREATE TABLE analog ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', overlap_dial_timeout_empty_dad INTEGER NOT NULL DEFAULT '15', overlap_dial_timeout INTEGER NOT NULL DEFAULT '3', tones VARCHAR(20) NOT NULL DEFAULT '[de]', fxo_connect VARCHAR(20) NOT NULL DEFAULT 'instant', fxo_wait_for_oad VARCHAR(20) NOT NULL DEFAULT 'wait', fxo_dialtone_passthrough INTEGER NOT NULL DEFAULT '0', fxo_call_ending_signal VARCHAR(20) NOT NULL DEFAULT 'unobtainable', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', clip VARCHAR(128) NOT NULL DEFAULT '', cnip VARCHAR(128) NOT NULL DEFAULT '');
INSERT INTO analog ( type, lif, port, gr , config , master, port_type, overlap_dial_timeout_empty_dad, overlap_dial_timeout, tones, fxo_connect, fxo_wait_for_oad, fxo_dialtone_passthrough, fxo_call_ending_signal, overlap_dialing) SELECT * from analog_backup;
DROP TABLE analog_backup;

VERSION 33

CREATE TEMPORARY TABLE isdn_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0', port_type VARCHAR(4) NOT NULL DEFAULT '', portpullup INTEGER DEFAULT 1, crc INTEGER DEFAULT 1);
INSERT INTO isdn_backup SELECT * from isdn;
DROP TABLE isdn;
CREATE TABLE isdn ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', ptp VARCHAR(1) NOT NULL DEFAULT '1', ntteHW VARCHAR(2) NOT NULL DEFAULT 'te', ntteSW VARCHAR(2) NOT NULL DEFAULT 'te', config VARCHAR(255), lt VARCHAR(1) NOT NULL DEFAULT '1', clock VARCHAR(1) NOT NULL DEFAULT '0', chansel VARCHAR(20) NOT NULL DEFAULT 'standard', tones VARCHAR(20) NOT NULL DEFAULT '[de]', odt INTEGER NOT NULL DEFAULT '3', odt_empty_dad INTEGER NOT NULL DEFAULT '15', master INTEGER NOT NULL DEFAULT '1', overlap_dialing VARCHAR(3) NOT NULL DEFAULT '0', qsig VARCHAR (3) NOT NULL DEFAULT '0', port_type VARCHAR(4) NOT NULL DEFAULT '', portpullup INTEGER DEFAULT 1, crc INTEGER DEFAULT 1, chansel_dir VARCHAR NOT NULL DEFAULT 'ascending');
INSERT INTO isdn ( type, lif, port, gr, ptp, ntteHW, ntteSW, config, lt, clock, chansel, tones, odt, odt_empty_dad, master, overlap_dialing, qsig, port_type, portpullup, crc) SELECT * from isdn_backup;
DROP TABLE isdn_backup;

VERSION 34

INSERT into key_val VALUES('ssh_acl','127.0.0.1/32');

VERSION 35

CREATE TABLE gsm ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', pin INTEGER DEFAULT NULL, smsc VARCHAR(70) NOT NULL DEFAULT '');
INSERT into key_val VALUES('preresolve_addresses','1');

VERSION 36

CREATE TEMPORARY TABLE sip_backup ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '0', def INTEGER DEFAULT 0, config VARCHAR(255), stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60, register_option VARCHAR(25) NOT NULL DEFAULT 'validate');
INSERT INTO sip_backup SELECT * from sip;
DROP TABLE sip;
CREATE TABLE sip ( id INTEGER PRIMARY KEY , name VARCHAR(60), server_address VARCHAR(60), user VARCHAR(60), secret VARCHAR(60), type VARCHAR(60) NOT NULL DEFAULT  '0', def INTEGER DEFAULT 0, config VARCHAR(255), stunserver VARCHAR(25) NOT NULL DEFAULT '', externip VARCHAR(25) NOT NULL DEFAULT '', regrefresh INTEGER NOT NULL DEFAULT 60, register_option VARCHAR(25) NOT NULL DEFAULT 'validate', hard_reregister INTEGER NOT NULL DEFAULT 0);
INSERT INTO sip (id, name, server_address, user, secret, type, def, config, stunserver, externip, regrefresh, register_option) SELECT * from sip_backup;
DROP TABLE sip_backup;

VERSION 37

CREATE TEMPORARY TABLE gsm_backup ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', pin INTEGER DEFAULT NULL, smsc VARCHAR(70) NOT NULL DEFAULT '');
INSERT INTO gsm_backup SELECT * from gsm;
DROP TABLE gsm;
CREATE TABLE gsm ( type VARCHAR(30), lif VARCHAR(1), port INTEGER PRIMARY KEY, gr VARCHAR(60) DEFAULT 'NULL', config VARCHAR(255), master INTEGER NOT NULL DEFAULT '1', port_type VARCHAR(4) NOT NULL DEFAULT '', pin INTEGER DEFAULT NULL, smsc VARCHAR(70) NOT NULL DEFAULT '', sms_extension VARCHAR(70) NOT NULL DEFAULT '', extension VARCHAR(70) NOT NULL DEFAULT '');
INSERT INTO gsm (type, lif, port, gr, config, master, port_type, pin, smsc) select * from gsm_backup;
DROP TABLE gsm_backup;

VERSION 38

CREATE TEMPORARY TABLE callprogress_entries_backup (id INTEGER PRIMARY KEY, type VARCHAR(50) NOT NULL, sip_resp VARCHAR(30) NOT NULL, resp_text VARCHAR(150) NOT NULL, isdn_event VARCHAR (250) NOT NULL, chann_det VARCHAR (50) NOT NULL, id_name INTEGER);
INSERT INTO callprogress_entries_backup SELECT * from callprogress_entries;
DROP TABLE callprogress_entries;
CREATE TABLE callprogress_entries (id INTEGER PRIMARY KEY, type VARCHAR(50) NOT NULL, resp VARCHAR(30) NOT NULL, resp_text VARCHAR(150) NOT NULL, event VARCHAR (250) NOT NULL, chann_det VARCHAR (50) NOT NULL, id_name INTEGER);
INSERT INTO callprogress_entries (id, type, resp, resp_text, event, chann_det, id_name) select * from callprogress_entries_backup;
DROP TABLE callprogress_entries_backup;

VERSION 39

CREATE TEMPORARY TABLE callprogress_entries_backup (id INTEGER PRIMARY KEY, type VARCHAR(50) NOT NULL, resp VARCHAR(30) NOT NULL, resp_text VARCHAR(150) NOT NULL, event VARCHAR (250) NOT NULL, chann_det VARCHAR (50) NOT NULL, id_name INTEGER);
INSERT INTO callprogress_entries_backup SELECT * from callprogress_entries;
DROP TABLE callprogress_entries;
CREATE TABLE callprogress_entries (id INTEGER PRIMARY KEY, type VARCHAR(50) NOT NULL, sip_resp VARCHAR(30) NOT NULL, resp_text VARCHAR(150) NOT NULL, isdn_event VARCHAR (250) NOT NULL, chann_det VARCHAR (50) NOT NULL, id_name INTEGER);
INSERT INTO callprogress_entries (id, type, sip_resp, resp_text, isdn_event, chann_det, id_name) select * from callprogress_entries_backup;
DROP TABLE callprogress_entries_backup;

VERSION 40
