CREATE TABLE card_b410p (
 id serial,
 name varchar(24) NOT NULL default '',
--GENERATE:/etc/zaptel.conf::
--HELP_EN_INFO:name for this card
--HELP_EN_LONG:Name for this card.
--HELP_NL_INFO:naam van deze card
--HELP_NL_LONG:Naam van deze kaart.

 astium integer NOT NULL default '1',
--HELP_EN_INFO:Astium
--HELP_EN_LONG:For which Astium this record is valid. 
--HELP_NL_INFO:Astium
--HELP_NL_LONG:Voor welke Astium deze gegevens gelden. 

 status varchar(8) NOT NULL default 'active'
   CHECK (status IN ('active', 'deleted')),
--GENERATE:/etc/zaptel.conf::
--SERVICE:zaptel:restart
--SERVICE:asterisk:restart
--HELP_EN_INFO:status
--HELP_EN_LONG:Card status
--HELP_NL_INFO:status
--HELP_NL_LONG:Status van deze kaart

  timing integer default '0'
    CHECK (timing IN ('0', '1', '2', '3')),
--GENERATE:/etc/zaptel.conf::
--SERVICE:zaptel:restart
--SERVICE:asterisk:restart
--HELP_EN_INFO:Use this port as sync source
--HELP_EN_LONG:This determines the selection of primary, secondary, and
--HELP_EN_LONG:so on sync sources.  If this span should be considered a primary sync
--HELP_EN_LONG:source, then give it a value of "1".  For a secondary, use "2".
--HELP_EN_LONG:To not use this as a sync source, just use "0"
--HELP_NL_INFO:Gebruik deze poort als bron voor synchronisatie.
--HELP_NL_LONG:Als u deze poort wilt gebruiken als primaire bron voor de
--HELP_NL_LONG:timing, kies dan "1". Kies "2" voor secundaire (alternatieve)
--HELP_NL_LONG:bron. Kies "0" om deze poort niet te gebruiken.

 nationalprefix varchar(10) not NULL default '',
--GENERATE:/etc/asterisk/zapata.conf::
--SERVICE:asterisk:reload
--HELP_EN_INFO:Prefix for national numbers
--HELP_EN_LONG:Prefix for national numbers (also used when dialplan=dynamic)
--HELP_NL_INFO:Voorkeuze voor interlokale telefoonnummers
--HELP_NL_LONG:Voorkeuze voor interlokale telefoonnummers (ook gebruikt als dialplan=dynamic)

 internationalprefix varchar(10) not NULL default '',
--GENERATE:/etc/asterisk/zapata.conf::
--SERVICE:asterisk:reload
--HELP_EN_INFO:Prefix for international numbers
--HELP_EN_LONG:Prefix for international numbers (also used when dialplan=dynamic)
--HELP_NL_INFO:Voorkeuze voor internationale telefoonnummers
--HELP_NL_LONG:Voorkeuze voor internationale telefoonnummers (ook gebruikt als dialplan=dynamic)

 switchtype varchar(10) not NULL default 'euroisdn'
   CHECK (switchtype IN ('national', 'dms100', '4ess', '5ess', 'euroisdn', 'ni1')),
--GENERATE:/etc/zaptel.conf::
--SERVICE:zaptel:restart
--SERVICE:asterisk:restart
--HELP_EN_INFO:Type of telco switch
--HELP_EN_LONG:<p>
--HELP_EN_LONG:<ul><li>national: National ISDN 2 (default)</li>
--HELP_EN_LONG:<li>dms100: Nortel DMS100</li>
--HELP_EN_LONG:<li>4ess: AT&T 4ESS</li>
--HELP_EN_LONG:<li>5ess: Lucent 5ESS</li>
--HELP_EN_LONG:<li>euroisdn: EuroISDN</li>
--HELP_EN_LONG:<li>ni1: Old National ISDN 1</li>
--HELP_NL_INFO:<li>Type switch bij de telefoonleverancier</li>
--HELP_NL_LONG:<li>national: National ISDN 2 (default)</li>
--HELP_NL_LONG:<li>dms100: Nortel DMS100</li>
--HELP_NL_LONG:<li>4ess: AT&T 4ESS</li>
--HELP_NL_LONG:<li>5ess: Lucent 5ESS</li>
--HELP_NL_LONG:<li>euroisdn: EuroISDN</li>
--HELP_NL_LONG:<li>ni1: Old National ISDN 1</li></ul></p>

 nsf varchar(10) not NULL default 'none'
   CHECK (nsf IN ('none', 'sdn', 'megacom', 'accunet')),
--GENERATE:/etc/zaptel.conf::
--SERVICE:zaptel:restart
--SERVICE:asterisk:restart
--HELP_EN_INFO:network specific facility
--HELP_EN_LONG:Some switches (AT&T especially) require network specific facility IE
--HELP_EN_LONG:supported values are currently 'none', 'sdn', 'megacom', 'accunet'
--HELP_NL_INFO:network specific facility
--HELP_NL_LONG:<P>Sommige telecom switches (vooral AT&T) vereisen network specific facilities</p>
--HELP_NL_LONG:<p>Mogelijke waarden: 
--HELP_NL_LONG:<ul><li>none</li>
--HELP_NL_LONG:<li>sdn</li>
--HELP_NL_LONG:<li>megacom</li>
--HELP_NL_LONG:<li>accunet</li></ul></p>

 pridialplan varchar(14) not NULL default 'local'
   CHECK (pridialplan IN ('unknown', 'private', 'local', 'national', 'international', 'dynamic')),
--GENERATE:/etc/asterisk/zapata.conf::
--SERVICE:asterisk:reload
--HELP_EN_INFO:PRI dial plan value for outgoing calls
--HELP_EN_LONG:PRI dial plan value for outgoing calls. Possible values:
--HELP_EN_LONG:<li>unknown: Unknown</li>
--HELP_EN_LONG:<li>private: Private ISDN</li>
--HELP_EN_LONG:<li>local: Local ISDN</li>
--HELP_EN_LONG:<li>national: National ISDN</li>
--HELP_EN_LONG:<li>international: International ISDN</li>
--HELP_EN_LONG:<li>dynamic: Set Dynamically (uses nationalprefix & internationalprefix)</li>
--HELP_NL_INFO:PRI Dial plan waarde voor uitgaande nummers
--HELP_NL_LONG:<p>PRI dial plan waarde voor uitgaande nummers. Mogelijke waarden:
--HELP_NL_LONG:<ul><li>unknown: Unknown</li>
--HELP_NL_LONG:<li>private: Private ISDN</li>
--HELP_NL_LONG:<li>local: Local ISDN</li>
--HELP_NL_LONG:<li>national: National ISDN</li>
--HELP_NL_LONG:<li>international: International ISDN</li>
--HELP_NL_LONG:<li>dynamic: Bepaal per gesprek aan de hand van nationalprefix & internationalprefix</li></ul></p>

 prilocaldialplan varchar(14) not NULL default 'local'
   CHECK (prilocaldialplan IN ('unknown', 'private', 'local', 'national', 'international', 'dynamic')),
--GENERATE:/etc/asterisk/zapata.conf::
--SERVICE:asterisk:reload
--HELP_EN_INFO:PRI dial plan value for local numbers
--HELP_EN_LONG:<p>PRI dial plan value for local numbers. Possible values:
--HELP_EN_LONG:<ul><li>unknown: Unknown</li>
--HELP_EN_LONG:<li>private: Private ISDN</li>
--HELP_EN_LONG:<li>local: Local ISDN</li>
--HELP_EN_LONG:<li>national: National ISDN</li>
--HELP_EN_LONG:<li>international: International ISDN</li>
--HELP_EN_LONG:<li>dynamic: Set Dynamically (uses nationalprefix & internationalprefix)</li></ul></p>
--HELP_NL_INFO:PRI Dial plan waarde voor eigen nummers
--HELP_NL_LONG:<p>PRI dial plan waarde voor eigen nummers. Mogelijke waardes:
--HELP_NL_LONG:<ul><li>unknown: Unknown</li>
--HELP_NL_LONG:<li>private: Private ISDN</li>
--HELP_NL_LONG:<li>local: Local ISDN</li>
--HELP_NL_LONG:<li>national: National ISDN</li>
--HELP_NL_LONG:<li>international: International ISDN</li>
--HELP_NL_LONG:<li>dynamic: Bepaal per gesprek aan de hand van national prefix & international prefix</li></ul></p>

 overlapdial varchar(3) NOT NULL default 'no'
   CHECK (overlapdial IN ('yes', 'no')),
--GENERATE:/etc/asterisk/zapata.conf::
--SERVICE:asterisk:restart
--HELP_EN_INFO:Overlap dialing mode
--HELP_EN_LONG:Overlap dialing mode (sending overlap digits)
--HELP_NL_INFO:Overlap dialing mode
--HELP_NL_LONG:Overlap dialing mode (sending overlap digits)

 priindication varchar(9) NOT NULL default 'inband'
   CHECK (priindication IN ('inband', 'outofband')),
--GENERATE:/etc/asterisk/zapata.conf::
--SERVICE:asterisk:restart
--HELP_EN_INFO:PRI Out of band indications
--HELP_EN_LONG:PRI Out of band indications
--HELP_EN_LONG:<p>Enable this to report Busy and Congestion on a PRI using out-of-band
--HELP_EN_LONG:notification. Inband indication doesn't seem to work with all telcos.</p>
--HELP_EN_LONG:<p><li>outofband: Signal Busy/Congestion out of band with RELEASE/DISCONNECT</li>
--HELP_EN_LONG:<li>inband: Signal Busy/Congestion using in-band tones</li></ul></p>
--HELP_NL_INFO:PRI Out of band indications</li>
--HELP_NL_LONG:<li>PRI Out of band indications</li>
--HELP_NL_LONG:<li>Enable this to report Busy and Congestion on a PRI using out-of-band</li>
--HELP_NL_LONG:notification. Inband indication doesn't seem to work with all telcos.</li>
--HELP_NL_LONG:<li>outofband: Signal Busy/Congestion out of band with RELEASE/DISCONNECT</li>
--HELP_NL_LONG:<li>inband: Signal Busy/Congestion using in-band tones</li></ul></p>


 PRIMARY KEY  (id)
);

GRANT UPDATE, SELECT, INSERT, DELETE ON card_b410p TO astium;
GRANT UPDATE, SELECT, INSERT, DELETE ON card_b410p_id_seq TO astium;
INSERT INTO card_b410p (name, status) VALUES ('empty', 'deleted');

ALTER TABLE card_b410p ADD CONSTRAINT card_b410p_astium_constraint FOREIGN KEY (astium) REFERENCES astium (id);

alter table zap_channel drop constraint zap_channel_cardtype_check;
alter table zap_channel add CONSTRAINT zap_channel_cardtype_check CHECK (cardtype IN ('quadbri', 'octobri', 'unogsm', 'duogsm', 'quadgsm', 'x100p', 'tdm400p', 'tdm410', 'tdm2400p', 'tdm800p', 't100p', 'te110p', 'te120p', 'e100p', 'te210p', 'te205p', 'te410p', 'te405p', 'b410p'));


