commit 30ceca8ca72f19d9a2403ab49f47f14058967af6 Author: Michael Prokop Date: Fri Mar 16 17:53:16 2012 +0000 Initial db-schema package This is broken as hell. You've been warned. From: Michael Prokop diff --git a/db_scripts/base/0010_create_bss.up b/db_scripts/base/0010_create_bss.up new file mode 100644 index 00000000..81660703 --- /dev/null +++ b/db_scripts/base/0010_create_bss.up @@ -0,0 +1,750 @@ +-- step out of our billing DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS billing; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE billing CHARACTER SET 'utf8'; + +USE billing; + +-- create reseller helper table +CREATE TABLE `resellers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `name` varchar(63) NOT NULL, + `status` enum('active','locked','terminated') NOT NULL DEFAULT 'active', + PRIMARY KEY (`id`), + UNIQUE KEY `contractid_idx` (`contract_id`), + UNIQUE KEY `name_idx` (`name`) +) ENGINE=InnoDB; + +-- create domains and reseller mapping tables +CREATE TABLE `domains` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain` varchar(127) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `domain_idx` (`domain`) +) ENGINE=InnoDB; + +CREATE TABLE `domain_resellers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `domains` (`id`), + `reseller_id` int(11) UNSIGNED NOT NULL REFERENCES `resellers` (`id`), + PRIMARY KEY (`id`), + KEY `domainid_idx` (`domain_id`), + CONSTRAINT `dr_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `dr_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create admins table that contains root user as well as reseller admins +CREATE TABLE `admins` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `login` varchar(31) NOT NULL, + `md5pass` char(32), + `is_master` boolean NOT NULL default FALSE, + `is_superuser` boolean NOT NULL default FALSE, + `is_active` boolean NOT NULL default TRUE, + `read_only` boolean NOT NULL default FALSE, + `show_passwords` boolean NOT NULL default TRUE, + `call_data` boolean NOT NULL default FALSE, + `lawful_intercept` boolean NOT NULL default FALSE, + PRIMARY KEY (`id`), + UNIQUE KEY `login_idx` (`login`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `a_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create billing tables +CREATE TABLE `billing_profiles` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `handle` varchar(63) NOT NULL, + `name` varchar(31) NOT NULL, + `prepaid` bool NOT NULL DEFAULT FALSE, + `interval_charge` double NOT NULL DEFAULT 0, + `interval_free_time` int(5) NOT NULL DEFAULT 0, + `interval_free_cash` double NOT NULL DEFAULT 0, + `interval_unit` enum('week','month') NOT NULL DEFAULT 'month', + `interval_count` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, + `fraud_interval_limit` int(11) UNSIGNED NULL DEFAULT NULL, + `fraud_interval_lock` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, + `fraud_interval_notify` varchar(255) NULL DEFAULT NULL, + `currency` varchar(31) NULL DEFAULT NULL, + `vat_rate` tinyint(3) UNSIGNED NULL DEFAULT NULL, + `vat_included` bool NOT NULL DEFAULT TRUE, + PRIMARY KEY (`id`), + UNIQUE KEY `resnam_idx` (`reseller_id`, `name`), + UNIQUE KEY `reshand_idx` (`reseller_id`, `handle`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `b_p_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `billing_zones` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `zone` varchar(127) NOT NULL, -- a zone name for internal use: admin interface, etc. + `detail` varchar(127) NULL, -- will be printed on invoices, etc. + PRIMARY KEY (`id`), + UNIQUE KEY `profnamdes_idx` (`billing_profile_id`, `zone`, `detail`), + CONSTRAINT `b_z_profileid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `billing_zones_history` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `bz_id` int(11) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NOT NULL, + `zone` varchar(127) NOT NULL, + `detail` varchar(127) NULL, + PRIMARY KEY (`id`), + KEY `bzid_idx` (`bz_id`), + CONSTRAINT `b_z_h_bzid_ref` FOREIGN KEY (`bz_id`) + REFERENCES `billing_zones` (`id`) + ON DELETE SET NULL ON UPDATE NO ACTION +) ENGINE=InnoDB; + +DELIMITER | + +CREATE TRIGGER bill_zones_crepl_trig AFTER INSERT ON billing_zones + FOR EACH ROW BEGIN + + INSERT INTO billing_zones_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, NEW.zone, NEW.detail); + + END; +| + +CREATE TRIGGER bill_zones_urepl_trig AFTER UPDATE ON billing_zones + FOR EACH ROW BEGIN + + UPDATE billing_zones_history + SET bz_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + zone = NEW.zone, detail = NEW.detail + WHERE bz_id = OLD.id; + + END; +| + +DELIMITER ; + +CREATE TABLE `billing_fees` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `billing_zone_id` int(11) UNSIGNED NULL REFERENCES `billing_zones` (`id`), + `destination` varchar(255) NOT NULL, + `type` enum('call', 'sms') NOT NULL DEFAULT 'call', + `onpeak_init_rate` double NOT NULL DEFAULT 0, + `onpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `onpeak_follow_rate` double NOT NULL DEFAULT 0, + `onpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_init_rate` double NOT NULL DEFAULT 0, + `offpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_follow_rate` double NOT NULL DEFAULT 0, + `offpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `use_free_time` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_f_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `zoneid_idx` (`billing_zone_id`), + CONSTRAINT `b_f_zoneid_ref` FOREIGN KEY (`billing_zone_id`) + REFERENCES `billing_zones` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + UNIQUE KEY `profdestype_idx` (`billing_profile_id`, `destination`, `type`) +) ENGINE=InnoDB; + +CREATE TABLE `billing_fees_history` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `bf_id` int(11) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NOT NULL, + `billing_zones_history_id` int(11) UNSIGNED NULL, + `destination` varchar(255) NOT NULL, + `type` enum('call', 'sms') NOT NULL DEFAULT 'call', + `onpeak_init_rate` double NOT NULL DEFAULT 0, + `onpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `onpeak_follow_rate` double NOT NULL DEFAULT 0, + `onpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_init_rate` double NOT NULL DEFAULT 0, + `offpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_follow_rate` double NOT NULL DEFAULT 0, + `offpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `use_free_time` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + KEY `bfid_idx` (`bf_id`), + CONSTRAINT `b_f_h_bfid_ref` FOREIGN KEY (`bf_id`) + REFERENCES `billing_fees` (`id`) + ON DELETE SET NULL ON UPDATE NO ACTION, + KEY `zonehid_idx` (`billing_zones_history_id`), + CONSTRAINT `b_f_h_bzhid_ref` FOREIGN KEY (`billing_zones_history_id`) + REFERENCES `billing_zones_history` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + +DELIMITER | + +CREATE TRIGGER bill_fees_crepl_trig AFTER INSERT ON billing_fees + FOR EACH ROW BEGIN + DECLARE my_bzh_id int UNSIGNED; + + SELECT id INTO my_bzh_id FROM billing_zones_history WHERE bz_id = NEW.billing_zone_id; + + INSERT INTO billing_fees_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, my_bzh_id, NEW.destination, + NEW.type, NEW.onpeak_init_rate, NEW.onpeak_init_interval, NEW.onpeak_follow_rate, + NEW.onpeak_follow_interval, NEW.offpeak_init_rate, NEW.offpeak_init_interval, + NEW.offpeak_follow_rate, NEW.offpeak_follow_interval, NEW.use_free_time); + + END; +| + +CREATE TRIGGER bill_fees_urepl_trig AFTER UPDATE ON billing_fees + FOR EACH ROW BEGIN + DECLARE my_bzh_id int UNSIGNED; + + SELECT id INTO my_bzh_id FROM billing_zones_history WHERE bz_id = NEW.billing_zone_id; + + UPDATE billing_fees_history + SET bf_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + billing_zones_history_id = my_bzh_id, destination = NEW.destination, type = NEW.type, + onpeak_init_rate = NEW.onpeak_init_rate, onpeak_init_interval = NEW.onpeak_init_interval, + onpeak_follow_rate = NEW.onpeak_follow_rate, onpeak_follow_interval = NEW.onpeak_follow_interval, + offpeak_init_rate = NEW.offpeak_init_rate, offpeak_init_interval = NEW.offpeak_init_interval, + offpeak_follow_rate = NEW.offpeak_follow_rate, offpeak_follow_interval = NEW.offpeak_follow_interval, + use_free_time = NEW.use_free_time + WHERE bf_id = OLD.id; + + END; +| + +DELIMITER ; + +CREATE TABLE `billing_peaktime_weekdays` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `weekday` tinyint(3) UNSIGNED NOT NULL, + `start` time, + `end` time, + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_p_w_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `billing_peaktime_special` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `start` datetime, + `end` datetime, + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_p_s_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create LNP tables +CREATE TABLE `lnp_providers` ( + `id` int(11) UNSIGNED NOT NULL, + `name` varchar(255), + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `lnp_numbers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `number` varchar(31) NOT NULL, + `lnp_provider_id` int(11) UNSIGNED NOT NULL REFERENCES `lnp_providers` (`id`), + `start` datetime NULL DEFAULT NULL, + `end` datetime NULL DEFAULT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `l_n_lnpproid_ref` FOREIGN KEY (`lnp_provider_id`) + REFERENCES `lnp_providers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create NCOS tables +CREATE TABLE `ncos_levels` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED REFERENCES `resellers` (`id`), + `level` varchar(31) NOT NULL, + `mode` enum('blacklist', 'whitelist') NOT NULL default 'blacklist', + `local_ac` bool NOT NULL DEFAULT FALSE, + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `reslev_idx` (`reseller_id`, `level`), + CONSTRAINT `c_l_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `ncos_pattern_list` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `ncos_level_id` int(11) UNSIGNED NOT NULL REFERENCES `ncos_levels` (`id`), + `pattern` varchar(255) NOT NULL, + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `levpat_idx` (`ncos_level_id`, `pattern`), + CONSTRAINT `c_p_l_ncoslevid_ref` FOREIGN KEY (`ncos_level_id`) + REFERENCES `ncos_levels` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `ncos_lnp_list` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `ncos_level_id` int(11) UNSIGNED NOT NULL REFERENCES `ncos_levels` (`id`), + `lnp_provider_id` int(11) UNSIGNED NOT NULL REFERENCES `lnp_providers` (`id`), + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `levpro_idx` (`ncos_level_id`, `lnp_provider_id`), + CONSTRAINT `c_l_l_ncoslevid_ref` FOREIGN KEY (`ncos_level_id`) + REFERENCES `ncos_levels` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `c_l_l_lnpproid_ref` FOREIGN KEY (`lnp_provider_id`) + REFERENCES `lnp_providers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create contact information table +CREATE TABLE `contacts` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `gender` enum('male','female'), + `firstname` varchar(127), + `lastname` varchar(127), + `comregnum` varchar(31), + `company` varchar(127), + `street` varchar(127), + `postcode` int(6), + `city` varchar(127), + `country` char(2), + `phonenumber` varchar(31), + `mobilenumber` varchar(31), + `email` varchar(255), + `newsletter` bool NOT NULL DEFAULT FALSE, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- create customer tables +CREATE TABLE `customers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `shopuser` varchar(31) NULL, + `shoppass` varchar(31) NULL, + `business` bool NOT NULL DEFAULT FALSE, + `contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `tech_contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `comm_contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `external_id` varchar(255) NULL default NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`), + UNIQUE KEY (`reseller_id`, `shopuser`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `cu_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `contactid_idx` (`contact_id`), + CONSTRAINT `cu_contactid_ref` FOREIGN KEY (`contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `commcontactid_idx` (`comm_contact_id`), + CONSTRAINT `cu_commcontactid_ref` FOREIGN KEY (`comm_contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `techcontact_idx` (`tech_contact_id`), + CONSTRAINT `cu_techcontact_ref` FOREIGN KEY (`tech_contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `externalid_idx` (`external_id`) +) ENGINE=InnoDB; + +CREATE TABLE `customer_registers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `customer_id` int(11) UNSIGNED NOT NULL REFERENCES `customers` (`id`), + `actor` varchar(15), + `type` varchar(31) NOT NULL, + `data` text, + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `c_r_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `products` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `class` enum('sippeering', 'pstnpeering', 'reseller', 'voip', 'hardware', 'auxiliary') NOT NULL, + `handle` varchar(63) NOT NULL, + `name` varchar(127) NOT NULL, + `on_sale` bool NOT NULL DEFAULT FALSE, + `price` double, + `weight` mediumint(9) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NULL REFERENCES `billing_profiles` (`id`), + PRIMARY KEY (`id`), + UNIQUE KEY `resnam_idx` (`reseller_id`, `name`), + UNIQUE KEY `reshand_idx` (`reseller_id`, `handle`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `p_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `p_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `invoices` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `year` smallint(4) UNSIGNED NOT NULL, + `month` tinyint(2) UNSIGNED NOT NULL, + `serial` int(5) UNSIGNED NOT NULL, + `data` blob, + PRIMARY KEY (`id`), + UNIQUE KEY `yms_idx` (`year`,`month`,`serial`) +) ENGINE=InnoDB; + +CREATE TABLE `orders` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED REFERENCES `resellers` (`id`), + `customer_id` int(11) UNSIGNED REFERENCES `customers` (`id`), + `delivery_contact_id` int(11) UNSIGNED REFERENCES `contacts` (`id`), + `type` varchar(31), + `state` enum('init','transact','failed','success') NOT NULL DEFAULT 'init', + `value` int(11), + `shipping_costs` int(11), + `invoice_id` int(11) UNSIGNED REFERENCES `invoices` (`id`), + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + `complete_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `o_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `o_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `contactid_idx` (`delivery_contact_id`), + CONSTRAINT `o_contactid_ref` FOREIGN KEY (`delivery_contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `invoiceid_idx` (`invoice_id`), + CONSTRAINT `o_invoiceid_ref` FOREIGN KEY (`invoice_id`) + REFERENCES `invoices` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create payment table +CREATE TABLE `payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `amount` int(11), + `type` varchar(31), + `state` enum('init','transact','failed','success'), + `mpaytid` int(11) UNSIGNED, + `status` varchar(31), + `errno` int(11), + `returncode` varchar(63), + `externalstatus` text, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `state_idx` (`state`), + KEY `mpaytid_idx` (`mpaytid`), + KEY `status_idx` (`status`) +) ENGINE=InnoDB; + +-- create mapping table between orders and payments +CREATE TABLE `order_payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `order_id` int(11) UNSIGNED NOT NULL REFERENCES `orders` (`id`), + `payment_id` int(11) UNSIGNED NOT NULL REFERENCES `payments` (`id`), + PRIMARY KEY (`id`), + KEY `orderid_idx` (`order_id`), + CONSTRAINT `op_orderid_ref` FOREIGN KEY (`order_id`) + REFERENCES `orders` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `paymentid_idx` (`payment_id`), + CONSTRAINT `op_paymentid_ref` FOREIGN KEY (`payment_id`) + REFERENCES `payments` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create contract tables +CREATE TABLE `contracts` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `customer_id` int(11) UNSIGNED NULL REFERENCES `customers` (`id`), + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `order_id` int(11) UNSIGNED NULL REFERENCES `orders` (`id`), + `status` enum('pending','active','locked','terminated') NOT NULL DEFAULT 'active', + `external_id` varchar(255) NULL default NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp NOT NULL, + `activate_timestamp` timestamp NULL, + `terminate_timestamp` timestamp NULL, + PRIMARY KEY (`id`), + KEY `contactid_idx` (`contact_id`), + CONSTRAINT `co_contactid_ref` FOREIGN KEY (`contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE, + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `c_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `co_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `orderid_idx` (`order_id`), + CONSTRAINT `co_orderid_ref` FOREIGN KEY (`order_id`) + REFERENCES `orders` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE, + KEY `externalid_idx` (`external_id`) +) ENGINE=InnoDB; + +-- create resellers->contracts foreign key +ALTER TABLE resellers + ADD CONSTRAINT `r_contractid_ref` + FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +; + +CREATE TABLE `contract_registers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `actor` varchar(15), + `type` varchar(31) NOT NULL, + `data` text, + PRIMARY KEY (`id`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `c_r_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_subscribers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `uuid` char(36) NOT NULL, + `username` varchar(127) NOT NULL, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `domains` (`id`), + `status` enum('active','locked','terminated') NOT NULL DEFAULT 'active', + `primary_number_id` int(11) unsigned default NULL, + `external_id` varchar(255) NULL default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uuid_idx` (uuid), + KEY `username_idx` (`username`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `v_s_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `domainid_idx` (`domain_id`), + CONSTRAINT `v_s_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `pnumid_idx` (`primary_number_id`), + KEY `externalid_idx` (`external_id`) +) ENGINE=InnoDB; + +-- create table that stores all known E.164 numbers +CREATE TABLE `voip_numbers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `cc` int(4) UNSIGNED NOT NULL, + `ac` varchar(7) NOT NULL, + `sn` varchar(31) NOT NULL, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `subscriber_id` int(11) UNSIGNED NULL REFERENCES `voip_subscribers` (`id`), + `status` enum('active','reserved','locked','deported') NOT NULL DEFAULT 'active', + `ported` bool NOT NULL DEFAULT FALSE, + `list_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `listts_idx` (`list_timestamp`), + UNIQUE KEY `number_idx` (`cc`,`ac`,`sn`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `v_n_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE, + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_n_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- define local number blocks +CREATE TABLE `voip_number_blocks` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `cc` int(4) UNSIGNED NOT NULL, + `ac` varchar(7) NOT NULL, + `sn_prefix` varchar(31) NOT NULL, + `sn_length` tinyint(2) UNSIGNED NOT NULL, + `allocable` bool NOT NULL DEFAULT FALSE, + `authoritative` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + UNIQUE KEY `prefix_idx` (`cc`, `ac`, `sn_prefix`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_number_block_resellers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `number_block_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_number_blocks` (`id`), + `reseller_id` int(11) UNSIGNED NOT NULL REFERENCES `resellers` (`id`), + PRIMARY KEY (`id`), + KEY `numblockid_idx` (`number_block_id`), + CONSTRAINT `vnbr_numblockid_ref` FOREIGN KEY (`number_block_id`) + REFERENCES `voip_number_blocks` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `vnbr_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create subscribers->primary-number foreign key +ALTER TABLE voip_subscribers + ADD CONSTRAINT `v_s_pnumid_ref` + FOREIGN KEY (`primary_number_id`) + REFERENCES `voip_numbers` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE +; + +-- create account status table +CREATE TABLE `contract_balances` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `cash_balance` double, + `cash_balance_interval` double NOT NULL DEFAULT 0, + `free_time_balance` int(11), + `free_time_balance_interval` int(11) NOT NULL DEFAULT 0, + `start` datetime NOT NULL, + `end` datetime NOT NULL, + `invoice_id` int(11) UNSIGNED REFERENCES `invoices` (`id`), + PRIMARY KEY (`id`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `c_b_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `invoiceid_idx` (`invoice_id`), + CONSTRAINT `cb_invoiceid_ref` FOREIGN KEY (`invoice_id`) + REFERENCES `invoices` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create table that holds credits and debits +CREATE TABLE `contract_credits` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `balance_id` int(11) UNSIGNED NOT NULL REFERENCES `contract_balances` (`id`), + `state` enum('init','transact','charged','failed','success') NOT NULL DEFAULT 'init', + `amount` double, + `reason` text, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `balanceid_idx` (`balance_id`), + CONSTRAINT `cc_balanceid_ref` FOREIGN KEY (`balance_id`) + REFERENCES `contract_balances` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create mapping table between orders and payments +CREATE TABLE `credit_payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `credit_id` int(11) UNSIGNED NOT NULL REFERENCES `contract_credits` (`id`), + `payment_id` int(11) UNSIGNED NOT NULL REFERENCES `payments` (`id`), + PRIMARY KEY (`id`), + KEY `creditid_idx` (`credit_id`), + CONSTRAINT `cp_creditid_ref` FOREIGN KEY (`credit_id`) + REFERENCES `contract_credits` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `paymentid_idx` (`payment_id`), + CONSTRAINT `cp_paymentid_ref` FOREIGN KEY (`payment_id`) + REFERENCES `payments` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create mapping table between contracts and billing_profiles, billing_groups and products +CREATE TABLE `billing_mappings` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `start_date` datetime, + `end_date` datetime, + `billing_profile_id` int(11) UNSIGNED REFERENCES `billing_profiles` (`id`), + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `product_id` int(11) UNSIGNED REFERENCES `products` (`id`), + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_m_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `b_m_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `productid_idx` (`product_id`), + CONSTRAINT `b_m_productid_ref` FOREIGN KEY (`product_id`) + REFERENCES `products` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- lawful intercept table +CREATE TABLE `voip_intercept` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `LIID` int(11) UNSIGNED, + `number` varchar(63), + `cc_required` bool NOT NULL DEFAULT FALSE, + `delivery_host` varchar(15), + `delivery_port` smallint(5) UNSIGNED, + `delivery_user` text NULL, + `delivery_pass` text NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp NOT NULL, + `deleted` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `vi_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `number_idx` (`number`), + KEY `deleted_idx` (`deleted`) +) ENGINE=InnoDB; + +-- insert some data to get rating and the web interface working + +-- system internal products +INSERT INTO `products` (id,class,handle,name,on_sale) + VALUES (1,'pstnpeering','PSTN_PEERING','PSTN Peering',1), + (2,'sippeering','SIP_PEERING','SIP Peering',1), + (3,'reseller','VOIP_RESELLER','VoIP Reseller',1); +-- the default reseller contract, will be the only one unless multitenancy is enabled +INSERT INTO `contracts` (id,status,modify_timestamp,create_timestamp,activate_timestamp) VALUES (1,'active',now(),now(),now()); +INSERT INTO `resellers` (id,contract_id,name,status) VALUES (1,1,'default','active'); +INSERT INTO `billing_mappings` (id,start_date,end_date,contract_id,product_id) VALUES (1,NULL,NULL,1,3); +-- first administrative account, change password after first login +INSERT INTO `admins` (id,reseller_id,login,md5pass,is_master,is_superuser,call_data,lawful_intercept) + VALUES (1,1,'administrator',md5('administrator'),1,1,1,1); +-- default billing profile creation +INSERT INTO `billing_profiles` (id,reseller_id,handle,name,interval_unit,interval_count) + VALUES(1,1,'default','Default Billing Profile','month',1); +INSERT INTO `billing_zones` (id,billing_profile_id,zone,detail) VALUES (1,1,'Free Default Zone','All Destinations'); +INSERT INTO `billing_fees` (id,billing_profile_id,billing_zone_id,destination,type, + onpeak_init_rate,onpeak_init_interval,onpeak_follow_rate,onpeak_follow_interval, + offpeak_init_rate,offpeak_init_interval,offpeak_follow_rate,offpeak_follow_interval) + VALUES (1,1,1,'.*','call',0,600,0,600,0,600,0,600); diff --git a/db_scripts/base/0020_create_oss.up b/db_scripts/base/0020_create_oss.up new file mode 100644 index 00000000..fef94be2 --- /dev/null +++ b/db_scripts/base/0020_create_oss.up @@ -0,0 +1,591 @@ +-- step out of our provisioning DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS provisioning; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE IF NOT EXISTS provisioning CHARACTER SET 'utf8'; + +USE provisioning; + +-- create domain table +CREATE TABLE `voip_domains` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain` varchar(127) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `domain_idx` (`domain`) +) ENGINE=InnoDB; + + +-- create subscriber table +CREATE TABLE `voip_subscribers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `username` varchar(127) NOT NULL, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_domains` (`id`), + `uuid` char(36) NOT NULL, + `password` varchar(40) default NULL, + `admin` bool NOT NULL DEFAULT FALSE, + `account_id` int(11) UNSIGNED NULL DEFAULT NULL, + `webusername` varchar(127) default NULL, + `webpassword` varchar(40) default NULL, + `autoconf_displayname` varchar(255) default NULL, + `autoconf_group_id` int(11) unsigned default NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `user_dom_idx` (`username`,`domain_id`), + UNIQUE KEY `uuid_idx` (`uuid`), + KEY `accountid_idx` (`account_id`), + KEY `domainid_idx` (`domain_id`), + CONSTRAINT `v_s_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create alias table +CREATE TABLE `voip_dbaliases` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `username` varchar(127) NOT NULL, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_domains` (`id`), + `subscriber_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_subscribers` (`id`), + PRIMARY KEY (`id`), + UNIQUE KEY `user_dom_idx` (`username`,`domain_id`), + KEY `domainid_idx` (`domain_id`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_da_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_da_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- sip peering tables +CREATE TABLE `voip_peer_groups` ( + `id` int(11) unsigned NOT NULL auto_increment, + `name` varchar(127) NOT NULL, + `priority` tinyint(3) NOT NULL default '1', + `description` varchar(255), + `peering_contract_id` int(11) unsigned, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_peer_rules` ( + `id` int(11) unsigned NOT NULL auto_increment, + `group_id` int(11) unsigned NOT NULL, + `callee_prefix` varchar(64) NOT NULL default '', + `caller_prefix` varchar(64) default NULL, + `description` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `grpidx` (`group_id`), + CONSTRAINT `v_pg_groupid_ref` FOREIGN KEY (`group_id`) REFERENCES `voip_peer_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_peer_hosts` ( + `id` int(11) unsigned NOT NULL auto_increment, + `group_id` int(11) unsigned NOT NULL, + `name` varchar(64) NOT NULL default '', + `ip` varchar(64) NOT NULL, + `host` varchar(64) DEFAULT NULL, + `port` int(5) NOT NULL default '5060', + `weight` tinyint(3) NOT NULL default '0', + `via_lb` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `grpname` (`group_id`,`name`), + KEY `grpidx` (`group_id`), + CONSTRAINT `v_ps_groupid_ref` FOREIGN KEY (`group_id`) REFERENCES `voip_peer_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create voip_preferences table +CREATE TABLE `voip_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `attribute` varchar(31) NOT NULL, + `type` tinyint(3) NOT NULL default 0, + `max_occur` tinyint(3) UNSIGNED NOT NULL, + `usr_pref` bool NOT NULL default FALSE, + `dom_pref` bool NOT NULL default FALSE, + `peer_pref` bool NOT NULL default FALSE, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `internal` tinyint(1) NOT NULL default 0, + `data_type` enum('boolean','int','string') NOT NULL default 'string', + `read_only` bool NOT NULL default FALSE, + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `attribute_idx` (`attribute`) +) ENGINE=InnoDB; + +-- create subscriber preferences table +CREATE TABLE `voip_usr_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `subscriber_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_subscribers` (`id`), + `attribute_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_preferences` (`id`), + `value` varchar(128) NOT NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `subidattrid_idx` (`subscriber_id`,`attribute_id`), + KEY `subscriberid_idx` (`subscriber_id`), + KEY `attributeid_idx` (`attribute_id`), + CONSTRAINT `v_u_p_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_u_p_attributeid_ref` FOREIGN KEY (`attribute_id`) + REFERENCES `voip_preferences` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create domain preferences table +CREATE TABLE `voip_dom_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_domains` (`id`), + `attribute_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_preferences` (`id`), + `value` varchar(128) NOT NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `domidattrid_idx` (`domain_id`,`attribute_id`), + KEY `domainid_idx` (`domain_id`), + KEY `attributeid_idx` (`attribute_id`), + CONSTRAINT `v_d_p_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_d_p_attributeid_ref` FOREIGN KEY (`attribute_id`) + REFERENCES `voip_preferences` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create peer host preferences table +CREATE TABLE `voip_peer_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `peer_host_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_peer_hosts` (`id`), + `attribute_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_preferences` (`id`), + `value` varchar(255) NOT NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `peerhostid_idx` (`peer_host_id`), + KEY `attributeid_idx` (`attribute_id`), + CONSTRAINT `v_p_p_peerhostid_ref` FOREIGN KEY (`peer_host_id`) + REFERENCES `voip_peer_hosts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_p_p_attributeid_ref` FOREIGN KEY (`attribute_id`) + REFERENCES `voip_preferences` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create preliminary address book table +-- this should be moved to LDAP at some time +CREATE TABLE `voip_contacts` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL REFERENCES `voip_subscribers` (`id`), + `firstname` varchar(127), + `lastname` varchar(127), + `company` varchar(127), + `phonenumber` varchar(31), + `homephonenumber` varchar(31), + `mobilenumber` varchar(31), + `faxnumber` varchar(31), + `email` varchar(255), + `homepage` varchar(255), + PRIMARY KEY (`id`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_c_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_speed_dial` ( + `id` int(11) UNSIGNED NOT NULL PRIMARY KEY auto_increment, + `subscriber_id` int(11) UNSIGNED NOT NULL, + `slot` varchar(64) NOT NULL, + `destination` varchar(192) NOT NULL, + UNIQUE KEY `subscriberid_slot_idx` (`subscriber_id`,`slot`), + CONSTRAINT `v_sd_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) engine=InnoDB; + +CREATE TABLE `voip_reminder` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL, + `time` time NOT NULL, + `recur` enum('never','weekdays','always') NOT NULL default 'never', + PRIMARY KEY (`id`), + UNIQUE KEY `subscriber_id` (`subscriber_id`), + CONSTRAINT `v_rem_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create IP groups table containing IPs where users may connect from +-- IP networks are combined to groups to keep usr_preferences a bit smaller +CREATE TABLE `voip_allowed_ip_groups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(10) unsigned NOT NULL, + `ipnet` varchar(18) NOT NULL, + PRIMARY KEY (`id`), + KEY `groupid_idx` (`group_id`), + KEY `ipnet_idx` (`ipnet`), + UNIQUE KEY `groupnet_idx` (`group_id`,`ipnet`) +) ENGINE=InnoDB; + +-- this is a sequencer for `group_id` in `voip_allowed_ip_groups` above +CREATE TABLE `voip_aig_sequence` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- create fax tables +CREATE TABLE `voip_fax_preferences` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL REFERENCES `voip_subscribers` (`id`), + `password` varchar(64), + `name` varchar(64), + `active` bool NOT NULL default FALSE, + `send_status` bool NOT NULL default TRUE, + `send_copy` bool NOT NULL default TRUE, + PRIMARY KEY (`id`), + UNIQUE KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_f_p_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_fax_destinations` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL REFERENCES `voip_subscribers` (`id`), + `destination` varchar(255) NOT NULL, + `filetype` enum('PS','TIFF','PDF','PDF14') NOT NULL default 'TIFF', + `cc` bool NOT NULL default FALSE, + `incoming` bool NOT NULL default TRUE, + `outgoing` bool NOT NULL default FALSE, + `status` bool NOT NULL default FALSE, + PRIMARY KEY (`id`), + UNIQUE KEY `subdest_idx` (`subscriber_id`, `destination`), + CONSTRAINT `v_f_d_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- audio files for IVR, auto-attendant, etc. +CREATE TABLE `voip_audio_files` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned REFERENCES `voip_subscribers` (`id`), + `domain_id` int(11) unsigned REFERENCES `voip_domains` (`id`), + `handle` varchar(63) NOT NULL, + `description` text, + `audio` longblob, + PRIMARY KEY (`id`), + UNIQUE KEY `subhand_idx` (`subscriber_id`, `handle`), + UNIQUE KEY `domhand_idx` (`domain_id`, `handle`), + CONSTRAINT `v_a_f_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_a_f_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- VSC table +CREATE TABLE `voip_vscs` ( + `id` int(11) unsigned NOT NULL auto_increment, + `domain_id` int(11) unsigned REFERENCES `voip_domains` (`id`), + `digits` char(2), + `action` varchar(31) NOT NULL, + `audio_id` int(11) unsigned NOT NULL REFERENCES `voip_audio_files` (`id`), + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `domdig_idx` (`domain_id`, `digits`), + UNIQUE KEY `domaction_idx` (`domain_id`, `action`), + KEY `audioid_idx` (`audio_id`), + CONSTRAINT `v_v_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_v_audioid_ref` FOREIGN KEY (`audio_id`) + REFERENCES `voip_audio_files` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + + +-- language strings for error messages +CREATE TABLE language_strings ( + `id` int(11) unsigned NOT NULL auto_increment, + `code` varchar(63) NOT NULL, + `language` char(2) NOT NULL, + `string` text, + PRIMARY KEY (`id`), + UNIQUE KEY `codelang_idx` (code, language) +) ENGINE=InnoDB; + +-- xmlrpc dispatcher tables +CREATE TABLE `xmlqueue` ( + `id` int(10) unsigned NOT NULL auto_increment, + `target` varchar(255) NOT NULL, + `body` text NOT NULL, + `ctime` int(10) unsigned NOT NULL, + `atime` int(10) unsigned NOT NULL, + `tries` int(10) unsigned NOT NULL, + `next_try` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `next_try` (`next_try`,`id`) +) ENGINE=InnoDB; + +CREATE TABLE `xmlhosts` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `ip` varchar(15) NOT NULL, + `port` int(5) unsigned NOT NULL, + `path` varchar(64) NOT NULL DEFAULT '/', + `sip_port` int(5) unsigned DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `xmlgroups` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(32) NOT NULL, + PRIMARY KEY (`id`), + KEY `gname` (`name`) +) ENGINE=InnoDB; + +CREATE TABLE `xmlhostgroups` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(11) unsigned NOT NULL, + `host_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `gidx` (`group_id`), + KEY `xhg_hostid_ref` (`host_id`), + CONSTRAINT `xhg_groupid_ref` FOREIGN KEY (`group_id`) + REFERENCES `xmlgroups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `xhg_hostid_ref` FOREIGN KEY (`host_id`) + REFERENCES `xmlhosts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_rewrite_rule_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(32) NOT NULL, + `description` varchar(255) DEFAULT NULL, + `caller_in_dpid` int(11) unsigned DEFAULT NULL, + `callee_in_dpid` int(11) unsigned DEFAULT NULL, + `caller_out_dpid` int(11) unsigned DEFAULT NULL, + `callee_out_dpid` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_idx` (`name`) +) ENGINE=InnoDB; + +-- this is a sequencer for the dpids in `voip_rewrite_rule_sets` above +CREATE TABLE `voip_rwrs_sequence` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_rewrite_rules` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `set_id` int(11) unsigned NOT NULL, + `match_pattern` varchar(64) NOT NULL DEFAULT '', + `replace_pattern` varchar(64) NOT NULL, + `description` varchar(127) NOT NULL DEFAULT '', + `direction` enum('in','out') NOT NULL DEFAULT 'in', + `field` enum('caller','callee') NOT NULL DEFAULT 'caller', + `priority` int(11) unsigned NOT NULL DEFAULT '50', + PRIMARY KEY (`id`), + KEY `setidx` (`set_id`), + KEY `dirfieldidx` (`direction`,`field`), + CONSTRAINT `v_rwr_setid_ref` FOREIGN KEY (`set_id`) REFERENCES `voip_rewrite_rule_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- call forward tables +CREATE TABLE `voip_cf_destination_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `name_idx` (`name`), + CONSTRAINT `v_s_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_destinations` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `destination_set_id` int(11) unsigned NOT NULL, + `destination` varchar(255) NOT NULL, + `priority` int(3) unsigned DEFAULT NULL, + `timeout` int(11) unsigned NOT NULL DEFAULT 300, + PRIMARY KEY (`id`), + KEY `dset_idx` (`destination_set_id`), + KEY `destination_idx` (`destination`), + CONSTRAINT `v_cf_dsetid_ref` FOREIGN KEY (`destination_set_id`) REFERENCES `voip_cf_destination_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_time_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `name_idx` (`name`), + CONSTRAINT `v_cf_ts_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES +`voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_periods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `time_set_id` int(11) unsigned NOT NULL, + `year` varchar(255) DEFAULT NULL, + `month` varchar(255) DEFAULT NULL, + `mday` varchar(255) DEFAULT NULL, + `wday` varchar(255) DEFAULT NULL, + `hour` varchar(255) DEFAULT NULL, + `minute` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tset_idx` (`time_set_id`), + CONSTRAINT `v_cf_tsetid_ref` FOREIGN KEY (`time_set_id`) REFERENCES +`voip_cf_time_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_mappings` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `type` enum('cfu','cfb','cfna','cft') NOT NULL DEFAULT 'cfu', + `destination_set_id` int(11) unsigned DEFAULT NULL, + `time_set_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `type_idx` (`type`), + CONSTRAINT `v_cfmap_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `cfmap_time_ref` FOREIGN KEY (`time_set_id`) REFERENCES `voip_cf_time_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `cfmap_dest_ref` FOREIGN KEY (`destination_set_id`) REFERENCES `voip_cf_destination_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + +) ENGINE=InnoDB; + +-- INSERT default data + +-- localization language strings +LOAD DATA LOCAL INFILE 'language_strings.txt' INTO TABLE language_strings; + +-- xmlrpc dispatcher +INSERT INTO xmlgroups (id, name) VALUES(1, 'proxy'); +INSERT INTO xmlgroups (id, name) VALUES(2, 'registrar'); +INSERT INTO xmlgroups (id, name) VALUES(3, 'presence'); +INSERT INTO xmlgroups (id, name) VALUES(4, 'loadbalancer'); +INSERT INTO xmlgroups (id, name) VALUES(5, 'appserver'); +-- TODO: SR interface hack to work around rpc/mi discrepancies +INSERT INTO xmlgroups (id, name) VALUES(6, 'proxy-ng'); + +INSERT INTO xmlhosts (id, ip, port, path, sip_port, description) VALUES (1,'127.0.0.1','8000','/RPC2', '5062', 'Kamailio'); +INSERT INTO xmlhosts (id, ip, port, path, description) VALUES (2,'127.0.0.1','8090','/','Sems'); +-- TODO: SR interface hack to work around rpc/mi discrepancies +INSERT INTO xmlhosts (id, ip, port, path, description) VALUES (3,'127.0.0.1','5062','/','Kamailio-SR'); + +INSERT INTO xmlhostgroups (id, group_id, host_id) VALUES (1,1,1); +INSERT INTO xmlhostgroups (id, group_id, host_id) VALUES (2,5,2); +INSERT INTO xmlhostgroups (id, group_id, host_id) VALUES (3,6,3); + +-- regular kamailio preferences +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, read_only, description) + VALUES('lock', 0, 1, 'string', 1, 1, 'See "lock_voip_account_subscriber" for a list of possible values. A lock value of "none" will not be returned to the caller. Read-only setting.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_in_mode', 1, 1, 'boolean', 1, 'Specifies the operational mode of the incoming block list. If unset or set to a false value, it is a blacklist (accept all calls except from numbers listed in the block list), with a true value it is a whitelist (reject all calls except from numbers listed in the block list).'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_in_list', 0, 1, 'string', 0, 'Contains wildcarded E.164 numbers that are (not) allowed to call the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards like in shell patterns.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_in_clir', 1, 1, 'boolean', 1, 'Incoming anonymous calls (with calling line identification restriction) are blocked if set to true.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_out_mode', 1, 1, 'boolean', 1, 'Specifies the operational mode of the outgoing block list. If unset or set to a false value, it is a blacklist (allow all calls except to numbers listed in the block list), with a true value it is a whitelist (deny all calls except to numbers listed in the block list).'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_out_list', 0, 1, 'string', 0, 'Contains wildcarded E.164 numbers that are (not) allowed to be called by the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards like in shell patterns.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_in_mode', 1, 1, 'boolean', 1, 'Same as "block_in_mode" but may only be set by administrators.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_in_list', 0, 1, 'string', 0, 'Same as "block_in_list" but may only be set by administrators and is applied prior to the user setting.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_in_clir', 1, 1, 'boolean', 1, 'Same as "block_in_clir" but may only be set by administrators and is applied prior to the user setting.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_out_mode', 1, 1, 'boolean', 1, 'Same as "block_out_mode" but may only be set by administrators.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_out_list', 0, 1, 'string', 0, 'Same as "block_out_list" but may only be set by administrators and is applied prior to the user setting.'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cfu', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Unconditional" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cfb', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Busy" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cfna', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Unavailable" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cft', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Timeout" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('ringtimeout', 1, 1, 'int', 1, 'Specifies how many seconds the system should wait before redirecting the call if "cft" is set.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('cli', 0, 1, 'string', 1, 'E.164 number or complete SIP URI. "network-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls in the SIP "From" and "P-Asserted-Identity" headers (as user- and network-provided calling numbers). The content of the "From" header may be overridden by the "user_cli" preference and client (if allowed by the "allowed_clis" preference) SIP signalling. Automatically set to the primary E.164 number specified in the subscriber details.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('user_cli', 0, 1, 'string', 1, 'E.164 number or complete SIP URI. "user-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. If set, this is put in the SIP "From" header (as user-provided calling number) if a client sends a CLI which is not allowed by "allowed_clis" or "allowed_clis" is not set.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('clir', 1, 1, 'boolean', 1, '"Calling line identification restriction" - if set to true, the CLI is not displayed on outgoing calls.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('cc', 0, 1, 'string', 1, 'The country code that will be used for routing of dialed numbers without a country code. Defaults to the country code of the E.164 number if the subscriber has one.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('ac', 0, 1, 'string', 1, 'The area code that will be used for routing of dialed numbers without an area code. Defaults to the area code of the E.164 number if the subscriber has one.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('svc_ac', 0, 1, 'string', 1, 'The area code that will be used for routing of dialed service numbers without an area code. Defaults to "ac".'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('emerg_ac', 0, 1, 'string', 1, 'The area code that will be used for routing of dialed emergency numbers without an area code. Defaults to "ac".'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_out_override_pin', 0, 1, 'string', 1, 'A PIN code which may be used in a VSC to disable the outgoing user block list and NCOS level for a call.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_out_override_pin', 0, 1, 'string', 1, 'Same as "block_out_override_pin" but additionally disables the administrative block list and NCOS level.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('allowed_clis', 0, 1, 'string', 0, 'A list of shell patterns specifying which CLIs are allowed to be set by the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards as usual in shell patterns.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('e164_to_ruri', 1, 0, 1, 'boolean', 1, 'Send the E164 number instead of SIP AOR as request username when sending INVITE to the subscriber. If a 404 is received the SIP AOR is sent as request URI as fallback.'); + +-- "external" kamailio preferences - only used for documentation and provisioning parameter checks +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal, description) + VALUES('ncos', 0, 1, 'string', 1, -1, 'Specifies the NCOS level that applies to the user.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal, description) + VALUES('adm_ncos', 0, 1, 'string', 1, -1, 'Same as "ncos", but may only be set by administrators and is applied prior to the user setting.'); + +-- "internal" kamailio preferences - not directly accessible via provisioning (often mapped to an "external" preference somehow) +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ncos_id', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('adm_ncos_id', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('account_id', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ext_contract_id', 0, 1, 'string', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ext_subscriber_id', 0, 1, 'string', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('prepaid', 1, 1, 'boolean', 1, 1); + +-- domain preferences +INSERT INTO voip_preferences (attribute, type, dom_pref, data_type, max_occur, description) VALUES('unauth_inbound_calls', 1, 1, 'boolean', 1, 'Allow unauthenticated inbound calls from FOREIGN domain to users within this domain. Use with care - it allows to flood your users with voice spam.'); + + +-- peer preferences +INSERT INTO voip_preferences (attribute, type, usr_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_user', 0, 1, 1, 'string', 1, 'A username used for authentication against a peer host.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_pass', 0, 1, 1, 'string', 1, 'A password used for authentication against a peer host.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_realm', 0, 1, 1, 'string', 1, 'A realm (hostname) used to identify and for authentication against a peer host.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('find_subscriber_by_auth_user', 1, 0, 0, 1, 'boolean', 1, 'For incoming calls from this peer, find the destination subscriber also using its auth_username used for outbound registration.'); + + +-- user + domain preferences +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('omit_outbound_displayname', 1, 1, 1, 'boolean', 1, 'Suppress the caller display-name that is put in the SIP "From" header on outgoing calls.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('force_inbound_calls_to_peer', 1, 1, 1, 'boolean', 1, 'Force calls to this user to be treated as if the user was not local. This helps in migration scenarios.'); + + +-- user + domain + peer preferences +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Force rtp relay for this peer/domain/user.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('never_use_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Do not use rtp relay for this peer/domain/user. Rtp will be relayed if other participants have always_use_rtpproxy preference enabled.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('peer_auth_register', 1, 1, 1, 1, 'boolean', 1, 'Specifies whether registration at the peer host is desired.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('concurrent_max', 1, 1, 1, 1, 'int', 1, 'Maximum number of concurrent sessions (calls) for a subscriber or peer.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('concurrent_max_out', 1, 1, 1, 1, 'int', 1, 'Maximum number of concurrent outgoing sessions (calls) coming from a subscriber or going to a peer.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('force_outbound_calls_to_peer', 1, 1, 1, 1, 'boolean', 1, 'Force calls from this user/domain/peer to be routed to PSTN even if the callee is local. Use with caution, as this setting may increase your costs! When enabling this option in a peer, make sure you trust it, as the NGCP will become an open relay for it!'); + +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal, description) + VALUES('rewrite_rule_set', 1, 1, 1, 1, 'int', 1, -1, 'Specifies the list of caller and callee rewrite rules which should be applied for incoming and outgoing calls.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_caller_in_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_callee_in_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_caller_out_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_callee_out_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_ipv4_for_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Always force the IPv4 address for the RTP relay, regardless of what is autodetected on SIP/SDP level. This is mutually exclusive with always_use_ipv6_for_rtpproxy.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_ipv6_for_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Always force the IPv6 address for the RTP relay, regardless of what is autodetected on SIP/SDP level. This is mutually exclusive with always_use_ipv4_for_rtpproxy.'); diff --git a/db_scripts/base/0030_create_kamailio_301.up b/db_scripts/base/0030_create_kamailio_301.up new file mode 100644 index 00000000..deca5732 --- /dev/null +++ b/db_scripts/base/0030_create_kamailio_301.up @@ -0,0 +1,390 @@ +USE mysql; +DROP DATABASE IF EXISTS kamailio; + +CREATE DATABASE IF NOT EXISTS kamailio CHARACTER SET 'utf8'; + +USE kamailio; + +CREATE TABLE `acc` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `method` varchar(16) NOT NULL DEFAULT '', + `from_tag` varchar(64) NOT NULL DEFAULT '', + `to_tag` varchar(64) NOT NULL DEFAULT '', + `callid` varchar(255) NOT NULL DEFAULT '', + `sip_code` varchar(3) NOT NULL DEFAULT '', + `sip_reason` varchar(128) NOT NULL DEFAULT '', + `time` datetime NOT NULL, + `time_hires` decimal(13,3) NOT NULL, + `src_leg` varchar(2048) default NULL, + `dst_leg` varchar(2048) default NULL, + `dst_user` varchar(64) NOT NULL default '', + `dst_ouser` varchar(64) NOT NULL default '', + `dst_domain` varchar(128) NOT NULL default '', + `src_user` varchar(64) NOT NULL default '', + `src_domain` varchar(128) NOT NULL default '', + PRIMARY KEY (`id`), + KEY `callid_idx` (`callid`) +) ENGINE=InnoDB; + +CREATE TABLE `dbaliases` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `alias_username` varchar(64) NOT NULL DEFAULT '', + `alias_domain` varchar(64) NOT NULL DEFAULT '', + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `alias_idx` (`alias_username`,`alias_domain`), + KEY `target_idx` (`username`,`domain`) +) ENGINE=InnoDB; + +CREATE TABLE `dialog` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hash_entry` int(10) unsigned NOT NULL, + `hash_id` int(10) unsigned NOT NULL, + `callid` varchar(255) NOT NULL, + `from_uri` varchar(128) NOT NULL, + `from_tag` varchar(64) NOT NULL, + `to_uri` varchar(128) NOT NULL, + `to_tag` varchar(64) NOT NULL, + `caller_cseq` varchar(7) NOT NULL, + `callee_cseq` varchar(7) NOT NULL, + `caller_route_set` varchar(512) DEFAULT NULL, + `callee_route_set` varchar(512) DEFAULT NULL, + `caller_contact` varchar(128) NOT NULL, + `callee_contact` varchar(128) NOT NULL, + `caller_sock` varchar(64) NOT NULL, + `callee_sock` varchar(64) NOT NULL, + `state` int(10) unsigned NOT NULL, + `start_time` int(10) unsigned NOT NULL, + `timeout` int(10) unsigned NOT NULL DEFAULT '0', + `sflags` int(10) unsigned NOT NULL DEFAULT '0', + `toroute` int(10) unsigned NOT NULL DEFAULT '0', + `req_uri` varchar(128) NOT NULL, + PRIMARY KEY (`id`), + KEY `hash_idx` (`hash_entry`,`hash_id`) +) ENGINE=InnoDB; + +CREATE TABLE `dialplan` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `dpid` int(11) NOT NULL, + `pr` int(11) NOT NULL, + `match_op` int(11) NOT NULL, + `match_exp` varchar(64) NOT NULL, + `match_len` int(11) NOT NULL, + `subst_exp` varchar(64) NOT NULL, + `repl_exp` varchar(64) NOT NULL, + `attrs` varchar(32) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `dispatcher` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `setid` int(11) NOT NULL DEFAULT '0', + `destination` varchar(192) NOT NULL DEFAULT '', + `flags` int(11) NOT NULL DEFAULT '0', + `priority` int(11) NOT NULL DEFAULT '0', + `description` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `domain` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(64) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + UNIQUE KEY `domain_idx` (`domain`) +) ENGINE=InnoDB; + +CREATE TABLE `lcr_gw` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `gw_name` varchar(128) NOT NULL, + `ip_addr` varchar(64) NOT NULL, + `hostname` varchar(64) DEFAULT NULL, + `port` smallint(5) unsigned DEFAULT NULL, + `params` varchar(64) DEFAULT NULL, + `uri_scheme` tinyint(3) unsigned DEFAULT NULL, + `transport` tinyint(3) unsigned DEFAULT NULL, + `strip` tinyint(3) unsigned DEFAULT NULL, + `tag` varchar(16) DEFAULT NULL, + `flags` int(10) unsigned NOT NULL DEFAULT '0', + `defunct` int(10) unsigned DEFAULT NULL, + `group_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `lcr_id_gw_name_idx` (`lcr_id`,`gw_name`), + UNIQUE KEY `lcr_id_ip_addr_idx` (`lcr_id`,`ip_addr`) +) ENGINE=InnoDB; + +CREATE TABLE `lcr_rule` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `prefix` varchar(16) DEFAULT NULL, + `from_uri` varchar(64) DEFAULT NULL, + `stopper` int(10) unsigned NOT NULL DEFAULT '0', + `enabled` int(10) unsigned NOT NULL DEFAULT '1', + `group_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `lcr_id_idx` (`lcr_id`) +) ENGINE=InnoDB; + +CREATE TABLE `lcr_rule_target` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `rule_id` int(10) unsigned NOT NULL, + `gw_id` int(10) unsigned NOT NULL, + `priority` tinyint(3) unsigned NOT NULL, + `weight` int(10) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `rule_id_gw_id_idx` (`rule_id`,`gw_id`), + KEY `lcr_id_idx` (`lcr_id`), + KEY `gw_id_idx` (`gw_id`), + CONSTRAINT `l_r_t_ruleid_ref` FOREIGN KEY (`rule_id`) + REFERENCES `lcr_rule` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `l_r_t_gwid_ref` FOREIGN KEY (`gw_id`) + REFERENCES `lcr_gw` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `location` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) DEFAULT NULL, + `contact` varchar(255) NOT NULL DEFAULT '', + `received` varchar(128) DEFAULT NULL, + `path` varchar(128) DEFAULT NULL, + `expires` datetime NOT NULL DEFAULT '2020-05-28 21:32:15', + `q` float(10,2) NOT NULL DEFAULT '1.00', + `callid` varchar(255) NOT NULL DEFAULT 'Default-Call-ID', + `cseq` int(11) NOT NULL DEFAULT '13', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + `flags` int(11) NOT NULL DEFAULT '0', + `cflags` int(11) NOT NULL DEFAULT '0', + `user_agent` varchar(255) NOT NULL DEFAULT '', + `socket` varchar(64) DEFAULT NULL, + `methods` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `account_contact_idx` (`username`,`domain`,`contact`) +) ENGINE=InnoDB; + +CREATE TABLE `speed_dial` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + `sd_username` varchar(64) NOT NULL DEFAULT '', + `sd_domain` varchar(64) NOT NULL DEFAULT '', + `new_uri` varchar(128) NOT NULL DEFAULT '', + `fname` varchar(64) NOT NULL DEFAULT '', + `lname` varchar(64) NOT NULL DEFAULT '', + `description` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `speed_dial_idx` (`username`,`domain`,`sd_domain`,`sd_username`) +) ENGINE=InnoDB; + +CREATE TABLE `subscriber` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + `password` varchar(40) NOT NULL DEFAULT '', + `email_address` varchar(64) NOT NULL DEFAULT '', + `ha1` varchar(64) NOT NULL DEFAULT '', + `ha1b` varchar(64) NOT NULL DEFAULT '', + `rpid` varchar(64) DEFAULT NULL, + `uuid` char(36) NOT NULL, + `timezone` varchar(64) NOT NULL DEFAULT '', + `datetime_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `account_idx` (`username`,`domain`), + KEY `username_idx` (`username`) +) ENGINE=InnoDB; + +CREATE TABLE `trusted` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `src_ip` varchar(50) NOT NULL, + `proto` varchar(4) NOT NULL, + `from_pattern` varchar(64) DEFAULT NULL, + `tag` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `peer_idx` (`src_ip`) +) ENGINE=InnoDB; + +CREATE TABLE `usr_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`), + KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB; + +CREATE TABLE `dom_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`), + KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB; + +CREATE TABLE `peer_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`) +-- not used -- KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB; + +CREATE TABLE `address` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `grp` smallint(5) unsigned NOT NULL DEFAULT '0', + `ip_addr` varchar(15) NOT NULL, + `mask` tinyint(4) NOT NULL DEFAULT '32', + `port` smallint(5) unsigned NOT NULL DEFAULT '0', + `tag` VARCHAR(64), + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `version` ( + `table_name` varchar(32) NOT NULL, + `table_version` int(10) unsigned NOT NULL DEFAULT '0' +) ENGINE=InnoDB; + +CREATE TABLE `voicemail_users` ( + `uniqueid` int(10) unsigned NOT NULL AUTO_INCREMENT, + `customer_id` char(36) NOT NULL DEFAULT '', + `context` varchar(63) NOT NULL DEFAULT 'default', + `mailbox` varchar(31) NOT NULL, + `password` varchar(31) NOT NULL DEFAULT '0', + `fullname` varchar(255) NOT NULL DEFAULT '', + `email` varchar(255) NOT NULL DEFAULT '', + `pager` varchar(255) NOT NULL DEFAULT '', + `tz` varchar(10) NOT NULL DEFAULT 'central', + `attach` varchar(4) NOT NULL DEFAULT 'yes', + `saycid` varchar(4) NOT NULL DEFAULT 'yes', + `dialout` varchar(10) NOT NULL DEFAULT '', + `callback` varchar(10) NOT NULL DEFAULT '', + `review` varchar(4) NOT NULL DEFAULT 'no', + `operator` varchar(4) NOT NULL DEFAULT 'no', + `envelope` varchar(4) NOT NULL DEFAULT 'no', + `sayduration` varchar(4) NOT NULL DEFAULT 'no', + `saydurationm` tinyint(4) NOT NULL DEFAULT '1', + `sendvoicemail` varchar(4) NOT NULL DEFAULT 'no', + `delete` varchar(4) NOT NULL DEFAULT 'no', + `nextaftercmd` varchar(4) NOT NULL DEFAULT 'yes', + `forcename` varchar(4) NOT NULL DEFAULT 'no', + `forcegreetings` varchar(4) NOT NULL DEFAULT 'no', + `hidefromdir` varchar(4) NOT NULL DEFAULT 'yes', + `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`uniqueid`), + KEY `customer_idx` (`customer_id`), + KEY `mailbox_context` (`mailbox`,`context`) +) ENGINE=InnoDB; + +CREATE TABLE `voicemail_spool` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `msgnum` int(11) NOT NULL DEFAULT '0', + `dir` varchar(127) DEFAULT '', + `context` varchar(63) DEFAULT '', + `macrocontext` varchar(63) DEFAULT '', + `callerid` varchar(255) DEFAULT '', + `origtime` varchar(16) DEFAULT '', + `duration` varchar(16) DEFAULT '', + `mailboxuser` varchar(255) DEFAULT '', + `mailboxcontext` varchar(63) DEFAULT '', + `recording` longblob, + PRIMARY KEY (`id`), + KEY `dir` (`dir`), + KEY `mailboxuser_idx` (`mailboxuser`), + CONSTRAINT `v_s_mailboxuser_ref` FOREIGN KEY (`mailboxuser`) REFERENCES `voicemail_users` (`customer_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `fax_preferences` ( + `subscriber_id` int(10) unsigned NOT NULL, + `password` varchar(64) default NULL, + `name` varchar(64) default NULL, + `active` enum('true','false') NOT NULL default 'true', + `send_status` enum('true','false') NOT NULL default 'false', + `send_copy` enum('true','false') NOT NULL default 'false', + `send_copy_cc` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`subscriber_id`) +) ENGINE=InnoDB; + +CREATE TABLE `fax_destinations` ( + `id` int(10) unsigned NOT NULL auto_increment, + `subscriber_id` int(10) unsigned NOT NULL, + `destination` varchar(64) NOT NULL, + `filetype` enum('ps','tiff','pdf','pdf14') NOT NULL default 'tiff', + `cc` enum('true','false') NOT NULL default 'false', + `incoming` enum('true','false') NOT NULL default 'true', + `outgoing` enum('true','false') NOT NULL default 'false', + `status` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`id`), + KEY `subscriber_id` (`subscriber_id`) +) ENGINE=InnoDB; + +CREATE TABLE `sems_registrations` ( + `subscriber_id` int(11) NOT NULL, + `registration_status` tinyint(1) NOT NULL DEFAULT '0', + `last_registration` datetime DEFAULT NULL, + `expiry` datetime DEFAULT NULL, + `last_code` smallint(2) DEFAULT NULL, + `last_reason` varchar(256) DEFAULT NULL, + `contacts` varchar(512) DEFAULT NULL, + PRIMARY KEY (`subscriber_id`) +) ENGINE=InnoDB; + +CREATE TABLE `fax_journal` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(10) unsigned NOT NULL DEFAULT '0', + `the_timestamp` int(11) unsigned NOT NULL DEFAULT '0', + `duration` int(11) unsigned NOT NULL DEFAULT '0', + `direction` enum('in','out') NOT NULL DEFAULT 'in', + `peer_number` varchar(255) NOT NULL DEFAULT '', + `peer_name` varchar(255) NOT NULL DEFAULT '', + `pages` int(10) unsigned NOT NULL DEFAULT '0', + `reason` varchar(255) NOT NULL, + `status` varchar(255) NOT NULL DEFAULT '', + `signal_rate` int(10) unsigned NOT NULL DEFAULT '0', + `quality` varchar(255) NOT NULL DEFAULT '', + `filename` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `selkey` (`subscriber_id`,`direction`) +) ENGINE=InnoDB; + +INSERT INTO `version` VALUES + ('acc',4), + ('lcr_gw',1), + ('lcr_rule_target',1), + ('lcr_rule',1), + ('domain',1), + ('trusted',5), + ('location',1004), + ('dbaliases',1), + ('speed_dial',2), + ('usr_preferences',2), + ('subscriber',6), + ('dialog',4), + ('dispatcher',3), + ('address',4), + ('dialplan',1); + + +INSERT INTO `dispatcher` VALUES ('1','2','sip:127.0.0.1:5070','0','0','Voicemail servers'); +INSERT INTO `dispatcher` VALUES ('2','3','sip:127.0.0.1:5080','0','0','Application servers'); +INSERT INTO `dispatcher` VALUES ('3','4','sip:127.0.0.1:5090','0','0','Fax2Mail servers'); diff --git a/db_scripts/base/0040_create_oss_triggers_kamailio.up b/db_scripts/base/0040_create_oss_triggers_kamailio.up new file mode 100644 index 00000000..a08d9969 --- /dev/null +++ b/db_scripts/base/0040_create_oss_triggers_kamailio.up @@ -0,0 +1,930 @@ + +USE provisioning; + +-- create triggers that populate kamailio tables +DELIMITER | + +CREATE TRIGGER voip_sub_crepl_trig AFTER INSERT ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE subscriber_domain varchar(127); + + SELECT domain INTO subscriber_domain FROM voip_domains where id = NEW.domain_id; + + INSERT INTO kamailio.subscriber (username, domain, uuid, password, datetime_created, ha1, ha1b) + VALUES(NEW.username, subscriber_domain, NEW.uuid, NEW.password, now(), + MD5(CONCAT(NEW.username, ':', subscriber_domain, ':', NEW.password)), + MD5(CONCAT(NEW.username, '@', subscriber_domain, ':', subscriber_domain, ':', NEW.password))); + END; +| + +CREATE TRIGGER voip_sub_urepl_trig AFTER UPDATE ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE old_subscriber_domain varchar(127); + DECLARE new_subscriber_domain varchar(127); + + SELECT domain INTO old_subscriber_domain FROM voip_domains where id = OLD.domain_id; + SELECT domain INTO new_subscriber_domain FROM voip_domains where id = NEW.domain_id; + + UPDATE kamailio.subscriber SET username = NEW.username, domain = new_subscriber_domain, + uuid = NEW.uuid, password = NEW.password, + ha1 = MD5(CONCAT(NEW.username, ':', new_subscriber_domain, ':', NEW.password)), + ha1b = MD5(CONCAT(NEW.username, '@', new_subscriber_domain, ':', new_subscriber_domain, ':', NEW.password)) + WHERE username = OLD.username + AND domain = old_subscriber_domain; + END; +| + +CREATE TRIGGER voip_sub_drepl_trig BEFORE DELETE ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + + SELECT domain INTO subscriber_domain FROM voip_domains where id = OLD.domain_id; + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = OLD.username AND domain = subscriber_domain; + + DELETE FROM kamailio.subscriber WHERE username = OLD.username + AND domain = subscriber_domain; + + -- should be implemented via a provisioning.voicemail_users table + -- and a foreign key to voip_subscribers + DELETE FROM kamailio.voicemail_users WHERE customer_id = OLD.uuid; + + -- work around MySQL bug. the cascaded delete should trigger our + -- delete actions on the provisioning tables, but doesn't + DELETE FROM kamailio.usr_preferences WHERE username = OLD.username + AND domain = subscriber_domain; + DELETE FROM kamailio.dbaliases WHERE username = OLD.username + AND domain = subscriber_domain; + DELETE FROM kamailio.speed_dial WHERE username = OLD.username + AND domain = subscriber_domain; + DELETE FROM kamailio.fax_preferences WHERE subscriber_id = os_subscriber_id; + DELETE FROM kamailio.fax_destinations WHERE subscriber_id = os_subscriber_id; + END; +| + +CREATE TRIGGER voip_dba_crepl_trig AFTER INSERT ON voip_dbaliases + FOR EACH ROW BEGIN + DECLARE dbalias_domain varchar(127); + DECLARE target_username varchar(127); + DECLARE target_domain varchar(127); + + SELECT domain INTO dbalias_domain FROM voip_domains where id = NEW.domain_id; + SELECT a.username, b.domain INTO target_username, target_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + INSERT INTO kamailio.dbaliases (alias_username, alias_domain, username, domain) + VALUES(NEW.username, dbalias_domain, target_username, target_domain); + END; +| + +CREATE TRIGGER voip_dba_urepl_trig AFTER UPDATE ON voip_dbaliases + FOR EACH ROW BEGIN + DECLARE old_dbalias_domain varchar(127); + DECLARE new_dbalias_domain varchar(127); + DECLARE target_username varchar(127); + DECLARE target_domain varchar(127); + + SELECT domain INTO old_dbalias_domain FROM voip_domains where id = OLD.domain_id; + SELECT domain INTO new_dbalias_domain FROM voip_domains where id = NEW.domain_id; + SELECT a.username, b.domain INTO target_username, target_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + UPDATE kamailio.dbaliases SET alias_username = NEW.username, alias_domain = new_dbalias_domain, + username = target_username, domain = target_domain + WHERE alias_username = OLD.username + AND alias_domain = old_dbalias_domain; + END; +| + +CREATE TRIGGER voip_dba_drepl_trig BEFORE DELETE ON voip_dbaliases + FOR EACH ROW BEGIN + DECLARE dbalias_domain varchar(127); + + SELECT domain INTO dbalias_domain FROM voip_domains where id = OLD.domain_id; + + DELETE FROM kamailio.dbaliases WHERE alias_username = OLD.username + AND alias_domain = dbalias_domain; + END; +| + +CREATE TRIGGER voip_prul_crepl_trig AFTER INSERT ON voip_peer_rules + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_rule (lcr_id, prefix, from_uri, stopper, enabled, group_id) + VALUES(1, NEW.callee_prefix, NEW.caller_prefix, + 0, 1, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT gw.lcr_id, LAST_INSERT_ID(), gw.id, vpg.priority, vph.weight + FROM kamailio.lcr_gw gw + INNER JOIN provisioning.voip_peer_hosts vph ON vph.ip = gw.ip_addr + AND gw.lcr_id = 1 + AND vph.group_id = gw.group_id + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = vph.group_id + WHERE vph.group_id = NEW.group_id; + + END; +| + +CREATE TRIGGER voip_prul_urepl_trig AFTER UPDATE ON voip_peer_rules + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_rule + SET prefix = NEW.callee_prefix, from_uri = NEW.caller_prefix + WHERE prefix = OLD.callee_prefix + AND from_uri = OLD.caller_prefix + AND group_id = OLD.group_id; + + END; +| + +CREATE TRIGGER voip_prul_drepl_trig AFTER DELETE ON voip_peer_rules + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_rule + WHERE prefix = OLD.callee_prefix + AND from_uri = OLD.caller_prefix + AND group_id = OLD.group_id; + + -- foreign key will delete from kamailio.lcr_rule_target + + END; +| + +CREATE TRIGGER voip_pgrp_urepl_trig AFTER UPDATE ON voip_peer_groups + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_rule_target rt, kamailio.lcr_gw gw + SET rt.priority = NEW.priority + WHERE gw.id = rt.gw_id + AND gw.lcr_id = 1 + AND gw.group_id = NEW.id; + + END; +| + +CREATE TRIGGER voip_pgrp_drepl_trig AFTER DELETE ON voip_peer_groups + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_rule WHERE group_id = OLD.id; + DELETE FROM kamailio.lcr_gw WHERE group_id = OLD.id; + + END; +| + +CREATE TRIGGER voip_phost_crepl_trig AFTER INSERT ON voip_peer_hosts + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_gw (lcr_id, gw_name, ip_addr, hostname, port, uri_scheme, transport, strip, flags, group_id) + VALUES(1, NEW.name, NEW.ip, NEW.host, NEW.port, 1, 1, 0, NEW.id, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT rule.lcr_id, rule.id, LAST_INSERT_ID(), vpg.priority, NEW.weight + FROM kamailio.lcr_rule rule + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = rule.group_id + WHERE vpg.id = NEW.group_id; + + END; +| + +CREATE TRIGGER voip_phost_urepl_trig AFTER UPDATE ON voip_peer_hosts + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_gw + SET gw_name = NEW.name, ip_addr = NEW.ip, hostname = NEW.host, port = NEW.port, flags = NEW.id + WHERE lcr_id = 1 AND ip_addr = OLD.ip; + + UPDATE kamailio.lcr_rule_target rt, kamailio.lcr_gw gw + SET rt.weight = NEW.weight + WHERE gw.id = rt.gw_id + AND gw.lcr_id = 1 + AND gw.group_id = NEW.group_id + AND gw.ip_addr = NEW.ip; + + END; +| + +CREATE TRIGGER voip_phost_drepl_trig AFTER DELETE ON voip_peer_hosts + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_gw + WHERE lcr_id = 1 + AND group_id = OLD.group_id + AND ip_addr = OLD.ip; + + -- foreign key will delete from kamailio.lcr_rule_target + + END; +| + +CREATE TRIGGER voip_peerpref_crepl_trig AFTER INSERT ON voip_peer_preferences + FOR EACH ROW BEGIN + + INSERT INTO kamailio.peer_preferences + (id, uuid, attribute, type, value, last_modified) + SELECT NEW.id, NEW.peer_host_id, attribute, type, NEW.value, NOW() + FROM provisioning.voip_preferences + WHERE id = NEW.attribute_id; + + END; +| + +CREATE TRIGGER voip_peerpref_urepl_trig AFTER UPDATE ON voip_peer_preferences + FOR EACH ROW BEGIN + + UPDATE kamailio.peer_preferences pp, provisioning.voip_preferences vp + SET pp.id = NEW.id, pp.uuid = NEW.peer_host_id, pp.type = vp.type, + pp.attribute = vp.attribute, pp.value = NEW.value, pp.last_modified = NOW() + WHERE pp.id = OLD.id + AND vp.id = NEW.attribute_id; + + END; +| + +CREATE TRIGGER voip_peerpref_drepl_trig BEFORE DELETE ON voip_peer_preferences + FOR EACH ROW BEGIN + + DELETE FROM kamailio.peer_preferences + WHERE id = OLD.id; + + END; +| + +CREATE TRIGGER voip_usrpref_crepl_trig AFTER INSERT ON voip_usr_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE subscriber_uuid char(36); + DECLARE attribute_name varchar(31); + DECLARE attribute_type tinyint(3); + + SELECT a.username, b.domain, a.uuid INTO subscriber_username, subscriber_domain, subscriber_uuid + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND a.domain_id = b.id; + SELECT attribute, type INTO attribute_name, attribute_type + FROM voip_preferences + WHERE id = NEW.attribute_id; + + INSERT INTO kamailio.usr_preferences (uuid, username, domain, attribute, type, value) + VALUES(subscriber_uuid, subscriber_username, subscriber_domain, + attribute_name, attribute_type, NEW.value); + END; +| + +CREATE TRIGGER voip_usrpref_urepl_trig AFTER UPDATE ON voip_usr_preferences + FOR EACH ROW BEGIN + DECLARE old_subscriber_username varchar(127); + DECLARE new_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE new_subscriber_domain varchar(127); + DECLARE old_attribute_name varchar(31); + DECLARE new_attribute_name varchar(31); + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND a.domain_id = b.id; + SELECT a.username, b.domain INTO new_subscriber_username, new_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND a.domain_id = b.id; + SELECT attribute INTO old_attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + SELECT attribute INTO new_attribute_name + FROM voip_preferences + WHERE id = NEW.attribute_id; + + UPDATE kamailio.usr_preferences SET username = new_subscriber_username, domain = new_subscriber_domain, + attribute = new_attribute_name, value = NEW.value + WHERE username = old_subscriber_username + AND domain = old_subscriber_domain + AND attribute = old_attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_usrpref_drepl_trig BEFORE DELETE ON voip_usr_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE attribute_name varchar(31); + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND a.domain_id = b.id; + SELECT attribute INTO attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + + DELETE FROM kamailio.usr_preferences WHERE username = subscriber_username + AND domain = subscriber_domain + AND attribute = attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_rwrules_crepl_trig AFTER INSERT ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DECLARE new_set_id int(11) unsigned; + + SELECT IF(NEW.direction = 'in', IF(NEW.field = 'caller', caller_in_dpid, callee_in_dpid), IF(NEW.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO new_set_id FROM voip_rewrite_rule_sets WHERE id = NEW.set_id; + + INSERT INTO kamailio.dialplan (dpid,pr,match_op,match_exp,match_len,subst_exp,repl_exp,attrs) + VALUES(new_set_id,NEW.priority,1,NEW.match_pattern,0,NEW.match_pattern,NEW.replace_pattern,''); + + END; +| + +CREATE TRIGGER voip_rwrules_urepl_trig AFTER UPDATE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DECLARE old_set_id int(11) unsigned; + DECLARE new_set_id int(11) unsigned; + + SELECT IF(OLD.direction = 'in', IF(OLD.field = 'caller', caller_in_dpid, callee_in_dpid), IF(OLD.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO old_set_id FROM voip_rewrite_rule_sets WHERE id = OLD.set_id; + SELECT IF(NEW.direction = 'in', IF(NEW.field = 'caller', caller_in_dpid, callee_in_dpid), IF(NEW.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO new_set_id FROM voip_rewrite_rule_sets WHERE id = NEW.set_id; + + UPDATE kamailio.dialplan + SET dpid = new_set_id, + pr = NEW.priority, + match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, + repl_exp = NEW.replace_pattern + WHERE dpid = old_set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_rwrules_drepl_trig BEFORE DELETE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DECLARE old_set_id int(11) unsigned; + + SELECT IF(OLD.direction = 'in', IF(OLD.field = 'caller', caller_in_dpid, callee_in_dpid), IF(OLD.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO old_set_id FROM voip_rewrite_rule_sets WHERE id = OLD.set_id; + + DELETE FROM kamailio.dialplan + WHERE dpid = old_set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_rwrulesets_crepl_trig BEFORE INSERT ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + IF NEW.caller_in_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.caller_in_dpid = (SELECT LAST_INSERT_ID()); + END IF; + IF NEW.callee_in_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.callee_in_dpid = (SELECT LAST_INSERT_ID()); + END IF; + IF NEW.caller_out_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.caller_out_dpid = (SELECT LAST_INSERT_ID()); + END IF; + IF NEW.callee_out_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.callee_out_dpid = (SELECT LAST_INSERT_ID()); + END IF; + + DELETE a FROM voip_rwrs_sequence a, voip_rwrs_sequence b WHERE a.id < b.id; + + END; +| + +CREATE TRIGGER voip_rwrulesets_urepl_trig AFTER UPDATE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + IF NEW.caller_in_dpid != OLD.caller_in_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.caller_in_dpid WHERE dpid = OLD.caller_in_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.caller_in_dpid + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.caller_in_dpid + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.caller_in_dpid + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + END IF; + IF NEW.callee_in_dpid != OLD.callee_in_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.callee_in_dpid WHERE dpid = OLD.callee_in_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.callee_in_dpid + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.callee_in_dpid + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.callee_in_dpid + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + END IF; + IF NEW.caller_out_dpid != OLD.caller_out_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.caller_out_dpid WHERE dpid = OLD.caller_out_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.caller_out_dpid + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.caller_out_dpid + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.caller_out_dpid + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + END IF; + IF NEW.callee_out_dpid != OLD.callee_out_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.callee_out_dpid WHERE dpid = OLD.callee_out_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.callee_out_dpid + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.callee_out_dpid + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.callee_out_dpid + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + END IF; + + END; +| + +CREATE TRIGGER voip_rwrulesets_drepl_trig BEFORE DELETE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_out_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_out_dpid; + + END; +| + +CREATE TRIGGER voip_pref_urepl_trig AFTER UPDATE ON voip_preferences + FOR EACH ROW BEGIN + + IF OLD.attribute != NEW.attribute THEN + UPDATE kamailio.usr_preferences + SET attribute = NEW.attribute + WHERE attribute = OLD.attribute; + UPDATE kamailio.dom_preferences + SET attribute = NEW.attribute + WHERE attribute = OLD.attribute; + UPDATE kamailio.peer_preferences + SET attribute = NEW.attribute + WHERE attribute = OLD.attribute; + END IF; + + END; +| + +CREATE TRIGGER voip_pref_drepl_trig BEFORE DELETE ON voip_preferences + FOR EACH ROW BEGIN + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_*_preferences delete action, but doesn't + DELETE FROM voip_usr_preferences WHERE attribute_id = OLD.id; + DELETE FROM voip_dom_preferences WHERE attribute_id = OLD.id; + DELETE FROM voip_peer_preferences WHERE attribute_id = OLD.id; + + END; +| + +CREATE TRIGGER voip_dom_crepl_trig AFTER INSERT ON voip_domains + FOR EACH ROW BEGIN + + INSERT INTO kamailio.domain (domain) VALUES(NEW.domain); + + END; +| + +CREATE TRIGGER voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + END; +| + +CREATE TRIGGER voip_dompref_crepl_trig AFTER INSERT ON voip_dom_preferences + FOR EACH ROW BEGIN + DECLARE domain_name varchar(127); + DECLARE attribute_name varchar(31); + DECLARE attribute_type tinyint(3); + + SELECT domain INTO domain_name + FROM voip_domains + WHERE id = NEW.domain_id; + SELECT attribute, type INTO attribute_name, attribute_type + FROM voip_preferences + WHERE id = NEW.attribute_id; + + INSERT INTO kamailio.dom_preferences (domain, attribute, type, value) + VALUES(domain_name, attribute_name, attribute_type, NEW.value); + END; +| + +CREATE TRIGGER voip_dompref_urepl_trig AFTER UPDATE ON voip_dom_preferences + FOR EACH ROW BEGIN + DECLARE old_domain_name varchar(127); + DECLARE new_domain_name varchar(127); + DECLARE old_attribute_name varchar(31); + DECLARE new_attribute_name varchar(31); + + SELECT domain INTO old_domain_name + FROM voip_domains + WHERE id = OLD.domain_id; + SELECT domain INTO new_domain_name + FROM voip_domains + WHERE id = NEW.domain_id; + SELECT attribute INTO old_attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + SELECT attribute INTO new_attribute_name + FROM voip_preferences + WHERE id = NEW.attribute_id; + + UPDATE kamailio.dom_preferences SET domain = new_domain_name, + attribute = new_attribute_name, + value = NEW.value + WHERE domain = old_domain_name + AND attribute = old_attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_dompref_drepl_trig BEFORE DELETE ON voip_dom_preferences + FOR EACH ROW BEGIN + DECLARE domain_name varchar(127); + DECLARE attribute_name varchar(31); + + SELECT domain INTO domain_name + FROM voip_domains + WHERE id = OLD.domain_id; + SELECT attribute INTO attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + + DELETE FROM kamailio.dom_preferences WHERE domain = domain_name + AND attribute = attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_sd_crepl_trig AFTER INSERT ON voip_speed_dial + FOR EACH ROW BEGIN + DECLARE target_username varchar(64); + DECLARE target_domain varchar(64); + + SELECT a.username, b.domain INTO target_username, target_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + INSERT INTO kamailio.speed_dial (username, domain, sd_username, sd_domain, + new_uri, fname, lname, description) + VALUES(target_username, target_domain, + NEW.slot, target_domain, + NEW.destination, '', '', ''); + END; +| + +CREATE TRIGGER voip_sd_urepl_trig AFTER UPDATE ON voip_speed_dial + FOR EACH ROW BEGIN + DECLARE old_username varchar(127); + DECLARE old_domain varchar(127); + DECLARE new_username varchar(127); + DECLARE new_domain varchar(127); + + SELECT a.username, b.domain INTO old_username, old_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + SELECT a.username, b.domain INTO new_username, new_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + UPDATE kamailio.speed_dial SET username = new_username, domain = new_domain, + sd_username = NEW.slot, sd_domain = new_domain, + new_uri = NEW.destination + WHERE username = old_username + AND domain = old_domain + AND sd_username = OLD.slot; + END; +| + +CREATE TRIGGER voip_sd_drepl_trig BEFORE DELETE ON voip_speed_dial + FOR EACH ROW BEGIN + DECLARE old_username varchar(127); + DECLARE old_domain varchar(127); + + SELECT a.username, b.domain INTO old_username, old_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + DELETE FROM kamailio.speed_dial WHERE username = old_username + AND domain = old_domain + AND sd_username = OLD.slot; + END; +| + +CREATE TRIGGER voip_faxp_crepl_trig AFTER INSERT ON voip_fax_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + INSERT INTO kamailio.fax_preferences + (subscriber_id, password, name, active, send_status, send_copy) + VALUES(os_subscriber_id, NEW.password, NEW.name, IF(NEW.active, 'true', 'false'), + IF(NEW.send_status, 'true', 'false'), IF(NEW.send_copy, 'true', 'false')); + + END; +| + +CREATE TRIGGER voip_faxp_urepl_trig AFTER UPDATE ON voip_fax_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + UPDATE kamailio.fax_preferences SET subscriber_id = os_subscriber_id, password = NEW.password, + name = NEW.name, active = IF(NEW.active, 'true', 'false'), + send_status = IF(NEW.send_status, 'true', 'false'), + send_copy = IF(NEW.send_copy, 'true', 'false') + WHERE subscriber_id = old_os_subscriber_id; + + END; +| + +CREATE TRIGGER voip_faxp_drepl_trig BEFORE DELETE ON voip_fax_preferences + FOR EACH ROW BEGIN + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + DELETE FROM kamailio.fax_preferences WHERE subscriber_id = old_os_subscriber_id; + + END; +| + +CREATE TRIGGER voip_faxd_crepl_trig AFTER INSERT ON voip_fax_destinations + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + INSERT INTO kamailio.fax_destinations (subscriber_id, destination, filetype, + cc, incoming, outgoing, status) + VALUES(os_subscriber_id, NEW.destination, NEW.filetype, + IF(NEW.cc, 'true', 'false'), IF(NEW.incoming, 'true', 'false'), + IF(NEW.outgoing, 'true', 'false'), IF(NEW.status, 'true', 'false')); + + END; +| + +CREATE TRIGGER voip_faxd_urepl_trig AFTER UPDATE ON voip_fax_destinations + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + UPDATE kamailio.fax_destinations SET subscriber_id = os_subscriber_id, destination = NEW.destination, + filetype = NEW.filetype, cc = IF(NEW.cc, 'true', 'false'), + incoming = IF(NEW.incoming, 'true', 'false'), + outgoing = IF(NEW.outgoing, 'true', 'false'), + status = IF(NEW.status, 'true', 'false') + WHERE subscriber_id = old_os_subscriber_id + AND destination = OLD.destination; + + END; +| + +CREATE TRIGGER voip_faxd_drepl_trig BEFORE DELETE ON voip_fax_destinations + FOR EACH ROW BEGIN + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + DELETE FROM kamailio.fax_destinations WHERE subscriber_id = old_os_subscriber_id + AND destination = OLD.destination; + + END; +| + +CREATE TRIGGER voip_aig_crepl_trig AFTER INSERT ON voip_allowed_ip_groups + FOR EACH ROW BEGIN + + INSERT INTO kamailio.address (id, grp, ip_addr, mask) + VALUES(NEW.id, NEW.group_id, + IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', 1), NEW.ipnet), + IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', -1), 32)); + + END; +| + +CREATE TRIGGER voip_aig_urepl_trig AFTER UPDATE ON voip_allowed_ip_groups + FOR EACH ROW BEGIN + + UPDATE kamailio.address SET id = NEW.id, grp = NEW.group_id, + ip_addr = IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', 1), NEW.ipnet), + mask = IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', -1), 32) + WHERE id = OLD.id; + + END; +| + +CREATE TRIGGER voip_aig_drepl_trig BEFORE DELETE ON voip_allowed_ip_groups + FOR EACH ROW BEGIN + + DELETE FROM kamailio.address WHERE id = OLD.id; + + END; +| + +DELIMITER ; + +-- internal domain and subscribers +INSERT INTO voip_domains (domain) VALUES('voip.sipwise.local'); +INSERT INTO voip_subscribers (username, domain_id, uuid, password, create_timestamp) + SELECT 'no_such_number', id, '9bcb88b6-541a-43da-8fdc-816f5557ff93', MD5(RAND()), NOW() + FROM voip_domains WHERE domain = 'voip.sipwise.local'; +INSERT INTO voip_subscribers (username, domain_id, uuid, password, create_timestamp) + SELECT 'nagios', id, 'ac1697cf-6933-45ef-9abf-b1278054ded0', 'nagios4Sipwise!', NOW() + FROM voip_domains WHERE domain = 'voip.sipwise.local'; + diff --git a/db_scripts/base/0050_create_accounting.up b/db_scripts/base/0050_create_accounting.up new file mode 100644 index 00000000..11aaf2d7 --- /dev/null +++ b/db_scripts/base/0050_create_accounting.up @@ -0,0 +1,90 @@ +-- step out of our provisioning DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS accounting; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE IF NOT EXISTS accounting CHARACTER SET 'utf8'; + +USE accounting; + +-- create accounting tables + +CREATE TABLE `acc` like kamailio.acc; + +CREATE TABLE `cdr` ( + `id` int(10) unsigned NOT NULL auto_increment, + `update_time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `source_user_id` char(36) NOT NULL, + `source_provider_id` varchar(255) NOT NULL, + `source_external_subscriber_id` varchar(255) DEFAULT NULL, + `source_external_contract_id` varchar(255) DEFAULT NULL, + `source_account_id` int(11) unsigned NOT NULL DEFAULT '0', + `source_user` varchar(255) NOT NULL, + `source_domain` varchar(255) NOT NULL, + `source_cli` varchar(64) NOT NULL, + `source_clir` tinyint(1) NOT NULL default '0', + `destination_user_id` char(36) NOT NULL, + `destination_provider_id` varchar(255) NOT NULL, + `destination_external_subscriber_id` varchar(255) DEFAULT NULL, + `destination_external_contract_id` varchar(255) DEFAULT NULL, + `destination_account_id` int(11) unsigned NOT NULL DEFAULT '0', + `destination_user` varchar(255) NOT NULL, + `destination_domain` varchar(255) NOT NULL, + `destination_user_dialed` varchar(255) NOT NULL, + `destination_user_in` varchar(255) NOT NULL, + `destination_domain_in` varchar(255) NOT NULL, + `peer_auth_user` varchar(255) DEFAULT NULL, + `peer_auth_realm` varchar(255) DEFAULT NULL, + `call_type` enum('call','cfu','cft','cfb','cfna') NOT NULL default 'call', + `call_status` enum('ok','busy','noanswer','cancel','offline','timeout','other') NOT NULL default 'ok', + `call_code` char(3) NOT NULL, + `init_time` decimal(13,3) NOT NULL, + `start_time` decimal(13,3) NOT NULL, + `duration` decimal(13,3) NOT NULL, + `call_id` varchar(255) NOT NULL, + `carrier_cost` decimal(10,2) default NULL, + `reseller_cost` decimal(10,2) default NULL, + `customer_cost` decimal(10,2) default NULL, + `carrier_free_time` int(10) unsigned DEFAULT NULL, + `reseller_free_time` int(10) unsigned DEFAULT NULL, + `customer_free_time` int(10) unsigned DEFAULT NULL, + `carrier_billing_fee_id` int(11) unsigned default NULL, + `reseller_billing_fee_id` int(11) unsigned default NULL, + `customer_billing_fee_id` int(11) unsigned default NULL, + `carrier_billing_zone_id` int(11) unsigned default NULL, + `reseller_billing_zone_id` int(11) unsigned default NULL, + `customer_billing_zone_id` int(11) unsigned default NULL, + `frag_carrier_onpeak` tinyint(1) default NULL, + `frag_reseller_onpeak` tinyint(1) default NULL, + `frag_customer_onpeak` tinyint(1) default NULL, + `is_fragmented` tinyint(1) default NULL, + `rated_at` datetime default NULL, + `rating_status` enum('unrated','ok','failed') NOT NULL default 'unrated', + PRIMARY KEY (`id`), + KEY `suid` (`source_user_id`), + KEY `duid` (`destination_user_id`), + KEY `suri` (`source_user`,`source_domain`,`source_cli`), + KEY `duri` (`destination_user`,`destination_domain`), + KEY `sprov` (`source_provider_id`), + KEY `dprov` (`destination_provider_id`), + KEY `kcid` (`call_id`) +) ENGINE=InnoDB; + +CREATE TABLE `mark` ( + `id` int(10) unsigned NOT NULL auto_increment, + `collector` varchar(255) NOT NULL, + `acc_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `prepaid_costs` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `call_id` varchar(255) NOT NULL, + `cost` double NOT NULL, + `free_time_used` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; diff --git a/db_scripts/base/0060_create_syslog.up b/db_scripts/base/0060_create_syslog.up new file mode 100644 index 00000000..09524ed6 --- /dev/null +++ b/db_scripts/base/0060_create_syslog.up @@ -0,0 +1,99 @@ +-- step out of our provisioning DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS syslog; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE IF NOT EXISTS syslog CHARACTER SET 'utf8'; + +USE syslog; + + +CREATE TABLE `se1` ( + `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `CustomerID` bigint(20) DEFAULT NULL, + `ReceivedAt` datetime DEFAULT NULL, + `DeviceReportedTime` datetime DEFAULT NULL, + `Facility` smallint(6) DEFAULT NULL, + `Priority` smallint(6) DEFAULT NULL, + `FromHost` varchar(60) DEFAULT NULL, + `Message` text, + `NTSeverity` int(11) DEFAULT NULL, + `Importance` int(11) DEFAULT NULL, + `EventSource` varchar(60) DEFAULT NULL, + `EventUser` varchar(60) DEFAULT NULL, + `EventCategory` int(11) DEFAULT NULL, + `EventID` int(11) DEFAULT NULL, + `EventBinaryData` text, + `MaxAvailable` int(11) DEFAULT NULL, + `CurrUsage` int(11) DEFAULT NULL, + `MinUsage` int(11) DEFAULT NULL, + `MaxUsage` int(11) DEFAULT NULL, + `InfoUnitID` int(11) DEFAULT NULL, + `SysLogTag` varchar(60) DEFAULT NULL, + `EventLogType` varchar(60) DEFAULT NULL, + `GenericFileName` varchar(60) DEFAULT NULL, + `SystemID` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE `se2` like `se1`; +CREATE TABLE `se3` like `se1`; +CREATE TABLE `se4` like `se1`; +CREATE TABLE `se5` like `se1`; +CREATE TABLE `se6` like `se1`; +CREATE TABLE `se7` like `se1`; +CREATE TABLE `se8` like `se1`; +CREATE TABLE `se9` like `se1`; +CREATE TABLE `se10` like `se1`; +CREATE TABLE `se11` like `se1`; +CREATE TABLE `se12` like `se1`; +CREATE TABLE `se13` like `se1`; +CREATE TABLE `se14` like `se1`; +CREATE TABLE `se15` like `se1`; +CREATE TABLE `se16` like `se1`; +CREATE TABLE `se17` like `se1`; +CREATE TABLE `se18` like `se1`; +CREATE TABLE `se19` like `se1`; +CREATE TABLE `se20` like `se1`; +CREATE TABLE `se21` like `se1`; +CREATE TABLE `se22` like `se1`; +CREATE TABLE `se23` like `se1`; +CREATE TABLE `se24` like `se1`; +CREATE TABLE `se25` like `se1`; +CREATE TABLE `se26` like `se1`; +CREATE TABLE `se27` like `se1`; +CREATE TABLE `se28` like `se1`; + +CREATE TABLE `SystemEvents` ( + `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `CustomerID` bigint(20) DEFAULT NULL, + `ReceivedAt` datetime DEFAULT NULL, + `DeviceReportedTime` datetime DEFAULT NULL, + `Facility` smallint(6) DEFAULT NULL, + `Priority` smallint(6) DEFAULT NULL, + `FromHost` varchar(60) DEFAULT NULL, + `Message` text, + `NTSeverity` int(11) DEFAULT NULL, + `Importance` int(11) DEFAULT NULL, + `EventSource` varchar(60) DEFAULT NULL, + `EventUser` varchar(60) DEFAULT NULL, + `EventCategory` int(11) DEFAULT NULL, + `EventID` int(11) DEFAULT NULL, + `EventBinaryData` text, + `MaxAvailable` int(11) DEFAULT NULL, + `CurrUsage` int(11) DEFAULT NULL, + `MinUsage` int(11) DEFAULT NULL, + `MaxUsage` int(11) DEFAULT NULL, + `InfoUnitID` int(11) DEFAULT NULL, + `SysLogTag` varchar(60) DEFAULT NULL, + `EventLogType` varchar(60) DEFAULT NULL, + `GenericFileName` varchar(60) DEFAULT NULL, + `SystemID` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=FIRST UNION=(`se1`,`se2`,`se3`,`se4`,`se5`,`se6`,`se7`,`se8`,`se9`,`se10`,`se11`,`se12`,`se13`,`se14`,`se15`,`se16`,`se17`,`se18`,`se19`,`se20`,`se21`,`se22`,`se23`,`se24`,`se25`,`se26`,`se27`,`se28`); + + diff --git a/db_scripts/base/0070_create_sipstats.up b/db_scripts/base/0070_create_sipstats.up new file mode 100644 index 00000000..7799b2e9 --- /dev/null +++ b/db_scripts/base/0070_create_sipstats.up @@ -0,0 +1,38 @@ +USE mysql; +DROP DATABASE IF EXISTS sipstats; + +CREATE DATABASE IF NOT EXISTS sipstats CHARACTER SET 'utf8'; + +USE sipstats; + +-- create packets tables + +CREATE TABLE `packets` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `timestamp` decimal(17,6) NOT NULL, + `src_mac` binary(6) NOT NULL, + `dst_mac` binary(6) NOT NULL, + `protocol` enum('IPv4','IPv6') NOT NULL, + `src_ip` varchar(39) NOT NULL, + `dst_ip` varchar(39) NOT NULL, + `src_port` smallint(5) unsigned NOT NULL, + `dst_port` smallint(5) unsigned NOT NULL, + `header` blob NOT NULL, + `payload` blob NOT NULL, + `trailer` blob NOT NULL, + `method` varchar(20) NOT NULL, + `cseq_method` varchar(16) NOT NULL, + `call_id` varchar(255) NOT NULL, + `request_uri` varchar(255) NOT NULL, + `from_uri` varchar(255) NOT NULL, + `caller_uuid` varchar(255) NOT NULL, + `callee_uuid` varchar(255) NOT NULL, + `was_fragmented` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`,`timestamp`), + KEY `call_id_idx` (`call_id`), + KEY `caller_uuid_idx` (`caller_uuid`), + KEY `callee_uuid_idx` (`callee_uuid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +PARTITION BY RANGE (FLOOR(`timestamp`)) +(PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM); + diff --git a/db_scripts/base/0080_create_carrier.up b/db_scripts/base/0080_create_carrier.up new file mode 100644 index 00000000..ec001ab2 --- /dev/null +++ b/db_scripts/base/0080_create_carrier.up @@ -0,0 +1,104 @@ +-- step out of our billing DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS carrier; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE carrier CHARACTER SET 'utf8'; + +USE carrier; + +CREATE TABLE `customers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `external_id` varchar(255) NULL default NULL, + `url` varchar(31) NOT NULL, + `shopuser` varchar(31) NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `externalid_idx` (`external_id`), + UNIQUE KEY `shopuser_idx` (`shopuser`) +) ENGINE=InnoDB; + +CREATE TABLE `orders` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `customer_id` int(11) UNSIGNED NOT NULL REFERENCES `customers` (`id`), + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `o_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `contracts` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `external_id` varchar(255) NULL default NULL, + `url` varchar(31) NULL default NULL, + `customer_id` int(11) UNSIGNED NULL REFERENCES `customers` (`id`), + `sip_uri` varchar(127) NULL default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `externalid_idx` (`external_id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `c_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `credits` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + PRIMARY KEY (`id`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `c_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `order_id` int(11) UNSIGNED NULL REFERENCES `orders` (`id`), + `credit_id` int(11) UNSIGNED NULL REFERENCES `credits` (`id`), + PRIMARY KEY (`id`), + KEY `orderid_idx` (`order_id`), + CONSTRAINT `p_orderid_ref` FOREIGN KEY (`order_id`) + REFERENCES `orders` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `creditid_idx` (`credit_id`), + CONSTRAINT `p_creditid_ref` FOREIGN KEY (`credit_id`) + REFERENCES `credits` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `subscribers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `external_id` varchar(255) NULL default NULL, + `username` varchar(127) NOT NULL, + `domain` varchar(127) NOT NULL, + `webusername` varchar(127) default NULL, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + PRIMARY KEY (`id`), + UNIQUE KEY `externalid_idx` (`external_id`), + UNIQUE KEY `usrdom_idx` (`username`, `domain`), + UNIQUE KEY `domwebuser_idx` (`domain`, `webusername`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `s_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `numbers` ( + `number` varchar(42) NOT NULL, + `subscriber_id` int(11) UNSIGNED NULL REFERENCES `subscribers` (`id`), + PRIMARY KEY `number_idx` (`number`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `n_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `interceptions` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `url` varchar(31) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; diff --git a/db_scripts/base/0090_create_no_replicates.up b/db_scripts/base/0090_create_no_replicates.up new file mode 100644 index 00000000..11d9a66b --- /dev/null +++ b/db_scripts/base/0090_create_no_replicates.up @@ -0,0 +1,8 @@ +USE accounting; +create table acc_backup like kamailio.acc; +create table acc_trash like kamailio.acc; + +USE kamailio; +create table acc_backup like kamailio.acc; +create table acc_trash like kamailio.acc; + diff --git a/db_scripts/base/0100_grants_dbs.up b/db_scripts/base/0100_grants_dbs.up new file mode 100644 index 00000000..b5f25d6b --- /dev/null +++ b/db_scripts/base/0100_grants_dbs.up @@ -0,0 +1,53 @@ +GRANT SELECT ON mysql.* TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON kamailio.location TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON provisioning.voip_subscribers TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL'; + +GRANT SELECT ON kamailio.* TO 'kamailioro'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT ALL ON kamailio.* TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON kamailio.location TO 'natping'@'localhost' IDENTIFIED BY 'PW_NATPING'; + +#GRANT ALL ON accounting.* TO 'collector'@'localhost' IDENTIFIED BY 'PW_COLLECTOR'; + +GRANT ALL ON accounting.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR'; +GRANT SELECT ON provisioning.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR'; +GRANT SELECT ON billing.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR'; + +GRANT ALL ON accounting.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON billing.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; + +GRANT ALL PRIVILEGES ON kamailio.voicemail_users TO 'asterisk'@'localhost' IDENTIFIED BY 'PW_ASTERISK'; +GRANT ALL PRIVILEGES ON kamailio.voicemail_spool TO 'asterisk'@'localhost' IDENTIFIED BY 'PW_ASTERISK'; + +GRANT ALL ON provisioning.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON kamailio.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON sipstats.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; + + +GRANT SELECT ON accounting.cdr TO 'exporter'@'localhost' IDENTIFIED BY 'PW_EXPORTER'; +GRANT SELECT,INSERT,UPDATE ON accounting.mark TO 'exporter'@'localhost' IDENTIFIED BY 'PW_EXPORTER'; +GRANT SELECT ON billing.billing_zones_history TO 'exporter'@'localhost' IDENTIFIED BY 'PW_EXPORTER'; + +GRANT RELOAD ON *.* TO 'rsyslog'@'localhost' IDENTIFIED BY 'PW_RSYSLOG'; +GRANT ALL on syslog.* TO 'rsyslog'@'localhost' IDENTIFIED BY 'PW_RSYSLOG'; + +GRANT SELECT,INSERT,UPDATE ON accounting.* TO 'rateomat'@'localhost' IDENTIFIED BY 'PW_RATEOMAT'; +GRANT DELETE ON accounting.prepaid_costs TO 'rateomat'@'localhost' IDENTIFIED BY 'PW_RATEOMAT'; +GRANT SELECT,INSERT,UPDATE ON billing.* TO 'rateomat'@'localhost' IDENTIFIED BY 'PW_RATEOMAT'; + +GRANT SELECT,INSERT,UPDATE ON accounting.* TO 'sems_prepaid'@'localhost' IDENTIFIED BY 'PW_SEMS_PREPAID'; +GRANT SELECT,INSERT,UPDATE ON billing.* TO 'sems_prepaid'@'localhost' IDENTIFIED BY 'PW_SEMS_PREPAID'; + +GRANT ALL PRIVILEGES ON *.* TO 'sipwise'@'localhost' IDENTIFIED BY 'PW_SIPWISE' WITH GRANT OPTION; + +GRANT ALL PRIVILEGES ON kamailio.* to 'dbcleaner'@'localhost' IDENTIFIED BY 'PW_CLEANUP_TOOLS'; +GRANT ALL PRIVILEGES ON accounting.* to 'dbcleaner'@'localhost' IDENTIFIED BY 'PW_CLEANUP_TOOLS'; + +GRANT SELECT ON provisioning.* to 'hylafax'@'localhost' IDENTIFIED BY 'PW_HYLAFAX'; + +GRANT ALL ON sipstats.* to 'voisniff'@'localhost' IDENTIFIED BY 'PW_VOISNIFF'; + +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'replicator'@'sp1' IDENTIFIED BY 'PW_REPLICATOR'; +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'replicator'@'sp2' IDENTIFIED BY 'PW_REPLICATOR'; +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'nagios'@'sp1' IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'nagios'@'sp2' IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL'; diff --git a/db_scripts/base/0110_grants_proxies_kamailio.up b/db_scripts/base/0110_grants_proxies_kamailio.up new file mode 100644 index 00000000..68ab7f28 --- /dev/null +++ b/db_scripts/base/0110_grants_proxies_kamailio.up @@ -0,0 +1,18 @@ +GRANT SELECT ON mysql.* TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON kamailio.location TO 'nagios'@'localhost' IDENTIFIED BY 'PW_CHECKTOOL'; + +GRANT SELECT ON kamailio.* TO 'kamailioro'@'localhost' IDENTIFIED BY 'PW_KAMAILIORO'; +GRANT ALL ON kamailio.* TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON provisioning.voip_peer_hosts TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON provisioning.voip_cf_destination_sets TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON provisioning.voip_cf_destinations TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON provisioning.voip_cf_periods TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON provisioning.voip_cf_time_sets TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON provisioning.voip_cf_mappings TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON billing.ncos_levels TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON billing.ncos_lnp_list TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON billing.ncos_pattern_list TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON billing.lnp_numbers TO 'kamailio'@'localhost' IDENTIFIED BY 'PW_KAMAILIORW'; + +GRANT SELECT ON kamailio.* to 'hylafax'@'localhost' IDENTIFIED BY 'PW_HYLAFAX'; +GRANT INSERT ON kamailio.fax_journal to 'hylafax'@'localhost' IDENTIFIED BY 'PW_HYLAFAX'; diff --git a/db_scripts/base/3955.down b/db_scripts/base/3955.down new file mode 100644 index 00000000..4a3cbf06 --- /dev/null +++ b/db_scripts/base/3955.down @@ -0,0 +1,2 @@ +ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `type` tinyint(3) NOT NULL; +ALTER TABLE provisioning.voip_preferences DROP COLUMN `data_type`; diff --git a/db_scripts/base/3955.up b/db_scripts/base/3955.up new file mode 100644 index 00000000..b95c28fe --- /dev/null +++ b/db_scripts/base/3955.up @@ -0,0 +1,18 @@ +ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `type` tinyint(3) NOT NULL default 0; +ALTER TABLE provisioning.voip_preferences ADD COLUMN `data_type` enum('bool','int','string') NOT NULL default 'string'; + +UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'block_in_mode'; +UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'block_in_clir'; +UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'block_out_mode'; +UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'adm_block_in_mode'; +UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'adm_block_in_clir'; +UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'adm_block_out_mode'; +UPDATE provisioning.voip_preferences SET data_type = 'bool' where attribute = 'clir'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'lock'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'ringtimeout'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'ncos_id'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'adm_ncos_id'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_caller_in'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_callee_in'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_caller_out'; +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'dp_dom_callee_out'; diff --git a/db_scripts/base/3972.down b/db_scripts/base/3972.down new file mode 100644 index 00000000..507f6834 --- /dev/null +++ b/db_scripts/base/3972.down @@ -0,0 +1,39 @@ +ALTER TABLE provisioning.voip_domains ADD COLUMN `timezone` varchar(31) default NULL; +ALTER TABLE provisioning.voip_subscribers ADD COLUMN `timezone` varchar(31) default NULL; + +DROP TRIGGER provisioning.voip_sub_crepl_trig; +DROP TRIGGER provisioning.voip_sub_urepl_trig; + +DELIMITER | + +CREATE TRIGGER provisioning.voip_sub_crepl_trig AFTER INSERT ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE subscriber_domain varchar(127); + + SELECT domain INTO subscriber_domain FROM voip_domains where id = NEW.domain_id; + + INSERT INTO kamailio.subscriber (username, domain, uuid, timezone, password, datetime_created, ha1, ha1b) + VALUES(NEW.username, subscriber_domain, NEW.uuid, NEW.timezone, NEW.password, now(), + MD5(CONCAT(NEW.username, ':', subscriber_domain, ':', NEW.password)), + MD5(CONCAT(NEW.username, '@', subscriber_domain, ':', subscriber_domain, ':', NEW.password))); + END; +| + +CREATE TRIGGER provisioning.voip_sub_urepl_trig AFTER UPDATE ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE old_subscriber_domain varchar(127); + DECLARE new_subscriber_domain varchar(127); + + SELECT domain INTO old_subscriber_domain FROM voip_domains where id = OLD.domain_id; + SELECT domain INTO new_subscriber_domain FROM voip_domains where id = NEW.domain_id; + + UPDATE kamailio.subscriber SET username = NEW.username, domain = new_subscriber_domain, + uuid = NEW.uuid, timezone = NEW.timezone, password = NEW.password, + ha1 = MD5(CONCAT(NEW.username, ':', new_subscriber_domain, ':', NEW.password)), + ha1b = MD5(CONCAT(NEW.username, '@', new_subscriber_domain, ':', new_subscriber_domain, ':', NEW.password)) + WHERE username = OLD.username + AND domain = old_subscriber_domain; + END; +| + +DELIMITER ; diff --git a/db_scripts/base/3972.up b/db_scripts/base/3972.up new file mode 100644 index 00000000..769c837a --- /dev/null +++ b/db_scripts/base/3972.up @@ -0,0 +1,40 @@ +ALTER TABLE provisioning.voip_domains DROP COLUMN `timezone`; +ALTER TABLE provisioning.voip_subscribers DROP COLUMN `timezone`; + +DROP TRIGGER provisioning.voip_sub_crepl_trig; +DROP TRIGGER provisioning.voip_sub_urepl_trig; + +DELIMITER | + +CREATE TRIGGER provisioning.voip_sub_crepl_trig AFTER INSERT ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE subscriber_domain varchar(127); + + SELECT domain INTO subscriber_domain FROM voip_domains where id = NEW.domain_id; + + INSERT INTO kamailio.subscriber (username, domain, uuid, password, datetime_created, ha1, ha1b) + VALUES(NEW.username, subscriber_domain, NEW.uuid, NEW.password, now(), + MD5(CONCAT(NEW.username, ':', subscriber_domain, ':', NEW.password)), + MD5(CONCAT(NEW.username, '@', subscriber_domain, ':', subscriber_domain, ':', NEW.password))); + END; +| + +CREATE TRIGGER provisioning.voip_sub_urepl_trig AFTER UPDATE ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE old_subscriber_domain varchar(127); + DECLARE new_subscriber_domain varchar(127); + + SELECT domain INTO old_subscriber_domain FROM voip_domains where id = OLD.domain_id; + SELECT domain INTO new_subscriber_domain FROM voip_domains where id = NEW.domain_id; + + UPDATE kamailio.subscriber SET username = NEW.username, domain = new_subscriber_domain, + uuid = NEW.uuid, password = NEW.password, + ha1 = MD5(CONCAT(NEW.username, ':', new_subscriber_domain, ':', NEW.password)), + ha1b = MD5(CONCAT(NEW.username, '@', new_subscriber_domain, ':', new_subscriber_domain, ':', NEW.password)) + WHERE username = OLD.username + AND domain = old_subscriber_domain; + END; +| + +DELIMITER ; + diff --git a/db_scripts/base/3975.down b/db_scripts/base/3975.down new file mode 100644 index 00000000..14d3dabc --- /dev/null +++ b/db_scripts/base/3975.down @@ -0,0 +1,65 @@ +ALTER TABLE provisioning.voip_domains ADD COLUMN `local` bool NOT NULL default FALSE; +UPDATE provisioning.voip_domains SET local = TRUE; + +DROP TRIGGER provisioning.voip_dom_crepl_trig; +DROP TRIGGER provisioning.voip_dom_drepl_trig; + +DELIMITER | + +CREATE TRIGGER provisioning.voip_dom_crepl_trig AFTER INSERT ON voip_domains + FOR EACH ROW BEGIN + + IF NEW.local IS TRUE THEN + INSERT INTO kamailio.domain (domain) VALUES(NEW.domain); + END IF; + + END; +| + +CREATE TRIGGER provisioning.voip_dom_urepl_trig AFTER UPDATE ON voip_domains + FOR EACH ROW BEGIN + + IF NEW.local IS TRUE AND OLD.local IS FALSE THEN + INSERT INTO kamailio.domain (domain) VALUES(NEW.domain); + ELSEIF NEW.local IS FALSE AND OLD.local IS TRUE THEN + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + END IF; + + END; +| + +CREATE TRIGGER provisioning.voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + + IF OLD.local IS TRUE THEN + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + END IF; + + DELETE FROM kamailio.dialplan WHERE dpid IN + (caller_in_id, callee_in_id, caller_out_id, callee_out_id); + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/3975.up b/db_scripts/base/3975.up new file mode 100644 index 00000000..45560e57 --- /dev/null +++ b/db_scripts/base/3975.up @@ -0,0 +1,50 @@ +UPDATE provisioning.voip_domains SET local = TRUE; +ALTER TABLE provisioning.voip_domains DROP COLUMN `local`; + +DROP TRIGGER provisioning.voip_dom_crepl_trig; +DROP TRIGGER provisioning.voip_dom_urepl_trig; +DROP TRIGGER provisioning.voip_dom_drepl_trig; + +DELIMITER | + +CREATE TRIGGER provisioning.voip_dom_crepl_trig AFTER INSERT ON voip_domains + FOR EACH ROW BEGIN + + INSERT INTO kamailio.domain (domain) VALUES(NEW.domain); + + END; +| + +CREATE TRIGGER provisioning.voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + + DELETE FROM kamailio.dialplan WHERE dpid IN + (caller_in_id, callee_in_id, caller_out_id, callee_out_id); + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/4026.down b/db_scripts/base/4026.down new file mode 100644 index 00000000..2037a307 --- /dev/null +++ b/db_scripts/base/4026.down @@ -0,0 +1,2 @@ +ALTER TABLE provisioning.voip_peer_hosts ADD COLUMN `domain` varchar(64) NOT NULL AFTER `ip`; +UPDATE provisioning.voip_peer_hosts SET domain = 'change-me.example.com'; diff --git a/db_scripts/base/4026.up b/db_scripts/base/4026.up new file mode 100644 index 00000000..e3447581 --- /dev/null +++ b/db_scripts/base/4026.up @@ -0,0 +1 @@ +ALTER TABLE provisioning.voip_peer_hosts DROP COLUMN `domain`; diff --git a/db_scripts/base/4042.down b/db_scripts/base/4042.down new file mode 100644 index 00000000..724ca41b --- /dev/null +++ b/db_scripts/base/4042.down @@ -0,0 +1,8 @@ +DELETE FROM provisioning.voip_preferences WHERE internal = -1; + +ALTER TABLE provisioning.voip_preferences DROP COLUMN `read_only`; +ALTER TABLE provisioning.voip_preferences DROP COLUMN `description`; +ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `internal` bool NOT NULL default FALSE; +ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `data_type` enum('bool','int','string') NOT NULL default 'string'; + +UPDATE provisioning.voip_preferences SET data_type = 'bool' where data_type = ''; diff --git a/db_scripts/base/4042.up b/db_scripts/base/4042.up new file mode 100644 index 00000000..a145c7ba --- /dev/null +++ b/db_scripts/base/4042.up @@ -0,0 +1,88 @@ +ALTER TABLE provisioning.voip_preferences ADD COLUMN `read_only` bool NOT NULL default FALSE; +ALTER TABLE provisioning.voip_preferences ADD COLUMN `description` text; +ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `internal` tinyint(1) NOT NULL default 0; +ALTER TABLE provisioning.voip_preferences MODIFY COLUMN `data_type` enum('boolean','int','string') NOT NULL default 'string'; + +UPDATE provisioning.voip_preferences SET data_type = 'boolean' where data_type = ''; + +UPDATE provisioning.voip_preferences + SET read_only = TRUE, + description = 'See "lock_voip_account_subscriber" for a list of possible values. A lock value of "none" will not be returned to the caller. Read-only setting.' + WHERE attribute = 'lock'; +UPDATE provisioning.voip_preferences + SET description = 'Specifies the operational mode of the incoming block list. If unset or set to a false value, it is a blacklist (accept all calls except from numbers listed in the block list), with a true value it is a whitelist (reject all calls except from numbers listed in the block list).' + WHERE attribute = 'block_in_mode'; +UPDATE provisioning.voip_preferences + SET description = 'Contains wildcarded E.164 numbers that are (not) allowed to call the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards like in shell patterns.' + WHERE attribute = 'block_in_list'; +UPDATE provisioning.voip_preferences + SET description = 'Incoming anonymous calls (with calling line identification restriction) are blocked if set to true.' + WHERE attribute = 'block_in_clir'; +UPDATE provisioning.voip_preferences + SET description = 'Specifies the operational mode of the outgoing block list. If unset or set to a false value, it is a blacklist (allow all calls except to numbers listed in the block list), with a true value it is a whitelist (deny all calls except to numbers listed in the block list).' + WHERE attribute = 'block_out_mode'; +UPDATE provisioning.voip_preferences + SET description = 'Contains wildcarded E.164 numbers that are (not) allowed to be called by the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards like in shell patterns.' + WHERE attribute = 'block_out_list'; +UPDATE provisioning.voip_preferences + SET description = 'Same as "block_in_mode" but may only be set by administrators.' + WHERE attribute = 'adm_block_in_mode'; +UPDATE provisioning.voip_preferences + SET description = 'Same as "block_in_list" but may only be set by administrators and is applied prior to the user setting.' + WHERE attribute = 'adm_block_in_list'; +UPDATE provisioning.voip_preferences + SET description = 'Same as "block_in_clir" but may only be set by administrators and is applied prior to the user setting.' + WHERE attribute = 'adm_block_in_clir'; +UPDATE provisioning.voip_preferences + SET description = 'Same as "block_out_mode" but may only be set by administrators.' + WHERE attribute = 'adm_block_out_mode'; +UPDATE provisioning.voip_preferences + SET description = 'Same as "block_out_list" but may only be set by administrators and is applied prior to the user setting.' + WHERE attribute = 'adm_block_out_list'; +UPDATE provisioning.voip_preferences + SET description = 'E.164 number or complete SIP URI. "Call forward unconditional" - if set, all incoming calls are forwarded to this destination. E.164 numbers have to be fully qualified and may be prefixed by a plus sign. E.164 numbers specified in SIP URIs have to be prefixed by a plus sign if they are fully qualified but they must always carry the subscriber\'s own domain, like in "sip:+@".' + WHERE attribute = 'cfu'; +UPDATE provisioning.voip_preferences + SET description = 'E.164 number or complete SIP URI. "Call forward busy" - if set, all incoming calls are forwarded to this destination while the subscriber is on a call. Same syntax as for "cfu".' + WHERE attribute = 'cfb'; +UPDATE provisioning.voip_preferences + SET description = 'E.164 number or complete SIP URI. "Call forward not available" - if set, all incoming calls are forwarded to this destination if the subscriber is not online and registered. Same syntax as for "cfu".' + WHERE attribute = 'cfna'; +UPDATE provisioning.voip_preferences + SET description = 'E.164 number or complete SIP URI. "Call forward timeout" - if set, all incoming calls are forwarded to this destination after a timeout that can be set via "ringtimeout" below. Same syntax as for "cfu".' + WHERE attribute = 'cft'; +UPDATE provisioning.voip_preferences + SET description = 'Specifies how many seconds the system should wait before redirecting the call if "cft" is set.' + WHERE attribute = 'ringtimeout'; +UPDATE provisioning.voip_preferences + SET description = 'E.164 number or complete SIP URI. "Calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. Automatically set to the primary E.164 number specified in the subscriber details.' + WHERE attribute = 'cli'; +UPDATE provisioning.voip_preferences +SET description = '"Calling line identification restriction" - if set to true, the CLI is not displayed on outgoing calls.' + WHERE attribute = 'clir'; +UPDATE provisioning.voip_preferences + SET description = 'The country code that will be used for routing of dialed numbers without a country code. Defaults to the country code of the E.164 number if the subscriber has one.' + WHERE attribute = 'cc'; +UPDATE provisioning.voip_preferences +SET description = 'The area code that will be used for routing of dialed numbers without an area code. Defaults to the area code of the E.164 number if the subscriber has one.' + WHERE attribute = 'ac'; +UPDATE provisioning.voip_preferences + SET description = 'The area code that will be used for routing of dialed service numbers without an area code. Defaults to "ac".' + WHERE attribute = 'svc_ac'; +UPDATE provisioning.voip_preferences + SET description = 'The area code that will be used for routing of dialed emergency numbers without an area code. Defaults to "ac".' + WHERE attribute = 'emerg_ac'; +UPDATE provisioning.voip_preferences + SET internal = -1, + description = 'Specifies the NCOS level that applies to the user.' + WHERE attribute = 'ncos'; +UPDATE provisioning.voip_preferences + SET internal = -1, + description = 'Same as "ncos", but may only be set by administrators and is applied prior to the user setting.' + WHERE attribute = 'adm_ncos'; + +INSERT INTO provisioning.voip_preferences (attribute, type, data_type, max_occur, internal, description) + VALUES('ncos', 0, 'string', 1, -1, 'Specifies the NCOS level that applies to the user.'); +INSERT INTO provisioning.voip_preferences (attribute, type, data_type, max_occur, internal, description) + VALUES('adm_ncos', 0, 'string', 1, -1, 'Same as "ncos", but may only be set by administrators and is applied prior to the user setting.'); + diff --git a/db_scripts/base/4063.down b/db_scripts/base/4063.down new file mode 100644 index 00000000..098d845c --- /dev/null +++ b/db_scripts/base/4063.down @@ -0,0 +1 @@ +UPDATE provisioning.voip_preferences SET data_type = 'int' where attribute = 'lock'; diff --git a/db_scripts/base/4063.up b/db_scripts/base/4063.up new file mode 100644 index 00000000..cea36658 --- /dev/null +++ b/db_scripts/base/4063.up @@ -0,0 +1 @@ +UPDATE provisioning.voip_preferences SET data_type = 'string' where attribute = 'lock'; diff --git a/db_scripts/base/4085.down b/db_scripts/base/4085.down new file mode 100644 index 00000000..3a6745cd --- /dev/null +++ b/db_scripts/base/4085.down @@ -0,0 +1,7 @@ +DROP TRIGGER billing.bill_zones_crepl_trig; +DROP TRIGGER billing.bill_zones_urepl_trig; +DROP TRIGGER billing.bill_fees_crepl_trig; +DROP TRIGGER billing.bill_fees_urepl_trig; + +DROP TABLE billing.billing_zones_history; +DROP TABLE billing.billing_fees_history; diff --git a/db_scripts/base/4085.up b/db_scripts/base/4085.up new file mode 100644 index 00000000..0fc659c0 --- /dev/null +++ b/db_scripts/base/4085.up @@ -0,0 +1,100 @@ +-- do not run systems between r4085 and r4091, but upgrade further +-- there is no clean upgrade path if data is changed between these revisions + +CREATE TABLE `billing`.`billing_zones_history` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `bz_id` int(11) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NOT NULL, + `zone` varchar(127) NOT NULL, + `detail` varchar(127) NULL, + PRIMARY KEY (`id`), + KEY `bzid_idx` (`bz_id`), + CONSTRAINT `b_z_h_bzid_ref` FOREIGN KEY (`bz_id`) + REFERENCES `billing_zones` (`id`) + ON DELETE SET NULL ON UPDATE NO ACTION +) ENGINE=InnoDB; + +DELIMITER | + +CREATE TRIGGER billing.bill_zones_crepl_trig AFTER INSERT ON billing_zones + FOR EACH ROW BEGIN + + INSERT INTO billing_zones_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, NEW.zone, NEW.detail); + + END; +| + +CREATE TRIGGER billing.bill_zones_urepl_trig AFTER UPDATE ON billing_zones + FOR EACH ROW BEGIN + + UPDATE billing_zones_history + SET bz_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + zone = NEW.zone, detail = NEW.detail + WHERE bz_id = OLD.id; + + END; +| + +DELIMITER ; + +INSERT INTO billing.billing_zones_history + SELECT billing_zones.id, billing_zones.* FROM billing.billing_zones; + +CREATE TABLE `billing`.`billing_fees_history` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `bf_id` int(11) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NOT NULL, + `billing_zone_id` int(11) UNSIGNED NULL, + `destination` varchar(255) NOT NULL, + `type` enum('call', 'sms') NOT NULL DEFAULT 'call', + `onpeak_init_rate` double NOT NULL DEFAULT 0, + `onpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `onpeak_follow_rate` double NOT NULL DEFAULT 0, + `onpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_init_rate` double NOT NULL DEFAULT 0, + `offpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_follow_rate` double NOT NULL DEFAULT 0, + `offpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `use_free_time` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + KEY `bfid_idx` (`bf_id`), + CONSTRAINT `b_f_h_bfid_ref` FOREIGN KEY (`bf_id`) + REFERENCES `billing_fees` (`id`) + ON DELETE SET NULL ON UPDATE NO ACTION +) ENGINE=InnoDB; + +DELIMITER | + +CREATE TRIGGER billing.bill_fees_crepl_trig AFTER INSERT ON billing_fees + FOR EACH ROW BEGIN + + INSERT INTO billing_fees_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, NEW.billing_zone_id, NEW.destination, + NEW.type, NEW.onpeak_init_rate, NEW.onpeak_init_interval, NEW.onpeak_follow_rate, + NEW.onpeak_follow_interval, NEW.offpeak_init_rate, NEW.offpeak_init_interval, + NEW.offpeak_follow_rate, NEW.offpeak_follow_interval, NEW.use_free_time); + + END; +| + +CREATE TRIGGER billing.bill_fees_urepl_trig AFTER UPDATE ON billing_fees + FOR EACH ROW BEGIN + + UPDATE billing_fees_history + SET bf_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + billing_zone_id = NEW.billing_zone_id, destination = NEW.destination, type = NEW.type, + onpeak_init_rate = NEW.onpeak_init_rate, onpeak_init_interval = NEW.onpeak_init_interval, + onpeak_follow_rate = NEW.onpeak_follow_rate, onpeak_follow_interval = NEW.onpeak_follow_interval, + offpeak_init_rate = NEW.offpeak_init_rate, offpeak_init_interval = NEW.offpeak_init_interval, + offpeak_follow_rate = NEW.offpeak_follow_rate, offpeak_follow_interval = NEW.offpeak_follow_interval, + use_free_time = NEW.use_free_time + WHERE bf_id = OLD.id; + + END; +| + +DELIMITER ; + +INSERT INTO billing.billing_fees_history + SELECT billing_fees.id, billing_fees.* FROM billing.billing_fees; diff --git a/db_scripts/base/4095.down b/db_scripts/base/4095.down new file mode 100644 index 00000000..0712ed7d --- /dev/null +++ b/db_scripts/base/4095.down @@ -0,0 +1,41 @@ +-- this script does not change table data, as there is no reliable method +-- to determine the correct values for `billing_zone_id` +-- do not run systems between r4085 and r4091, but downgrade further + +ALTER TABLE billing.billing_fees_history CHANGE COLUMN `billing_zones_history_id` `billing_zone_id` int(11) UNSIGNED NULL; + +DROP TRIGGER billing.bill_fees_crepl_trig; +DROP TRIGGER billing.bill_fees_urepl_trig; + +DELIMITER | + +CREATE TRIGGER billing.bill_fees_crepl_trig AFTER INSERT ON billing_fees + FOR EACH ROW BEGIN + + INSERT INTO billing_fees_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, NEW.billing_zone_id, NEW.destination, + NEW.type, NEW.onpeak_init_rate, NEW.onpeak_init_interval, NEW.onpeak_follow_rate, + NEW.onpeak_follow_interval, NEW.offpeak_init_rate, NEW.offpeak_init_interval, + NEW.offpeak_follow_rate, NEW.offpeak_follow_interval, NEW.use_free_time); + + END; +| + +CREATE TRIGGER billing.bill_fees_urepl_trig AFTER UPDATE ON billing_fees + FOR EACH ROW BEGIN + + UPDATE billing_fees_history + SET bf_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + billing_zone_id = NEW.billing_zone_id, destination = NEW.destination, type = NEW.type, + onpeak_init_rate = NEW.onpeak_init_rate, onpeak_init_interval = NEW.onpeak_init_interval, + onpeak_follow_rate = NEW.onpeak_follow_rate, onpeak_follow_interval = NEW.onpeak_follow_interval, + offpeak_init_rate = NEW.offpeak_init_rate, offpeak_init_interval = NEW.offpeak_init_interval, + offpeak_follow_rate = NEW.offpeak_follow_rate, offpeak_follow_interval = NEW.offpeak_follow_interval, + use_free_time = NEW.use_free_time + WHERE bf_id = OLD.id; + + END; +| + +DELIMITER ; + diff --git a/db_scripts/base/4095.up b/db_scripts/base/4095.up new file mode 100644 index 00000000..123fb5eb --- /dev/null +++ b/db_scripts/base/4095.up @@ -0,0 +1,47 @@ +-- this script does not change table data, as there is no reliable method +-- to determine the correct values for `billing_zones_history_id` +-- do not run systems between r4085 and r4091 + +ALTER TABLE billing.billing_fees_history CHANGE COLUMN `billing_zone_id` `billing_zones_history_id` int(11) UNSIGNED NULL; + +DROP TRIGGER billing.bill_fees_crepl_trig; +DROP TRIGGER billing.bill_fees_urepl_trig; + +DELIMITER | + +CREATE TRIGGER billing.bill_fees_crepl_trig AFTER INSERT ON billing_fees + FOR EACH ROW BEGIN + DECLARE my_bzh_id int UNSIGNED; + + SELECT id INTO my_bzh_id FROM billing_zones_history WHERE bz_id = NEW.billing_zone_id; + + INSERT INTO billing_fees_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, my_bzh_id, NEW.destination, + NEW.type, NEW.onpeak_init_rate, NEW.onpeak_init_interval, NEW.onpeak_follow_rate, + NEW.onpeak_follow_interval, NEW.offpeak_init_rate, NEW.offpeak_init_interval, + NEW.offpeak_follow_rate, NEW.offpeak_follow_interval, NEW.use_free_time); + + END; +| + +CREATE TRIGGER billing.bill_fees_urepl_trig AFTER UPDATE ON billing_fees + FOR EACH ROW BEGIN + DECLARE my_bzh_id int UNSIGNED; + + SELECT id INTO my_bzh_id FROM billing_zones_history WHERE bz_id = NEW.billing_zone_id; + + UPDATE billing_fees_history + SET bf_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + billing_zones_history_id = my_bzh_id, destination = NEW.destination, type = NEW.type, + onpeak_init_rate = NEW.onpeak_init_rate, onpeak_init_interval = NEW.onpeak_init_interval, + onpeak_follow_rate = NEW.onpeak_follow_rate, onpeak_follow_interval = NEW.onpeak_follow_interval, + offpeak_init_rate = NEW.offpeak_init_rate, offpeak_init_interval = NEW.offpeak_init_interval, + offpeak_follow_rate = NEW.offpeak_follow_rate, offpeak_follow_interval = NEW.offpeak_follow_interval, + use_free_time = NEW.use_free_time + WHERE bf_id = OLD.id; + + END; +| + +DELIMITER ; + diff --git a/db_scripts/base/4112.down b/db_scripts/base/4112.down new file mode 100644 index 00000000..d540dde3 --- /dev/null +++ b/db_scripts/base/4112.down @@ -0,0 +1,3 @@ +ALTER TABLE accounting.cdr MODIFY COLUMN `carrier_cost` float default NULL; +ALTER TABLE accounting.cdr MODIFY COLUMN `reseller_cost` float default NULL; +ALTER TABLE accounting.cdr MODIFY COLUMN `customer_cost` float default NULL; diff --git a/db_scripts/base/4112.up b/db_scripts/base/4112.up new file mode 100644 index 00000000..430d4ac4 --- /dev/null +++ b/db_scripts/base/4112.up @@ -0,0 +1,3 @@ +ALTER TABLE accounting.cdr MODIFY COLUMN `carrier_cost` decimal(10,2) default NULL; +ALTER TABLE accounting.cdr MODIFY COLUMN `reseller_cost` decimal(10,2) default NULL; +ALTER TABLE accounting.cdr MODIFY COLUMN `customer_cost` decimal(10,2) default NULL; diff --git a/db_scripts/base/4145.down b/db_scripts/base/4145.down new file mode 100644 index 00000000..af3a0e30 --- /dev/null +++ b/db_scripts/base/4145.down @@ -0,0 +1 @@ +ALTER TABLE billing.billing_profiles MODIFY COLUMN `prepaid` bool NOT NULL DEFAULT TRUE; diff --git a/db_scripts/base/4145.up b/db_scripts/base/4145.up new file mode 100644 index 00000000..f9af7db5 --- /dev/null +++ b/db_scripts/base/4145.up @@ -0,0 +1 @@ +ALTER TABLE billing.billing_profiles MODIFY COLUMN `prepaid` bool NOT NULL DEFAULT FALSE; diff --git a/db_scripts/base/4496.down b/db_scripts/base/4496.down new file mode 100644 index 00000000..285471ba --- /dev/null +++ b/db_scripts/base/4496.down @@ -0,0 +1,2 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute = 'block_out_override_pin'; +DELETE FROM provisioning.voip_preferences WHERE attribute = 'adm_block_out_override_pin'; diff --git a/db_scripts/base/4496.up b/db_scripts/base/4496.up new file mode 100644 index 00000000..6c275f8f --- /dev/null +++ b/db_scripts/base/4496.up @@ -0,0 +1,8 @@ +INSERT INTO provisioning.voip_preferences + (attribute, type, data_type, max_occur, description) + VALUES('block_out_override_pin', 0, 'string', 1, + 'A PIN code which may be used in a VSC to disable the outgoing user block list and NCOS level for a call.'); +INSERT INTO provisioning.voip_preferences + (attribute, type, data_type, max_occur, description) + VALUES('adm_block_out_override_pin', 0, 'string', 1, + 'Same as "block_out_override_pin" but additionally disables the administrative block list and NCOS level.'); diff --git a/db_scripts/base/4665.down b/db_scripts/base/4665.down new file mode 100644 index 00000000..ddeab475 --- /dev/null +++ b/db_scripts/base/4665.down @@ -0,0 +1,2 @@ +ALTER TABLE billing.voip_numbers MODIFY COLUMN `ac` int(5) UNSIGNED NOT NULL; +ALTER TABLE billing.voip_number_blocks MODIFY COLUMN `ac` int(5) UNSIGNED NOT NULL; diff --git a/db_scripts/base/4665.up b/db_scripts/base/4665.up new file mode 100644 index 00000000..4c91b000 --- /dev/null +++ b/db_scripts/base/4665.up @@ -0,0 +1,2 @@ +ALTER TABLE billing.voip_numbers MODIFY COLUMN `ac` varchar(7) NOT NULL; +ALTER TABLE billing.voip_number_blocks MODIFY COLUMN `ac` varchar(7) NOT NULL; diff --git a/db_scripts/base/4668.down b/db_scripts/base/4668.down new file mode 100644 index 00000000..a0e0140d --- /dev/null +++ b/db_scripts/base/4668.down @@ -0,0 +1,5 @@ +DELETE FROM provisioning.voip_preferences WHERE peer_pref = 1; + +ALTER TABLE provisioning.voip_preferences DROP COLUMN `usr_pref`; +ALTER TABLE provisioning.voip_preferences DROP COLUMN `dom_pref`; +ALTER TABLE provisioning.voip_preferences DROP COLUMN `peer_pref`; diff --git a/db_scripts/base/4668.up b/db_scripts/base/4668.up new file mode 100644 index 00000000..832e1e9a --- /dev/null +++ b/db_scripts/base/4668.up @@ -0,0 +1,11 @@ +ALTER TABLE provisioning.voip_preferences ADD COLUMN `usr_pref` bool NOT NULL default FALSE AFTER `max_occur`; +ALTER TABLE provisioning.voip_preferences ADD COLUMN `dom_pref` bool NOT NULL default FALSE AFTER `usr_pref`; +ALTER TABLE provisioning.voip_preferences ADD COLUMN `peer_pref` bool NOT NULL default FALSE AFTER `dom_pref`; + +UPDATE provisioning.voip_preferences SET usr_pref = 1 WHERE attribute NOT LIKE 'dp_dom_%'; +UPDATE provisioning.voip_preferences SET dom_pref = 1 WHERE attribute LIKE 'dp_dom_%'; + +INSERT INTO provisioning.voip_preferences (attribute, type, peer_pref, data_type, max_occur, description) + VALUES('auth_user', 0, 1, 'string', 1, 'A username used for authentication against the peer host.'); +INSERT INTO provisioning.voip_preferences (attribute, type, peer_pref, data_type, max_occur, description) + VALUES('auth_pass', 0, 1, 'string', 1, 'A password used for authentication against the peer host.'); diff --git a/db_scripts/base/4701.down b/db_scripts/base/4701.down new file mode 100644 index 00000000..2751eeb8 --- /dev/null +++ b/db_scripts/base/4701.down @@ -0,0 +1,161 @@ +CREATE TABLE `kamailio`.`gw` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `gw_name` varchar(128) NOT NULL, + `grp_id` int(10) unsigned NOT NULL, + `ip_addr` varchar(15) NOT NULL, + `hostname` varchar(64) DEFAULT NULL, + `port` smallint(5) unsigned DEFAULT NULL, + `uri_scheme` tinyint(3) unsigned DEFAULT NULL, + `transport` tinyint(3) unsigned DEFAULT NULL, + `strip` tinyint(3) unsigned DEFAULT NULL, + `tag` varchar(16) DEFAULT NULL, + `weight` int(10) unsigned DEFAULT NULL, + `flags` int(10) unsigned NOT NULL DEFAULT '0', + `defunct` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `lcr_id_grp_id_gw_name_idx` (`lcr_id`,`grp_id`,`gw_name`), + UNIQUE KEY `lcr_id_grp_id_ip_addr_idx` (`lcr_id`,`grp_id`,`ip_addr`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `kamailio`.`lcr` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `prefix` varchar(16) DEFAULT NULL, + `from_uri` varchar(64) DEFAULT NULL, + `grp_id` int(10) unsigned NOT NULL, + `priority` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `lcr_id_idx` (`lcr_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +USE provisioning; + +DROP trigger voip_prul_crepl_trig; +DROP trigger voip_prul_urepl_trig; +DROP trigger voip_prul_drepl_trig; +DROP trigger voip_pgrp_urepl_trig; +DROP trigger voip_pgrp_drepl_trig; +DROP trigger voip_phost_crepl_trig; +DROP trigger voip_phost_urepl_trig; +DROP trigger voip_phost_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_prul_crepl_trig AFTER INSERT ON voip_peer_rules + FOR EACH ROW BEGIN + DECLARE prio int(11) unsigned; + + SELECT priority INTO prio FROM voip_peer_groups + WHERE id = NEW.group_id; + + INSERT INTO kamailio.lcr (lcr_id, prefix, from_uri, grp_id, priority) + VALUES(1, NEW.callee_prefix, IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), ''), NEW.group_id, prio); + + END; +| + +CREATE TRIGGER voip_prul_urepl_trig AFTER UPDATE ON voip_peer_rules + FOR EACH ROW BEGIN + DECLARE prio int(11) unsigned; + + SELECT priority INTO prio FROM voip_peer_groups + WHERE id = NEW.group_id; + + UPDATE kamailio.lcr SET prefix = NEW.callee_prefix, + from_uri = IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), '') + WHERE grp_id = OLD.group_id + AND prefix = OLD.callee_prefix + AND from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') + AND priority = prio; + + END; +| + +CREATE TRIGGER voip_pgrp_urepl_trig AFTER UPDATE ON voip_peer_groups + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr SET priority = NEW.priority + WHERE grp_id = NEW.id; + + END; +| + +CREATE TRIGGER voip_prul_drepl_trig AFTER DELETE ON voip_peer_rules + FOR EACH ROW BEGIN + DECLARE prio int(11) unsigned; + + SELECT priority INTO prio FROM voip_peer_groups + WHERE id = OLD.group_id; + + DELETE FROM kamailio.lcr + WHERE grp_id = OLD.group_id AND + prefix = OLD.callee_prefix AND + from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') AND + priority = prio; + + END; +| + +CREATE TRIGGER voip_pgrp_drepl_trig AFTER DELETE ON voip_peer_groups + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr WHERE grp_id = OLD.id; + DELETE FROM kamailio.gw WHERE grp_id = OLD.id; + + END; +| + +CREATE TRIGGER voip_phost_crepl_trig AFTER INSERT ON voip_peer_hosts + FOR EACH ROW BEGIN + + INSERT INTO kamailio.gw (lcr_id, gw_name, grp_id, ip_addr, port, weight, + uri_scheme, transport, strip, tag, flags, defunct) VALUES + (1, NEW.name, NEW.group_id, NEW.ip, NEW.port, NEW.weight, + 1, 1, 0, NULL, NEW.id, NULL); + + END; +| + +CREATE TRIGGER voip_phost_urepl_trig AFTER UPDATE ON voip_peer_hosts + FOR EACH ROW BEGIN + + UPDATE kamailio.gw SET gw_name = NEW.name, + ip_addr = NEW.ip, port = NEW.port, weight = NEW.weight, tag = NULL + WHERE grp_id = OLD.group_id AND gw_name = OLD.name AND + ip_addr = OLD.ip AND port = OLD.port AND weight = OLD.weight; + + END; +| + +CREATE TRIGGER voip_phost_drepl_trig AFTER DELETE ON voip_peer_hosts + FOR EACH ROW BEGIN + + DELETE FROM kamailio.gw + WHERE grp_id = OLD.group_id AND gw_name = OLD.name AND + ip_addr = OLD.ip AND port = OLD.port AND weight = OLD.weight; + DELETE FROM kamailio.dialplan + WHERE dpid IN (OLD.dp_caller_in_id, OLD.dp_callee_in_id, + OLD.dp_caller_out_id, OLD.dp_callee_out_id); + + END; +| + +DELIMITER ; + +USE kamailio; + +INSERT INTO gw (lcr_id, gw_name, grp_id, ip_addr, port, weight, + uri_scheme, transport, strip, flags) + SELECT 1, name, group_id, ip, port, weight, 1, 1, 0, id + FROM provisioning.voip_peer_hosts; + +INSERT INTO lcr (lcr_id, prefix, from_uri, grp_id, priority) + SELECT 1, callee_prefix, IF(LENGTH(caller_prefix), CONCAT('^', caller_prefix), ''), group_id, priority + FROM provisioning.voip_peer_rules vph + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = vph.group_id; + +DROP table lcr_rule_target; +DROP table lcr_rule; +DROP table lcr_gw; + diff --git a/db_scripts/base/4701.up b/db_scripts/base/4701.up new file mode 100644 index 00000000..d42c246e --- /dev/null +++ b/db_scripts/base/4701.up @@ -0,0 +1,201 @@ +CREATE TABLE `kamailio`.`lcr_gw` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `gw_name` varchar(128) NOT NULL, + `ip_addr` varchar(15) NOT NULL, + `hostname` varchar(64) DEFAULT NULL, + `port` smallint(5) unsigned DEFAULT NULL, + `params` varchar(64) DEFAULT NULL, + `uri_scheme` tinyint(3) unsigned DEFAULT NULL, + `transport` tinyint(3) unsigned DEFAULT NULL, + `strip` tinyint(3) unsigned DEFAULT NULL, + `tag` varchar(16) DEFAULT NULL, + `flags` int(10) unsigned NOT NULL DEFAULT '0', + `defunct` int(10) unsigned DEFAULT NULL, + `group_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `lcr_id_gw_name_idx` (`lcr_id`,`gw_name`), + UNIQUE KEY `lcr_id_ip_addr_idx` (`lcr_id`,`ip_addr`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `kamailio`.`lcr_rule` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `prefix` varchar(16) DEFAULT NULL, + `from_uri` varchar(64) DEFAULT NULL, + `stopper` int(10) unsigned NOT NULL DEFAULT '0', + `enabled` int(10) unsigned NOT NULL DEFAULT '1', + `group_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `lcr_id_idx` (`lcr_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `kamailio`.`lcr_rule_target` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `rule_id` int(10) unsigned NOT NULL, + `gw_id` int(10) unsigned NOT NULL, + `priority` tinyint(3) unsigned NOT NULL, + `weight` int(10) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `rule_id_gw_id_idx` (`rule_id`,`gw_id`), + KEY `lcr_id_idx` (`lcr_id`), + KEY `gw_id_idx` (`gw_id`), + CONSTRAINT `l_r_t_ruleid_ref` FOREIGN KEY (`rule_id`) + REFERENCES `lcr_rule` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `l_r_t_gwid_ref` FOREIGN KEY (`gw_id`) + REFERENCES `lcr_gw` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + +USE provisioning; + +DROP trigger voip_prul_crepl_trig; +DROP trigger voip_prul_urepl_trig; +DROP trigger voip_prul_drepl_trig; +DROP trigger voip_pgrp_urepl_trig; +DROP trigger voip_pgrp_drepl_trig; +DROP trigger voip_phost_crepl_trig; +DROP trigger voip_phost_urepl_trig; +DROP trigger voip_phost_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_prul_crepl_trig AFTER INSERT ON voip_peer_rules + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_rule (lcr_id, prefix, from_uri, stopper, enabled, group_id) + VALUES(1, NEW.callee_prefix, + IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), ''), + 0, 1, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT gw.lcr_id, LAST_INSERT_ID(), gw.id, vpg.priority, vph.weight + FROM kamailio.lcr_gw gw + INNER JOIN provisioning.voip_peer_hosts vph ON vph.ip = gw.ip_addr + AND gw.lcr_id = 1 + AND vph.group_id = gw.group_id + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = vph.group_id + WHERE vph.group_id = NEW.group_id; + + END; +| + +CREATE TRIGGER voip_prul_urepl_trig AFTER UPDATE ON voip_peer_rules + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_rule + SET prefix = NEW.callee_prefix, + from_uri = IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), '') + WHERE prefix = OLD.callee_prefix + AND from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') + AND group_id = OLD.group_id; + + END; +| + +CREATE TRIGGER voip_prul_drepl_trig AFTER DELETE ON voip_peer_rules + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_rule + WHERE prefix = OLD.callee_prefix + AND from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') + AND group_id = OLD.group_id; + + -- foreign key will delete from kamailio.lcr_rule_target + + END; +| + +CREATE TRIGGER voip_pgrp_urepl_trig AFTER UPDATE ON voip_peer_groups + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_rule_target rt, kamailio.lcr_gw gw + SET rt.priority = NEW.priority + WHERE gw.id = rt.gw_id + AND gw.lcr_id = 1 + AND gw.group_id = NEW.id; + + END; +| + +CREATE TRIGGER voip_pgrp_drepl_trig AFTER DELETE ON voip_peer_groups + FOR EACH ROW BEGIN + + DELETE kamailio.rule, kamailio.gw FROM kamailio.lcr_rule rule, kamailio.lcr_gw gw + WHERE rule.group_id = OLD.id and gw.group_id = OLD.id; + + END; +| + +CREATE TRIGGER voip_phost_crepl_trig AFTER INSERT ON voip_peer_hosts + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_gw (lcr_id, gw_name, ip_addr, port, uri_scheme, transport, strip, flags, group_id) + VALUES(1, NEW.name, NEW.ip, NEW.port, 1, 1, 0, NEW.id, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT rule.lcr_id, rule.id, LAST_INSERT_ID(), vpg.priority, NEW.weight + FROM kamailio.lcr_rule rule + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = rule.group_id + WHERE vpg.id = NEW.group_id; + + END; +| + +CREATE TRIGGER voip_phost_urepl_trig AFTER UPDATE ON voip_peer_hosts + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_gw + SET gw_name = NEW.name, ip_addr = NEW.ip, port = NEW.port, flags = NEW.id + WHERE lcr_id = 1 AND ip_addr = OLD.ip; + + UPDATE kamailio.lcr_rule_target rt, kamailio.lcr_gw gw + SET rt.weight = NEW.weight + WHERE gw.id = rt.gw_id + AND gw.lcr_id = 1 + AND gw.group_id = NEW.group_id + AND gw.ip_addr = NEW.ip; + + END; +| + +CREATE TRIGGER voip_phost_drepl_trig AFTER DELETE ON voip_peer_hosts + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_gw + WHERE lcr_id = 1 + AND group_id = OLD.group_id + AND ip_addr = OLD.ip; + + -- foreign key will delete from kamailio.lcr_rule_target + + END; +| + +DELIMITER ; + +USE kamailio; + +INSERT INTO lcr_rule (lcr_id, prefix, from_uri, stopper, enabled, group_id) + SELECT 1, callee_prefix, + IF(LENGTH(caller_prefix), CONCAT('^', caller_prefix), ''), + 0, 1, group_id + FROM provisioning.voip_peer_rules; + +INSERT INTO lcr_gw (lcr_id, gw_name, ip_addr, port, uri_scheme, transport, strip, flags, group_id) + SELECT 1, name, ip, port, 1, 1, 0, id, group_id + FROM provisioning.voip_peer_hosts; + +INSERT INTO lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT rule.lcr_id, rule.id, gw.id, vpg.priority, vph.weight + FROM kamailio.lcr_rule rule + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = rule.group_id + INNER JOIN provisioning.voip_peer_hosts vph ON vpg.id = vph.group_id + INNER JOIN lcr_gw gw ON gw.ip_addr = vph.ip AND gw.lcr_id = 1; + +DROP table lcr; +DROP table gw; + diff --git a/db_scripts/base/4711.down b/db_scripts/base/4711.down new file mode 100644 index 00000000..21299a66 --- /dev/null +++ b/db_scripts/base/4711.down @@ -0,0 +1,4 @@ +INSERT INTO kamailio.version (table_name, table_version) VALUES ('gw',10); +INSERT INTO kamailio.version (table_name, table_version) VALUES ('lcr',3); + +DELETE FROM kamailio.version WHERE table_name = 'lcr_gw' OR table_name = 'lcr_rule' OR table_name = 'lcr_rule_target'; diff --git a/db_scripts/base/4711.up b/db_scripts/base/4711.up new file mode 100644 index 00000000..748dcfe4 --- /dev/null +++ b/db_scripts/base/4711.up @@ -0,0 +1,6 @@ +INSERT INTO kamailio.version (table_name, table_version) VALUES ('lcr_gw',1); +INSERT INTO kamailio.version (table_name, table_version) VALUES ('lcr_rule_target',1); +INSERT INTO kamailio.version (table_name, table_version) VALUES ('lcr_rule',1); + +DELETE FROM kamailio.version WHERE table_name = 'gw' OR table_name = 'lcr'; + diff --git a/db_scripts/base/4712.down b/db_scripts/base/4712.down new file mode 100644 index 00000000..0c44a807 --- /dev/null +++ b/db_scripts/base/4712.down @@ -0,0 +1,3 @@ +ALTER TABLE kamailio.address DROP COLUMN `tag`; + +UPDATE kamailio.version SET table_version = 3 WHERE table_name = 'address'; diff --git a/db_scripts/base/4712.up b/db_scripts/base/4712.up new file mode 100644 index 00000000..f7ef4421 --- /dev/null +++ b/db_scripts/base/4712.up @@ -0,0 +1,3 @@ +ALTER TABLE kamailio.address ADD COLUMN `tag` VARCHAR(64) default NULL; + +UPDATE kamailio.version SET table_version = 4 WHERE table_name = 'address'; diff --git a/db_scripts/base/4717.down b/db_scripts/base/4717.down new file mode 100644 index 00000000..51773bf9 --- /dev/null +++ b/db_scripts/base/4717.down @@ -0,0 +1,5 @@ +DELETE FROM provisioning.xmlgroups WHERE name = 'proxy-ng'; + +DELETE FROM provisioning.xmlhosts WHERE description = 'Kamailio-SR'; + +DELETE FROM provisioning.xmlhostgroups WHERE group_id = 6 and host_id = 3; diff --git a/db_scripts/base/4717.up b/db_scripts/base/4717.up new file mode 100644 index 00000000..7e01eb17 --- /dev/null +++ b/db_scripts/base/4717.up @@ -0,0 +1,5 @@ +INSERT INTO provisioning.xmlgroups (id, name) VALUES(6, 'proxy-ng'); + +INSERT INTO provisioning.xmlhosts (id, ip, port, path, description) VALUES (3,'127.0.0.1','5062','/','Kamailio-SR'); + +INSERT INTO provisioning.xmlhostgroups (id, group_id, host_id) VALUES (3,6,3); diff --git a/db_scripts/base/4735.down b/db_scripts/base/4735.down new file mode 100644 index 00000000..6a2d7df9 --- /dev/null +++ b/db_scripts/base/4735.down @@ -0,0 +1 @@ +alter table kamailio.dialplan change column repl_exp `repl_exp` varchar(32) NOT NULL; diff --git a/db_scripts/base/4735.up b/db_scripts/base/4735.up new file mode 100644 index 00000000..630b2cee --- /dev/null +++ b/db_scripts/base/4735.up @@ -0,0 +1 @@ +alter table kamailio.dialplan change column repl_exp `repl_exp` varchar(64) NOT NULL; diff --git a/db_scripts/base/4762.down b/db_scripts/base/4762.down new file mode 100644 index 00000000..188e9a54 --- /dev/null +++ b/db_scripts/base/4762.down @@ -0,0 +1,6 @@ +DROP TRIGGER `provisioning`.`voip_peerpref_crepl_trig`; +DROP TRIGGER `provisioning`.`voip_peerpref_urepl_trig`; +DROP TRIGGER `provisioning`.`voip_peerpref_drepl_trig`; + +DROP TABLE `provisioning`.`voip_peer_preferences`; +DROP TABLE `kamailio`.`peer_preferences`; diff --git a/db_scripts/base/4762.up b/db_scripts/base/4762.up new file mode 100644 index 00000000..ee85687c --- /dev/null +++ b/db_scripts/base/4762.up @@ -0,0 +1,69 @@ +CREATE TABLE `provisioning`.`voip_peer_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `peer_host_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_peer_hosts` (`id`), + `attribute_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_preferences` (`id`), + `value` varchar(255) NOT NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `peerhostid_idx` (`peer_host_id`), + KEY `attributeid_idx` (`attribute_id`), + CONSTRAINT `v_p_p_peerhostid_ref` FOREIGN KEY (`peer_host_id`) + REFERENCES `voip_peer_hosts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_p_p_attributeid_ref` FOREIGN KEY (`attribute_id`) + REFERENCES `voip_preferences` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `kamailio`.`peer_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + +USE provisioning; + +DELIMITER | + +CREATE TRIGGER voip_peerpref_crepl_trig AFTER INSERT ON voip_peer_preferences + FOR EACH ROW BEGIN + + INSERT INTO kamailio.peer_preferences + (id, uuid, attribute, type, value, last_modified) + SELECT NEW.id, NEW.peer_host_id, attribute, type, NEW.value, NOW() + FROM provisioning.voip_preferences + WHERE id = NEW.attribute_id; + + END; +| + +CREATE TRIGGER voip_peerpref_urepl_trig AFTER UPDATE ON voip_peer_preferences + FOR EACH ROW BEGIN + + UPDATE kamailio.peer_preferences pp, provisioning.voip_preferences vp + SET pp.id = NEW.id, pp.uuid = NEW.peer_host_id, pp.type = vp.type, + pp.attribute = vp.attribute, pp.value = NEW.value, pp.last_modified = NOW() + WHERE pp.id = OLD.id + AND vp.id = NEW.attribute_id; + + END; +| + +CREATE TRIGGER voip_peerpref_drepl_trig BEFORE DELETE ON voip_peer_preferences + FOR EACH ROW BEGIN + + DELETE FROM kamailio.peer_preferences + WHERE id = OLD.id; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/4832.down b/db_scripts/base/4832.down new file mode 100644 index 00000000..ce5aa7ee --- /dev/null +++ b/db_scripts/base/4832.down @@ -0,0 +1,7 @@ +UPDATE provisioning.voip_preferences + SET attribute = 'auth_user', usr_pref = 0 + WHERE attribute = 'peer_auth_user'; + +UPDATE provisioning.voip_preferences + SET attribute = 'auth_pass', usr_pref = 0 + WHERE attribute = 'peer_auth_pass'; diff --git a/db_scripts/base/4832.up b/db_scripts/base/4832.up new file mode 100644 index 00000000..0d02bd7d --- /dev/null +++ b/db_scripts/base/4832.up @@ -0,0 +1,7 @@ +UPDATE provisioning.voip_preferences + SET attribute = 'peer_auth_user', usr_pref = 1 + WHERE attribute = 'auth_user'; + +UPDATE provisioning.voip_preferences + SET attribute = 'peer_auth_pass', usr_pref = 1 + WHERE attribute = 'auth_pass'; diff --git a/db_scripts/base/4875.down b/db_scripts/base/4875.down new file mode 100644 index 00000000..3c26af80 --- /dev/null +++ b/db_scripts/base/4875.down @@ -0,0 +1 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute='unauth_inbound_calls'; diff --git a/db_scripts/base/4875.up b/db_scripts/base/4875.up new file mode 100644 index 00000000..f5f7d099 --- /dev/null +++ b/db_scripts/base/4875.up @@ -0,0 +1 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, data_type, max_occur, description) VALUES('unauth_inbound_calls', 1, 1, 'boolean', 1, 'Allow unauthenticated inbound calls from FOREIGN domain to users within this domain. Use with care - it allows to flood your users with voice spam.'); diff --git a/db_scripts/base/4968.down b/db_scripts/base/4968.down new file mode 100644 index 00000000..bf5b4c7f --- /dev/null +++ b/db_scripts/base/4968.down @@ -0,0 +1 @@ +alter table provisioning.xmlhosts drop column sip_port; diff --git a/db_scripts/base/4968.up b/db_scripts/base/4968.up new file mode 100644 index 00000000..1f8194ca --- /dev/null +++ b/db_scripts/base/4968.up @@ -0,0 +1,2 @@ +alter table provisioning.xmlhosts add column sip_port int(5) unsigned default NULL after path; +update provisioning.xmlhosts set sip_port = 5062 where id = 1; diff --git a/db_scripts/base/4984.down b/db_scripts/base/4984.down new file mode 100644 index 00000000..68e3754b --- /dev/null +++ b/db_scripts/base/4984.down @@ -0,0 +1 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute = 'peer_auth_realm'; diff --git a/db_scripts/base/4984.up b/db_scripts/base/4984.up new file mode 100644 index 00000000..531f8c00 --- /dev/null +++ b/db_scripts/base/4984.up @@ -0,0 +1,2 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, usr_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_realm', 0, 1, 1, 'string', 1, 'A realm used for authentication against the peer host.'); diff --git a/db_scripts/base/5249.down b/db_scripts/base/5249.down new file mode 100644 index 00000000..a1d51a23 --- /dev/null +++ b/db_scripts/base/5249.down @@ -0,0 +1,2 @@ +ALTER TABLE kamailio.voicemail_spool CHANGE COLUMN origtime origtime INT(11) UNSIGNED DEFAULT '0'; +ALTER TABLE kamailio.voicemail_spool CHANGE COLUMN duration duration INT(11) UNSIGNED DEFAULT '0'; diff --git a/db_scripts/base/5249.up b/db_scripts/base/5249.up new file mode 100644 index 00000000..fb573221 --- /dev/null +++ b/db_scripts/base/5249.up @@ -0,0 +1,2 @@ +ALTER TABLE kamailio.voicemail_spool CHANGE COLUMN origtime origtime VARCHAR(16) DEFAULT ''; +ALTER TABLE kamailio.voicemail_spool CHANGE COLUMN duration duration VARCHAR(16) DEFAULT ''; diff --git a/db_scripts/base/5283.down b/db_scripts/base/5283.down new file mode 100644 index 00000000..cbff9226 --- /dev/null +++ b/db_scripts/base/5283.down @@ -0,0 +1 @@ +DROP TABLE kamailio.sems_registrations; diff --git a/db_scripts/base/5283.up b/db_scripts/base/5283.up new file mode 100644 index 00000000..9a8a0cd5 --- /dev/null +++ b/db_scripts/base/5283.up @@ -0,0 +1,10 @@ +CREATE TABLE kamailio.sems_registrations ( + `subscriber_id` int(11) NOT NULL, + `registration_status` tinyint(1) NOT NULL DEFAULT '0', + `last_registration` datetime DEFAULT NULL, + `expiry` datetime DEFAULT NULL, + `last_code` smallint(2) DEFAULT NULL, + `last_reason` varchar(256) DEFAULT NULL, + `contacts` varchar(512) DEFAULT NULL, + PRIMARY KEY (`subscriber_id`) +) ENGINE=InnoDB; diff --git a/db_scripts/base/5300.down b/db_scripts/base/5300.down new file mode 100644 index 00000000..9eb9f136 --- /dev/null +++ b/db_scripts/base/5300.down @@ -0,0 +1 @@ +DROP DATABASE carrier; diff --git a/db_scripts/base/5300.up b/db_scripts/base/5300.up new file mode 100644 index 00000000..09fe2417 --- /dev/null +++ b/db_scripts/base/5300.up @@ -0,0 +1,90 @@ +USE mysql; + +CREATE DATABASE carrier CHARACTER SET 'utf8'; + +USE carrier; + +CREATE TABLE `customers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `url` varchar(31) NOT NULL, + `shopuser` varchar(31) NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `shopuser_idx` (`shopuser`) +) ENGINE=InnoDB; + +CREATE TABLE `orders` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `customer_id` int(11) UNSIGNED NOT NULL REFERENCES `customers` (`id`), + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `o_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `contracts` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `url` varchar(31) NOT NULL, + `customer_id` int(11) UNSIGNED NULL REFERENCES `customers` (`id`), + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `c_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `credits` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + PRIMARY KEY (`id`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `c_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `order_id` int(11) UNSIGNED NULL REFERENCES `orders` (`id`), + `credit_id` int(11) UNSIGNED NULL REFERENCES `credits` (`id`), + PRIMARY KEY (`id`), + KEY `orderid_idx` (`order_id`), + CONSTRAINT `p_orderid_ref` FOREIGN KEY (`order_id`) + REFERENCES `orders` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `creditid_idx` (`credit_id`), + CONSTRAINT `p_creditid_ref` FOREIGN KEY (`credit_id`) + REFERENCES `credits` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `subscribers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `username` varchar(127) NOT NULL, + `domain` varchar(127) NOT NULL, + `webusername` varchar(127) default NULL, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + PRIMARY KEY (`id`), + UNIQUE KEY `usrdom_idx` (`username`, `domain`), + UNIQUE KEY `domwebuser_idx` (`domain`, `webusername`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `s_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `numbers` ( + `number` varchar(42) NOT NULL, + `subscriber_id` int(11) UNSIGNED NULL REFERENCES `subscribers` (`id`), + PRIMARY KEY `number_idx` (`number`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `n_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `interceptions` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `url` varchar(31) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; diff --git a/db_scripts/base/5347.down b/db_scripts/base/5347.down new file mode 100644 index 00000000..7ba696b0 --- /dev/null +++ b/db_scripts/base/5347.down @@ -0,0 +1 @@ +ALTER TABLE `carrier`.`contracts` DROP COLUMN `sip_uri`; diff --git a/db_scripts/base/5347.up b/db_scripts/base/5347.up new file mode 100644 index 00000000..4b939260 --- /dev/null +++ b/db_scripts/base/5347.up @@ -0,0 +1 @@ +ALTER TABLE `carrier`.`contracts` ADD COLUMN `sip_uri` varchar(127) NOT NULL; diff --git a/db_scripts/base/5471.down b/db_scripts/base/5471.down new file mode 100644 index 00000000..8e772225 --- /dev/null +++ b/db_scripts/base/5471.down @@ -0,0 +1,6 @@ +ALTER TABLE kamailio.acc CHANGE COLUMN callid callid varchar(64) NOT NULL DEFAULT ''; +ALTER TABLE kamailio.acc_trash CHANGE COLUMN callid callid varchar(64) NOT NULL DEFAULT ''; +ALTER TABLE kamailio.acc_backup CHANGE COLUMN callid callid varchar(64) NOT NULL DEFAULT ''; +ALTER TABLE accounting.acc CHANGE COLUMN callid callid varchar(64) NOT NULL DEFAULT ''; +ALTER TABLE accounting.acc_trash CHANGE COLUMN callid callid varchar(64) NOT NULL DEFAULT ''; +ALTER TABLE accounting.acc_backup CHANGE COLUMN callid callid varchar(64) NOT NULL DEFAULT ''; diff --git a/db_scripts/base/5471.up b/db_scripts/base/5471.up new file mode 100644 index 00000000..bc22c8ee --- /dev/null +++ b/db_scripts/base/5471.up @@ -0,0 +1,6 @@ +ALTER TABLE kamailio.acc CHANGE COLUMN callid callid varchar(255) NOT NULL DEFAULT ''; +ALTER TABLE kamailio.acc_trash CHANGE COLUMN callid callid varchar(255) NOT NULL DEFAULT ''; +ALTER TABLE kamailio.acc_backup CHANGE COLUMN callid callid varchar(255) NOT NULL DEFAULT ''; +ALTER TABLE accounting.acc CHANGE COLUMN callid callid varchar(255) NOT NULL DEFAULT ''; +ALTER TABLE accounting.acc_trash CHANGE COLUMN callid callid varchar(255) NOT NULL DEFAULT ''; +ALTER TABLE accounting.acc_backup CHANGE COLUMN callid callid varchar(255) NOT NULL DEFAULT ''; diff --git a/db_scripts/base/5538.down b/db_scripts/base/5538.down new file mode 100644 index 00000000..8ae6e600 --- /dev/null +++ b/db_scripts/base/5538.down @@ -0,0 +1 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute='ignore_userprovided_cli'; diff --git a/db_scripts/base/5538.up b/db_scripts/base/5538.up new file mode 100644 index 00000000..d7d72305 --- /dev/null +++ b/db_scripts/base/5538.up @@ -0,0 +1 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('ignore_userprovided_cli', 1, 1, 1, 'boolean', 1, 'Discard any subscriber provided CLI information'); diff --git a/db_scripts/base/5543.down b/db_scripts/base/5543.down new file mode 100644 index 00000000..e33d62a2 --- /dev/null +++ b/db_scripts/base/5543.down @@ -0,0 +1,2 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute='always_use_rtpproxy'; +DELETE FROM provisioning.voip_preferences WHERE attribute='never_use_rtpproxy'; diff --git a/db_scripts/base/5543.up b/db_scripts/base/5543.up new file mode 100644 index 00000000..221a8f67 --- /dev/null +++ b/db_scripts/base/5543.up @@ -0,0 +1,2 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Force rtp relay for this peer/domain/user.'); +INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('never_use_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Do not use rtp relay for this peer/domain/user. Rtp will be relayed if other participants have always_use_rtpproxy preference enabled.'); diff --git a/db_scripts/base/5553.down b/db_scripts/base/5553.down new file mode 100644 index 00000000..417de5c6 --- /dev/null +++ b/db_scripts/base/5553.down @@ -0,0 +1,7 @@ +use billing; + +ALTER TABLE `customers` DROP COLUMN `external_id`; + +ALTER TABLE `contracts` DROP COLUMN `external_id`; + +ALTER TABLE `voip_subscribers` DROP COLUMN `external_id`; diff --git a/db_scripts/base/5553.up b/db_scripts/base/5553.up new file mode 100644 index 00000000..28391a11 --- /dev/null +++ b/db_scripts/base/5553.up @@ -0,0 +1,10 @@ +use billing; + +ALTER TABLE `customers` ADD COLUMN `external_id` varchar(255) NULL default NULL AFTER `comm_contact_id`; +ALTER TABLE `customers` ADD KEY `externalid_idx` (`external_id`); + +ALTER TABLE `contracts` ADD COLUMN `external_id` varchar(255) NULL default NULL AFTER `status`; +ALTER TABLE `contracts` ADD KEY `externalid_idx` (`external_id`); + +ALTER TABLE `voip_subscribers` ADD COLUMN `external_id` varchar(255) NULL default NULL AFTER `primary_number_id`; +ALTER TABLE `voip_subscribers` ADD KEY `externalid_idx` (`external_id`); diff --git a/db_scripts/base/5603.down b/db_scripts/base/5603.down new file mode 100644 index 00000000..6c2b9dca --- /dev/null +++ b/db_scripts/base/5603.down @@ -0,0 +1,8 @@ +use provisioning; + +UPDATE voip_preferences + SET description = 'A realm used for authentication against a peer host.' + WHERE attribute = 'peer_auth_realm'; +DELETE FROM voip_preferences WHERE attribute = 'peer_auth_register'; +DELETE FROM voip_preferences WHERE attribute = 'concurrent_max'; +DELETE FROM voip_preferences WHERE attribute = 'concurrent_max_out'; diff --git a/db_scripts/base/5603.up b/db_scripts/base/5603.up new file mode 100644 index 00000000..81df8d96 --- /dev/null +++ b/db_scripts/base/5603.up @@ -0,0 +1,11 @@ +use provisioning; + +UPDATE voip_preferences + SET description = 'A realm (hostname) used to identify and for authentication against a peer host.' + WHERE attribute = 'peer_auth_realm'; +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_register', 1, 1, 1, 1, 'boolean', 1, 'Specifies whether registration at the peer host is desired.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) + VALUES('concurrent_max', 1, 1, 1, 1, 'int', 1, 'Maximum number of concurrent sessions (calls) for a subscriber or peer.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) + VALUES('concurrent_max_out', 1, 1, 1, 1, 'int', 1, 'Maximum number of concurrent outgoing sessions (calls) coming from a subscriber or going to a peer.'); diff --git a/db_scripts/base/5604.down b/db_scripts/base/5604.down new file mode 100644 index 00000000..31d2f53b --- /dev/null +++ b/db_scripts/base/5604.down @@ -0,0 +1,3 @@ +use provisioning; + +DELETE FROM voip_preferences WHERE attribute = 'allowed_clis'; diff --git a/db_scripts/base/5604.up b/db_scripts/base/5604.up new file mode 100644 index 00000000..4c5bb10a --- /dev/null +++ b/db_scripts/base/5604.up @@ -0,0 +1,4 @@ +use provisioning; + +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('allowed_clis', 0, 1, 'string', 0, 'A list of shell patterns specifying which CLIs are allowed to be set by the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards as usual in shell patterns.'); diff --git a/db_scripts/base/5607.down b/db_scripts/base/5607.down new file mode 100644 index 00000000..ec8e2043 --- /dev/null +++ b/db_scripts/base/5607.down @@ -0,0 +1 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute='force_to_pstn'; diff --git a/db_scripts/base/5607.up b/db_scripts/base/5607.up new file mode 100644 index 00000000..e30e6ad6 --- /dev/null +++ b/db_scripts/base/5607.up @@ -0,0 +1 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('force_to_pstn', 1, 1, 1, 1, 'boolean', 1, 'Force calls from this user/domain/peer to be routed to PSTN even if the callee is local. Use with caution, as this setting may increase your costs! When enabling this option in a peer, make sure you trust it, as the NGCP will become an open relay for it!'); diff --git a/db_scripts/base/5670.down b/db_scripts/base/5670.down new file mode 100644 index 00000000..e9159c1c --- /dev/null +++ b/db_scripts/base/5670.down @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS kamailio.fax_journal; +REVOKE ALL PRIVILEGES ON provisioning.* FROM 'hylafax'@'localhost'; diff --git a/db_scripts/base/5670.up b/db_scripts/base/5670.up new file mode 100644 index 00000000..b4e83945 --- /dev/null +++ b/db_scripts/base/5670.up @@ -0,0 +1,20 @@ +CREATE TABLE kamailio.fax_journal ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(10) unsigned NOT NULL DEFAULT '0', + `the_timestamp` int(11) unsigned NOT NULL DEFAULT '0', + `duration` int(11) unsigned NOT NULL DEFAULT '0', + `direction` enum('in','out') NOT NULL DEFAULT 'in', + `peer_number` varchar(255) NOT NULL DEFAULT '', + `peer_name` varchar(255) NOT NULL DEFAULT '', + `pages` int(10) unsigned NOT NULL DEFAULT '0', + `reason` varchar(255) NOT NULL, + `status` varchar(255) NOT NULL DEFAULT '', + `signal_rate` int(10) unsigned NOT NULL DEFAULT '0', + `quality` varchar(255) NOT NULL DEFAULT '', + `filename` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `selkey` (`subscriber_id`,`direction`) +) ENGINE=InnoDB; +GRANT SELECT ON kamailio.* TO 'hylafax'@'localhost' IDENTIFIED BY 'PW_HYLAFAX'; +GRANT INSERT ON kamailio.fax_journal TO 'hylafax'@'localhost' IDENTIFIED BY 'PW_HYLAFAX'; +GRANT SELECT ON provisioning.* TO 'hylafax'@'localhost' IDENTIFIED BY 'PW_HYLAFAX'; diff --git a/db_scripts/base/5708.down b/db_scripts/base/5708.down new file mode 100644 index 00000000..10698627 --- /dev/null +++ b/db_scripts/base/5708.down @@ -0,0 +1,19 @@ +ALTER TABLE kamailio.acc CHANGE COLUMN src_leg src_leg varchar(255) DEFAULT NULL; +ALTER TABLE kamailio.acc CHANGE COLUMN dst_leg dst_leg varchar(255) DEFAULT NULL; +ALTER TABLE accounting.acc CHANGE COLUMN src_leg src_leg varchar(255) DEFAULT NULL; +ALTER TABLE accounting.acc CHANGE COLUMN dst_leg dst_leg varchar(255) DEFAULT NULL; +ALTER TABLE accounting.acc_backup CHANGE COLUMN src_leg src_leg varchar(255) DEFAULT NULL; +ALTER TABLE accounting.acc_backup CHANGE COLUMN dst_leg dst_leg varchar(255) DEFAULT NULL; +ALTER TABLE accounting.acc_trash CHANGE COLUMN src_leg src_leg varchar(255) DEFAULT NULL; +ALTER TABLE accounting.acc_trash CHANGE COLUMN dst_leg dst_leg varchar(255) DEFAULT NULL; + +ALTER TABLE accounting.cdr DROP COLUMN source_external_subscriber_id; +ALTER TABLE accounting.cdr DROP COLUMN source_external_contract_id; +ALTER TABLE accounting.cdr DROP COLUMN source_account_id; + +ALTER TABLE accounting.cdr DROP COLUMN destination_external_subscriber_id; +ALTER TABLE accounting.cdr DROP COLUMN destination_external_contract_id; +ALTER TABLE accounting.cdr DROP COLUMN destination_account_id; + +ALTER TABLE accounting.cdr DROP COLUMN peer_auth_user; +ALTER TABLE accounting.cdr DROP COLUMN peer_auth_realm; diff --git a/db_scripts/base/5708.up b/db_scripts/base/5708.up new file mode 100644 index 00000000..f5c362f4 --- /dev/null +++ b/db_scripts/base/5708.up @@ -0,0 +1,19 @@ +ALTER TABLE kamailio.acc CHANGE COLUMN src_leg src_leg varchar(2048) DEFAULT NULL; +ALTER TABLE kamailio.acc CHANGE COLUMN dst_leg dst_leg varchar(2048) DEFAULT NULL; +ALTER TABLE accounting.acc CHANGE COLUMN src_leg src_leg varchar(2048) DEFAULT NULL; +ALTER TABLE accounting.acc CHANGE COLUMN dst_leg dst_leg varchar(2048) DEFAULT NULL; +ALTER TABLE accounting.acc_backup CHANGE COLUMN src_leg src_leg varchar(2048) DEFAULT NULL; +ALTER TABLE accounting.acc_backup CHANGE COLUMN dst_leg dst_leg varchar(2048) DEFAULT NULL; +ALTER TABLE accounting.acc_trash CHANGE COLUMN src_leg src_leg varchar(2048) DEFAULT NULL; +ALTER TABLE accounting.acc_trash CHANGE COLUMN dst_leg dst_leg varchar(2048) DEFAULT NULL; + +ALTER TABLE accounting.cdr ADD COLUMN source_external_subscriber_id varchar(255) DEFAULT NULL AFTER source_provider_id; +ALTER TABLE accounting.cdr ADD COLUMN source_external_contract_id varchar(255) DEFAULT NULL AFTER source_external_subscriber_id; +ALTER TABLE accounting.cdr ADD COLUMN source_account_id int(11) unsigned NOT NULL DEFAULT '0' AFTER source_external_contract_id; + +ALTER TABLE accounting.cdr ADD COLUMN destination_external_subscriber_id varchar(255) DEFAULT NULL AFTER destination_provider_id; +ALTER TABLE accounting.cdr ADD COLUMN destination_external_contract_id varchar(255) DEFAULT NULL AFTER destination_external_subscriber_id; +ALTER TABLE accounting.cdr ADD COLUMN destination_account_id int(11) unsigned NOT NULL DEFAULT '0' AFTER destination_external_contract_id; + +ALTER TABLE accounting.cdr ADD COLUMN peer_auth_user varchar(255) DEFAULT NULL AFTER destination_domain_in; +ALTER TABLE accounting.cdr ADD COLUMN peer_auth_realm varchar(255) DEFAULT NULL AFTER peer_auth_user; diff --git a/db_scripts/base/5722.down b/db_scripts/base/5722.down new file mode 100644 index 00000000..96a15bc1 --- /dev/null +++ b/db_scripts/base/5722.down @@ -0,0 +1,55 @@ +DROP TRIGGER provisioning.voip_prul_crepl_trig; +DROP TRIGGER provisioning.voip_prul_urepl_trig; +DROP TRIGGER provisioning.voip_prul_drepl_trig; + +DELIMITER | + +CREATE TRIGGER provisioning.voip_prul_crepl_trig AFTER INSERT ON voip_peer_rules + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_rule (lcr_id, prefix, from_uri, stopper, enabled, group_id) + VALUES(1, NEW.callee_prefix, + IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), ''), + 0, 1, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT gw.lcr_id, LAST_INSERT_ID(), gw.id, vpg.priority, vph.weight + FROM kamailio.lcr_gw gw + INNER JOIN provisioning.voip_peer_hosts vph ON vph.ip = gw.ip_addr + AND gw.lcr_id = 1 + AND vph.group_id = gw.group_id + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = vph.group_id + WHERE vph.group_id = NEW.group_id; + + END; +| + +CREATE TRIGGER provisioning.voip_prul_urepl_trig AFTER UPDATE ON voip_peer_rules + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_rule + SET prefix = NEW.callee_prefix, + from_uri = IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), '') + WHERE prefix = OLD.callee_prefix + AND from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') + + AND group_id = OLD.group_id; + + END; +| + +CREATE TRIGGER provisioning.voip_prul_drepl_trig AFTER DELETE ON voip_peer_rules + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_rule + WHERE prefix = OLD.callee_prefix + AND from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') + AND group_id = OLD.group_id; + + -- foreign key will delete from kamailio.lcr_rule_target + + END; +| + +DELIMITER ; + diff --git a/db_scripts/base/5722.up b/db_scripts/base/5722.up new file mode 100644 index 00000000..ec257342 --- /dev/null +++ b/db_scripts/base/5722.up @@ -0,0 +1,54 @@ +DROP TRIGGER provisioning.voip_prul_crepl_trig; +DROP TRIGGER provisioning.voip_prul_urepl_trig; +DROP TRIGGER provisioning.voip_prul_drepl_trig; + +DELIMITER | + +CREATE TRIGGER provisioning.voip_prul_crepl_trig AFTER INSERT ON voip_peer_rules + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_rule (lcr_id, prefix, from_uri, stopper, enabled, group_id) + VALUES(1, NEW.callee_prefix, NEW.caller_prefix, + 0, 1, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT gw.lcr_id, LAST_INSERT_ID(), gw.id, vpg.priority, vph.weight + FROM kamailio.lcr_gw gw + INNER JOIN provisioning.voip_peer_hosts vph ON vph.ip = gw.ip_addr + AND gw.lcr_id = 1 + AND vph.group_id = gw.group_id + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = vph.group_id + WHERE vph.group_id = NEW.group_id; + + END; +| + +CREATE TRIGGER provisioning.voip_prul_urepl_trig AFTER UPDATE ON voip_peer_rules + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_rule + SET prefix = NEW.callee_prefix, from_uri = NEW.caller_prefix + WHERE prefix = OLD.callee_prefix + AND from_uri = OLD.caller_prefix + AND group_id = OLD.group_id; + + END; +| + +CREATE TRIGGER provisioning.voip_prul_drepl_trig AFTER DELETE ON voip_peer_rules + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_rule + WHERE prefix = OLD.callee_prefix + AND from_uri = OLD.caller_prefix + AND group_id = OLD.group_id; + + -- foreign key will delete from kamailio.lcr_rule_target + + END; +| + +DELIMITER ; + +UPDATE kamailio.lcr_rule SET from_uri = REPLACE(from_uri, '^', ''); + diff --git a/db_scripts/base/5726.down b/db_scripts/base/5726.down new file mode 100644 index 00000000..6447b6f8 --- /dev/null +++ b/db_scripts/base/5726.down @@ -0,0 +1,4 @@ +use provisioning; + +ALTER TABLE voip_subscribers MODIFY COLUMN `password` varchar(31) default NULL; +ALTER TABLE voip_subscribers MODIFY COLUMN `webpassword` varchar(31) default NULL; diff --git a/db_scripts/base/5726.up b/db_scripts/base/5726.up new file mode 100644 index 00000000..8bba16a8 --- /dev/null +++ b/db_scripts/base/5726.up @@ -0,0 +1,4 @@ +use provisioning; + +ALTER TABLE voip_subscribers MODIFY COLUMN `password` varchar(40) default NULL; +ALTER TABLE voip_subscribers MODIFY COLUMN `webpassword` varchar(40) default NULL; diff --git a/db_scripts/base/5728.down b/db_scripts/base/5728.down new file mode 100644 index 00000000..58ed5e09 --- /dev/null +++ b/db_scripts/base/5728.down @@ -0,0 +1,5 @@ +use provisioning; + +DELETE FROM voip_preferences WHERE attribute = 'account_id'; +DELETE FROM voip_preferences WHERE attribute = 'ext_contract_id'; +DELETE FROM voip_preferences WHERE attribute = 'ext_subscriber_id'; diff --git a/db_scripts/base/5728.up b/db_scripts/base/5728.up new file mode 100644 index 00000000..9efacef5 --- /dev/null +++ b/db_scripts/base/5728.up @@ -0,0 +1,5 @@ +use provisioning; + +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('account_id', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ext_contract_id', 0, 1, 'string', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ext_subscriber_id', 0, 1, 'string', 1, 1); diff --git a/db_scripts/base/5737.down b/db_scripts/base/5737.down new file mode 100644 index 00000000..dd3eb18c --- /dev/null +++ b/db_scripts/base/5737.down @@ -0,0 +1 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute='find_subscriber_by_auth_user'; diff --git a/db_scripts/base/5737.up b/db_scripts/base/5737.up new file mode 100644 index 00000000..8dbf1097 --- /dev/null +++ b/db_scripts/base/5737.up @@ -0,0 +1 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('find_subscriber_by_auth_user', 1, 0, 0, 1, 'boolean', 1, 'For incoming calls from this peer, find the destination subscriber also using its auth_username used for outbound registration.'); diff --git a/db_scripts/base/5744.down b/db_scripts/base/5744.down new file mode 100644 index 00000000..d9c2e2ca --- /dev/null +++ b/db_scripts/base/5744.down @@ -0,0 +1,5 @@ +use carrier; + +ALTER TABLE `customers` DROP COLUMN `external_id`; +ALTER TABLE `contracts` DROP COLUMN `external_id`; +ALTER TABLE `subscribers` DROP COLUMN `external_id`; diff --git a/db_scripts/base/5744.up b/db_scripts/base/5744.up new file mode 100644 index 00000000..3559dd31 --- /dev/null +++ b/db_scripts/base/5744.up @@ -0,0 +1,10 @@ +use carrier; + +ALTER TABLE `customers` ADD COLUMN `external_id` varchar(255) NULL default NULL AFTER `id`; +ALTER TABLE `customers` ADD UNIQUE KEY `externalid_idx` (`external_id`); + +ALTER TABLE `contracts` ADD COLUMN `external_id` varchar(255) NULL default NULL AFTER `id`; +ALTER TABLE `contracts` ADD UNIQUE KEY `externalid_idx` (`external_id`); + +ALTER TABLE `subscribers` ADD COLUMN `external_id` varchar(255) NULL default NULL AFTER `id`; +ALTER TABLE `subscribers` ADD UNIQUE KEY `externalid_idx` (`external_id`); diff --git a/db_scripts/base/5749.down b/db_scripts/base/5749.down new file mode 100644 index 00000000..16b6f647 --- /dev/null +++ b/db_scripts/base/5749.down @@ -0,0 +1 @@ +ALTER TABLE kamailio.subscriber MODIFY COLUMN `password` varchar(25) NOT NULL default ''; diff --git a/db_scripts/base/5749.up b/db_scripts/base/5749.up new file mode 100644 index 00000000..0891eb32 --- /dev/null +++ b/db_scripts/base/5749.up @@ -0,0 +1 @@ +ALTER TABLE kamailio.subscriber MODIFY COLUMN `password` varchar(40) NOT NULL default ''; diff --git a/db_scripts/base/5800.down b/db_scripts/base/5800.down new file mode 100644 index 00000000..3a89d2e9 --- /dev/null +++ b/db_scripts/base/5800.down @@ -0,0 +1,253 @@ +-- NOTE! This does not migrate data from new to old tables, but will delete everything from kamailio.dialplan! + +use provisioning; + +CREATE TABLE `voip_domain_rewrites` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `domain_id` int(11) unsigned NOT NULL, + `match_pattern` varchar(64) NOT NULL DEFAULT '', + `replace_pattern` varchar(64) NOT NULL, + `description` varchar(127) NOT NULL DEFAULT '', + `direction` enum('in','out') NOT NULL, + `field` enum('caller','callee') NOT NULL, + `priority` int(11) unsigned NOT NULL DEFAULT 50, + PRIMARY KEY (`id`), + KEY `domainidx` (`domain_id`), + CONSTRAINT `v_drw_domainid_ref` FOREIGN KEY (`domain_id`) REFERENCES `voip_domains` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_peer_rewrites` ( + `id` int(11) unsigned NOT NULL auto_increment, + `peer_id` int(11) unsigned NOT NULL, + `match_pattern` varchar(64) NOT NULL default '', + `replace_pattern` varchar(64) NOT NULL, + `description` varchar(127) NOT NULL default '', + `direction` enum('in','out') NOT NULL default 'in', + `field` enum('caller','callee') NOT NULL default 'caller', + `priority` int(11) unsigned NOT NULL DEFAULT 50, + PRIMARY KEY (`id`), + KEY `peeridx` (`peer_id`), + KEY `dirfieldidx` (`direction`,`field`), + CONSTRAINT `v_prw_peerid_ref` FOREIGN KEY (`peer_id`) REFERENCES `voip_peer_hosts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +DROP TRIGGER voip_rwrules_crepl_trig; +DROP TRIGGER voip_rwrules_urepl_trig; +DROP TRIGGER voip_rwrules_drepl_trig; +DROP TRIGGER voip_rwrulesets_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_domrw_crepl_trig AFTER INSERT ON voip_domain_rewrites + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + INSERT INTO kamailio.dialplan (dpid, pr, match_op, match_exp, + match_len, subst_exp, repl_exp, attrs) + VALUES(dp_id, NEW.priority, 1, NEW.match_pattern, 0, NEW.match_pattern, NEW.replace_pattern, ''); + + END; +| + +CREATE TRIGGER voip_domrw_urepl_trig AFTER UPDATE ON voip_domain_rewrites + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + UPDATE kamailio.dialplan SET match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, repl_exp = NEW.replace_pattern, pr = NEW.priority + WHERE dpid = dp_id AND match_exp = OLD.match_pattern AND pr = OLD.priority + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_domrw_drepl_trig AFTER DELETE ON voip_domain_rewrites + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_caller_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_callee_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_caller_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_callee_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + + IF OLD.direction = 'in' AND OLD.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF OLD.direction = 'in' AND OLD.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + DELETE FROM kamailio.dialplan + WHERE dpid = dp_id AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_peerrw_crepl_trig AFTER INSERT ON voip_peer_rewrites + FOR EACH ROW BEGIN + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + INTO caller_in_id, callee_in_id, caller_out_id, callee_out_id + FROM voip_peer_hosts WHERE id = NEW.peer_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + INSERT INTO kamailio.dialplan (dpid, pr, match_op, match_exp, + match_len, subst_exp, repl_exp, attrs) + VALUES(dp_id, NEW.priority, 1, NEW.match_pattern, 0, NEW.match_pattern, NEW.replace_pattern, ''); + + END; +| + +CREATE TRIGGER voip_peerrw_urepl_trig AFTER UPDATE ON voip_peer_rewrites + FOR EACH ROW BEGIN + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + INTO caller_in_id, callee_in_id, caller_out_id, callee_out_id + FROM voip_peer_hosts WHERE id = NEW.peer_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + UPDATE kamailio.dialplan SET match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, repl_exp = NEW.replace_pattern, + pr = NEW.priority + WHERE dpid = dp_id AND match_exp = OLD.match_pattern AND pr = OLD.priority + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_peerrw_drepl_trig AFTER DELETE ON voip_peer_rewrites + FOR EACH ROW BEGIN + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + INTO caller_in_id, callee_in_id, caller_out_id, callee_out_id + FROM voip_peer_hosts WHERE id = OLD.peer_id; + + IF OLD.direction = 'in' AND OLD.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF OLD.direction = 'in' AND OLD.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + DELETE FROM kamailio.dialplan + WHERE dpid = dp_id AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +DELIMITER ; + +DELETE FROM voip_preferences WHERE attribute = 'rewrite_rule_set'; + +DROP TABLE `voip_rewrite_rules`; +DROP TABLE `voip_rewrite_rule_sets`; diff --git a/db_scripts/base/5800.up b/db_scripts/base/5800.up new file mode 100644 index 00000000..140bfb21 --- /dev/null +++ b/db_scripts/base/5800.up @@ -0,0 +1,123 @@ +-- NOTE -- This will delete everything from kamailio.dialplan! +-- NOTE -- A backup is made to migration tables, run 5824.up immediately to restore it! + +use provisioning; + +CREATE TABLE `voip_rewrite_rule_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(32) NOT NULL, + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_idx` (`name`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_rewrite_rules` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `set_id` int(11) unsigned NOT NULL, + `match_pattern` varchar(64) NOT NULL DEFAULT '', + `replace_pattern` varchar(64) NOT NULL, + `description` varchar(127) NOT NULL DEFAULT '', + `direction` enum('in','out') NOT NULL DEFAULT 'in', + `field` enum('caller','callee') NOT NULL DEFAULT 'caller', + `priority` int(11) unsigned NOT NULL DEFAULT '50', + PRIMARY KEY (`id`), + KEY `setidx` (`set_id`), + KEY `dirfieldidx` (`direction`,`field`), + CONSTRAINT `v_rwr_setid_ref` FOREIGN KEY (`set_id`) REFERENCES `voip_rewrite_rule_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +DROP TRIGGER voip_domrw_crepl_trig; +DROP TRIGGER voip_domrw_urepl_trig; +DROP TRIGGER voip_domrw_drepl_trig; +DROP TRIGGER voip_peerrw_crepl_trig; +DROP TRIGGER voip_peerrw_urepl_trig; +DROP TRIGGER voip_peerrw_drepl_trig; + +DELETE FROM kamailio.dialplan; + +DELIMITER | + +CREATE TRIGGER voip_rwrules_crepl_trig AFTER INSERT ON voip_rewrite_rules + FOR EACH ROW BEGIN + + INSERT INTO kamailio.dialplan (dpid,pr,match_op,match_exp,match_len,subst_exp,repl_exp,attrs) + VALUES(NEW.set_id,NEW.priority,1,NEW.match_pattern,0,NEW.match_pattern,NEW.replace_pattern,''); + + END; +| + +CREATE TRIGGER voip_rwrules_urepl_trig AFTER UPDATE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + UPDATE kamailio.dialplan + SET pr = NEW.priority, + match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, + repl_exp = NEW.replace_pattern + WHERE dpid = OLD.set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_rwrules_drepl_trig BEFORE DELETE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DELETE FROM kamailio.dialplan + WHERE dpid = OLD.set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_rwrulesets_drepl_trig BEFORE DELETE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dialplan WHERE dpid = OLD.id; + + END; +| + +DELIMITER ; + +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) + VALUES('rewrite_rule_set', 1, 1, 1, 1, 'int', 1, 'Specifies the list of caller and callee rewrite rules which should be applied for incoming and outgoing calls.'); + +-- create rw rules backup for upgrade +CREATE TABLE `voip_domain_rewrites_rwsmig` SELECT * FROM `voip_domain_rewrites`; +CREATE TABLE `voip_domain_rwsmig` SELECT b.domain_id, + b.value AS dp_caller_in_id, + d.value AS dp_callee_in_id, + f.value AS dp_caller_out_id, + h.value AS dp_callee_out_id + FROM `voip_preferences` a INNER JOIN `voip_dom_preferences` b + ON a.attribute = 'dp_dom_caller_in' + AND a.id = b.attribute_id + INNER JOIN `voip_preferences` c + ON c.attribute = 'dp_dom_callee_in' + INNER JOIN `voip_dom_preferences` d + ON c.id = d.attribute_id + AND b.domain_id = d.domain_id + INNER JOIN `voip_preferences` e + ON e.attribute = 'dp_dom_caller_out' + INNER JOIN `voip_dom_preferences` f + ON e.id = f.attribute_id + AND d.domain_id = f.domain_id + INNER JOIN `voip_preferences` g + ON g.attribute = 'dp_dom_callee_out' + INNER JOIN `voip_dom_preferences` h + ON g.id = h.attribute_id + AND f.domain_id = h.domain_id; +CREATE TABLE `voip_peer_rewrites_rwsmig` SELECT * FROM `voip_peer_rewrites`; +CREATE TABLE `voip_peer_hosts_rwsmig` SELECT * FROM `voip_peer_hosts`; + +DROP TABLE `voip_domain_rewrites`; +DROP TABLE `voip_peer_rewrites`; diff --git a/db_scripts/base/5824.down b/db_scripts/base/5824.down new file mode 100644 index 00000000..e59d4bdf --- /dev/null +++ b/db_scripts/base/5824.down @@ -0,0 +1,83 @@ +-- NOTE! This does not update but will delete all rewrite data! + +use provisioning; + +DELETE FROM voip_rewrite_rules; +DELETE FROM voip_rewrite_rule_sets; + +DELETE FROM voip_preferences WHERE attribute = 'rewrite_caller_in_dpid'; +DELETE FROM voip_preferences WHERE attribute = 'rewrite_callee_in_dpid'; +DELETE FROM voip_preferences WHERE attribute = 'rewrite_caller_out_dpid'; +DELETE FROM voip_preferences WHERE attribute = 'rewrite_callee_out_dpid'; + +UPDATE voip_preferences SET internal = 0 WHERE attribute = 'rewrite_rule_set'; + +DELIMITER | + +DROP TRIGGER voip_rwrulesets_crepl_trig| +DROP TRIGGER voip_rwrulesets_urepl_trig| +DROP TRIGGER voip_rwrulesets_drepl_trig| + +CREATE TRIGGER voip_rwrulesets_drepl_trig BEFORE DELETE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dialplan WHERE dpid = OLD.id; + + END; +| + +DROP TRIGGER voip_rwrules_crepl_trig| + +CREATE TRIGGER voip_rwrules_crepl_trig AFTER INSERT ON voip_rewrite_rules + FOR EACH ROW BEGIN + + INSERT INTO kamailio.dialplan (dpid,pr,match_op,match_exp,match_len,subst_exp,repl_exp,attrs) + VALUES(NEW.set_id,NEW.priority,1,NEW.match_pattern,0,NEW.match_pattern,NEW.replace_pattern,''); + + END; +| + +DROP TRIGGER voip_rwrules_urepl_trig| + +CREATE TRIGGER voip_rwrules_urepl_trig AFTER UPDATE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + UPDATE kamailio.dialplan + SET pr = NEW.priority, + match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, + repl_exp = NEW.replace_pattern + WHERE dpid = OLD.set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +DROP TRIGGER voip_rwrules_drepl_trig| + +CREATE TRIGGER voip_rwrules_drepl_trig BEFORE DELETE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DELETE FROM kamailio.dialplan + WHERE dpid = OLD.set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +DELIMITER ; + +DROP TABLE `voip_rwrs_sequence`; + +ALTER TABLE voip_rewrite_rule_sets DROP COLUMN `caller_in_dpid`; +ALTER TABLE voip_rewrite_rule_sets DROP COLUMN `callee_in_dpid`; +ALTER TABLE voip_rewrite_rule_sets DROP COLUMN `caller_out_dpid`; +ALTER TABLE voip_rewrite_rule_sets DROP COLUMN `callee_out_dpid`; diff --git a/db_scripts/base/5824.up b/db_scripts/base/5824.up new file mode 100644 index 00000000..4972d74d --- /dev/null +++ b/db_scripts/base/5824.up @@ -0,0 +1,208 @@ +-- NOTE -- This restores data in kamailio.dialplan which has been deleted by 5800.up! +-- NOTE -- Run 5800.up first to create the data backup. + +use provisioning; + +DELETE FROM voip_rewrite_rules; +DELETE FROM voip_rewrite_rule_sets; + +ALTER TABLE voip_rewrite_rule_sets ADD COLUMN `caller_in_dpid` int(11) unsigned DEFAULT NULL AFTER `description`; +ALTER TABLE voip_rewrite_rule_sets ADD COLUMN `callee_in_dpid` int(11) unsigned DEFAULT NULL AFTER `caller_in_dpid`; +ALTER TABLE voip_rewrite_rule_sets ADD COLUMN `caller_out_dpid` int(11) unsigned DEFAULT NULL AFTER `callee_in_dpid`; +ALTER TABLE voip_rewrite_rule_sets ADD COLUMN `callee_out_dpid` int(11) unsigned DEFAULT NULL AFTER `caller_out_dpid`; + +CREATE TABLE `voip_rwrs_sequence` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +DELIMITER | + +DROP TRIGGER voip_rwrules_crepl_trig| + +CREATE TRIGGER voip_rwrules_crepl_trig AFTER INSERT ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DECLARE new_set_id int(11) unsigned; + + SELECT IF(NEW.direction = 'in', IF(NEW.field = 'caller', caller_in_dpid, callee_in_dpid), IF(NEW.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO new_set_id FROM voip_rewrite_rule_sets WHERE id = NEW.set_id; + + INSERT INTO kamailio.dialplan (dpid,pr,match_op,match_exp,match_len,subst_exp,repl_exp,attrs) + VALUES(new_set_id,NEW.priority,1,NEW.match_pattern,0,NEW.match_pattern,NEW.replace_pattern,''); + + END; +| + +DROP TRIGGER voip_rwrules_urepl_trig| + +CREATE TRIGGER voip_rwrules_urepl_trig AFTER UPDATE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DECLARE old_set_id int(11) unsigned; + DECLARE new_set_id int(11) unsigned; + + SELECT IF(OLD.direction = 'in', IF(OLD.field = 'caller', caller_in_dpid, callee_in_dpid), IF(OLD.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO old_set_id FROM voip_rewrite_rule_sets WHERE id = OLD.set_id; + SELECT IF(NEW.direction = 'in', IF(NEW.field = 'caller', caller_in_dpid, callee_in_dpid), IF(NEW.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO new_set_id FROM voip_rewrite_rule_sets WHERE id = NEW.set_id; + + UPDATE kamailio.dialplan + SET dpid = new_set_id, + pr = NEW.priority, + match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, + repl_exp = NEW.replace_pattern + WHERE dpid = old_set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +DROP TRIGGER voip_rwrules_drepl_trig| + +CREATE TRIGGER voip_rwrules_drepl_trig BEFORE DELETE ON voip_rewrite_rules + FOR EACH ROW BEGIN + + DECLARE old_set_id int(11) unsigned; + + SELECT IF(OLD.direction = 'in', IF(OLD.field = 'caller', caller_in_dpid, callee_in_dpid), IF(OLD.field = 'caller', caller_out_dpid, callee_out_dpid)) + INTO old_set_id FROM voip_rewrite_rule_sets WHERE id = OLD.set_id; + + DELETE FROM kamailio.dialplan + WHERE dpid = old_set_id + AND pr = OLD.priority + AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern + AND repl_exp = OLD.replace_pattern; + + END; +| + +DROP TRIGGER voip_rwrulesets_drepl_trig| + +CREATE TRIGGER voip_rwrulesets_drepl_trig BEFORE DELETE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_out_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_out_dpid; + + END; +| + +CREATE TRIGGER voip_rwrulesets_crepl_trig BEFORE INSERT ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + IF NEW.caller_in_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.caller_in_dpid = (SELECT LAST_INSERT_ID()); + END IF; + IF NEW.callee_in_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.callee_in_dpid = (SELECT LAST_INSERT_ID()); + END IF; + IF NEW.caller_out_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.caller_out_dpid = (SELECT LAST_INSERT_ID()); + END IF; + IF NEW.callee_out_dpid IS NULL THEN + INSERT INTO voip_rwrs_sequence VALUES(); + SET NEW.callee_out_dpid = (SELECT LAST_INSERT_ID()); + END IF; + + DELETE a FROM voip_rwrs_sequence a, voip_rwrs_sequence b WHERE a.id < b.id; + + END; +| + +CREATE TRIGGER voip_rwrulesets_urepl_trig AFTER UPDATE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + UPDATE kamailio.dialplan SET dpid = NEW.caller_in_dpid WHERE dpid = OLD.caller_in_dpid; + UPDATE kamailio.dialplan SET dpid = NEW.callee_in_dpid WHERE dpid = OLD.callee_in_dpid; + UPDATE kamailio.dialplan SET dpid = NEW.caller_out_dpid WHERE dpid = OLD.caller_out_dpid; + UPDATE kamailio.dialplan SET dpid = NEW.callee_out_dpid WHERE dpid = OLD.callee_out_dpid; + + END; +| + +DELIMITER ; + +DELETE FROM voip_preferences WHERE attribute = 'rewrite_rule_set'; +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal, description) + VALUES('rewrite_rule_set', 1, 1, 1, 1, 'int', 1, -1, 'Specifies the list of caller and callee rewrite rules which should be applied for incoming and outgoing calls.'); + +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_caller_in_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_callee_in_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_caller_out_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_callee_out_dpid', 1, 1, 1, 1, 'int', 1, 1); + +-- restore data from migration tables +INSERT INTO voip_rewrite_rule_sets (name,description,caller_in_dpid,callee_in_dpid,caller_out_dpid,callee_out_dpid) + SELECT CONCAT('peer___',ip), CONCAT('auto-generated ruleset for ',name), + dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + FROM voip_peer_hosts_rwsmig; +INSERT INTO voip_rewrite_rules (set_id, match_pattern, replace_pattern, description, direction, field, priority) + SELECT a.id, b.match_pattern, b.replace_pattern, b.description, b.direction, b.field, b.priority + FROM voip_rewrite_rule_sets a, voip_peer_rewrites_rwsmig b, voip_peer_hosts_rwsmig c + WHERE a.name = CONCAT('peer___',c.ip) + AND b.peer_id = c.id; +INSERT INTO voip_peer_preferences (peer_host_id,attribute_id,value) + SELECT a.id, b.id, a.dp_caller_in_id + FROM voip_peer_hosts_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid'; +INSERT INTO voip_peer_preferences (peer_host_id,attribute_id,value) + SELECT a.id, b.id, a.dp_callee_in_id + FROM voip_peer_hosts_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid'; +INSERT INTO voip_peer_preferences (peer_host_id,attribute_id,value) + SELECT a.id, b.id, a.dp_caller_out_id + FROM voip_peer_hosts_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid'; +INSERT INTO voip_peer_preferences (peer_host_id,attribute_id,value) + SELECT a.id, b.id, a.dp_callee_out_id + FROM voip_peer_hosts_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid'; + +INSERT INTO voip_rewrite_rule_sets (name,description,caller_in_dpid,callee_in_dpid,caller_out_dpid,callee_out_dpid) + SELECT CONCAT('dom___',b.domain), CONCAT('auto-generated ruleset for ',b.domain), + dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + FROM voip_domain_rwsmig a, voip_domains b + WHERE a.domain_id = b.id; +INSERT INTO voip_rewrite_rules (set_id, match_pattern, replace_pattern, description, direction, field, priority) + SELECT a.id, b.match_pattern, b.replace_pattern, b.description, b.direction, b.field, b.priority + FROM voip_rewrite_rule_sets a, voip_domain_rewrites_rwsmig b, voip_domains c + WHERE a.name = CONCAT('dom___',c.domain) + AND b.domain_id = c.id; +INSERT INTO voip_dom_preferences (domain_id,attribute_id,value) + SELECT a.domain_id, b.id, a.dp_caller_in_id + FROM voip_domain_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid'; +INSERT INTO voip_dom_preferences (domain_id,attribute_id,value) + SELECT a.domain_id, b.id, a.dp_callee_in_id + FROM voip_domain_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid'; +INSERT INTO voip_dom_preferences (domain_id,attribute_id,value) + SELECT a.domain_id, b.id, a.dp_caller_out_id + FROM voip_domain_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid'; +INSERT INTO voip_dom_preferences (domain_id,attribute_id,value) + SELECT a.domain_id, b.id, a.dp_callee_out_id + FROM voip_domain_rwsmig a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid'; + +DROP TABLE voip_peer_hosts_rwsmig; +DROP TABLE voip_peer_rewrites_rwsmig; +DROP TABLE voip_domain_rwsmig; +DROP TABLE voip_domain_rewrites_rwsmig; diff --git a/db_scripts/base/5826.down b/db_scripts/base/5826.down new file mode 100644 index 00000000..445b2063 --- /dev/null +++ b/db_scripts/base/5826.down @@ -0,0 +1,39 @@ +use provisioning; + +DROP TRIGGER voip_dom_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + + DELETE FROM kamailio.dialplan WHERE dpid IN + (caller_in_id, callee_in_id, caller_out_id, callee_out_id); + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/5826.up b/db_scripts/base/5826.up new file mode 100644 index 00000000..24557c47 --- /dev/null +++ b/db_scripts/base/5826.up @@ -0,0 +1,36 @@ +use provisioning; + +DROP TRIGGER voip_dom_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/5831.down b/db_scripts/base/5831.down new file mode 100644 index 00000000..7e34e8d9 --- /dev/null +++ b/db_scripts/base/5831.down @@ -0,0 +1,32 @@ +use provisioning; + +DROP TRIGGER voip_rwrulesets_urepl_trig; +DROP TRIGGER voip_rwrulesets_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_rwrulesets_urepl_trig AFTER UPDATE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + UPDATE kamailio.dialplan SET dpid = NEW.caller_in_dpid WHERE dpid = OLD.caller_in_dpid; + UPDATE kamailio.dialplan SET dpid = NEW.callee_in_dpid WHERE dpid = OLD.callee_in_dpid; + UPDATE kamailio.dialplan SET dpid = NEW.caller_out_dpid WHERE dpid = OLD.caller_out_dpid; + UPDATE kamailio.dialplan SET dpid = NEW.callee_out_dpid WHERE dpid = OLD.callee_out_dpid; + + END; +| + +CREATE TRIGGER voip_rwrulesets_drepl_trig BEFORE DELETE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_out_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_out_dpid; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/5831.up b/db_scripts/base/5831.up new file mode 100644 index 00000000..4db40682 --- /dev/null +++ b/db_scripts/base/5831.up @@ -0,0 +1,154 @@ +use provisioning; + +DROP TRIGGER voip_rwrulesets_urepl_trig; +DROP TRIGGER voip_rwrulesets_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_rwrulesets_urepl_trig AFTER UPDATE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + IF NEW.caller_in_dpid != OLD.caller_in_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.caller_in_dpid WHERE dpid = OLD.caller_in_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.caller_in_dpid + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.caller_in_dpid + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.caller_in_dpid + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + END IF; + + IF NEW.callee_in_dpid != OLD.callee_in_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.callee_in_dpid WHERE dpid = OLD.callee_in_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.callee_in_dpid + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.callee_in_dpid + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.callee_in_dpid + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + END IF; + + IF NEW.caller_out_dpid != OLD.caller_out_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.caller_out_dpid WHERE dpid = OLD.caller_out_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.caller_out_dpid + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.caller_out_dpid + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.caller_out_dpid + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + END IF; + + IF NEW.callee_out_dpid != OLD.callee_out_dpid THEN + UPDATE kamailio.dialplan SET dpid = NEW.callee_out_dpid WHERE dpid = OLD.callee_out_dpid; + UPDATE voip_usr_preferences a, voip_preferences b + SET a.value = NEW.callee_out_dpid + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + UPDATE voip_dom_preferences a, voip_preferences b + SET a.value = NEW.callee_out_dpid + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + UPDATE voip_peer_preferences a, voip_preferences b + SET a.value = NEW.callee_out_dpid + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + END IF; + + END; +| + +CREATE TRIGGER voip_rwrulesets_drepl_trig BEFORE DELETE ON voip_rewrite_rule_sets + FOR EACH ROW BEGIN + + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + DELETE a FROM voip_usr_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + DELETE a FROM voip_dom_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_in_dpid; + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_in_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_in_dpid; + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_caller_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.caller_out_dpid; + DELETE a FROM voip_peer_preferences a, voip_preferences b + WHERE b.attribute = 'rewrite_callee_out_dpid' + AND a.attribute_id = b.id + AND a.value = OLD.callee_out_dpid; + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_in_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.caller_out_dpid; + DELETE FROM kamailio.dialplan WHERE dpid = OLD.callee_out_dpid; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/5833.down b/db_scripts/base/5833.down new file mode 100644 index 00000000..05e1cdb6 --- /dev/null +++ b/db_scripts/base/5833.down @@ -0,0 +1,54 @@ +use provisioning; + +ALTER TABLE `voip_peer_hosts` ADD COLUMN `dp_caller_in_id` int(11) unsigned NOT NULL; +ALTER TABLE `voip_peer_hosts` ADD COLUMN `dp_callee_in_id` int(11) unsigned NOT NULL; +ALTER TABLE `voip_peer_hosts` ADD COLUMN `dp_caller_out_id` int(11) unsigned NOT NULL; +ALTER TABLE `voip_peer_hosts` ADD COLUMN `dp_callee_out_id` int(11) unsigned NOT NULL; + +CREATE TABLE `counter` ( + `name` varchar(64) NOT NULL, + `value` int(11) unsigned NOT NULL, + PRIMARY KEY (`name`) +) ENGINE=InnoDB; + +INSERT INTO counter VALUES('dp_id', 1); + +INSERT INTO voip_preferences (attribute, type, dom_pref, data_type, max_occur, internal) VALUES('dp_dom_caller_in', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, dom_pref, data_type, max_occur, internal) VALUES('dp_dom_callee_in', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, dom_pref, data_type, max_occur, internal) VALUES('dp_dom_caller_out', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, dom_pref, data_type, max_occur, internal) VALUES('dp_dom_callee_out', 1, 1, 'int', 1, 1); + +DROP TRIGGER voip_dom_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/5833.up b/db_scripts/base/5833.up new file mode 100644 index 00000000..a17fd60a --- /dev/null +++ b/db_scripts/base/5833.up @@ -0,0 +1,33 @@ +use provisioning; + +ALTER TABLE `voip_peer_hosts` DROP COLUMN `dp_caller_in_id`; +ALTER TABLE `voip_peer_hosts` DROP COLUMN `dp_callee_in_id`; +ALTER TABLE `voip_peer_hosts` DROP COLUMN `dp_caller_out_id`; +ALTER TABLE `voip_peer_hosts` DROP COLUMN `dp_callee_out_id`; + +DROP TABLE `counter`; + +DELETE FROM voip_preferences where attribute = 'dp_dom_caller_in'; +DELETE FROM voip_preferences where attribute = 'dp_dom_callee_in'; +DELETE FROM voip_preferences where attribute = 'dp_dom_caller_out'; +DELETE FROM voip_preferences where attribute = 'dp_dom_callee_out'; + +DROP TRIGGER voip_dom_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/5843.down b/db_scripts/base/5843.down new file mode 100644 index 00000000..82d9590f --- /dev/null +++ b/db_scripts/base/5843.down @@ -0,0 +1,4 @@ +use provisioning; + +DROP TRIGGER voip_pref_urepl_trig; +DROP TRIGGER voip_pref_drepl_trig; diff --git a/db_scripts/base/5843.up b/db_scripts/base/5843.up new file mode 100644 index 00000000..3e8131f2 --- /dev/null +++ b/db_scripts/base/5843.up @@ -0,0 +1,35 @@ +use provisioning; + +DELIMITER | + +CREATE TRIGGER voip_pref_urepl_trig AFTER UPDATE ON voip_preferences + FOR EACH ROW BEGIN + + IF OLD.attribute != NEW.attribute THEN + UPDATE kamailio.usr_preferences + SET attribute = NEW.attribute + WHERE attribute = OLD.attribute; + UPDATE kamailio.dom_preferences + SET attribute = NEW.attribute + WHERE attribute = OLD.attribute; + UPDATE kamailio.peer_preferences + SET attribute = NEW.attribute + WHERE attribute = OLD.attribute; + END IF; + + END; +| + +CREATE TRIGGER voip_pref_drepl_trig BEFORE DELETE ON voip_preferences + FOR EACH ROW BEGIN + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_*_preferences delete action, but doesn't + DELETE FROM voip_usr_preferences WHERE attribute_id = OLD.id; + DELETE FROM voip_dom_preferences WHERE attribute_id = OLD.id; + DELETE FROM voip_peer_preferences WHERE attribute_id = OLD.id; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/5973.down b/db_scripts/base/5973.down new file mode 100644 index 00000000..e69de29b diff --git a/db_scripts/base/5973.up b/db_scripts/base/5973.up new file mode 100644 index 00000000..272661cb --- /dev/null +++ b/db_scripts/base/5973.up @@ -0,0 +1,5 @@ +USE provisioning; +DELETE FROM provisioning.voip_domains where domain = 'voip.sipwise.local'; +INSERT INTO provisioning.voip_domains (domain) VALUES('voip.sipwise.local'); +INSERT INTO provisioning.voip_subscribers (username, domain_id, uuid, password, create_timestamp) SELECT 'no_such_number', id, '9bcb88b6-541a-43da-8fdc-816f5557ff93', MD5(RAND()), NOW() FROM voip_domains WHERE domain = 'voip.sipwise.local'; +INSERT INTO provisioning.voip_subscribers (username, domain_id, uuid, password, create_timestamp) SELECT 'nagios', id, 'ac1697cf-6933-45ef-9abf-b1278054ded0', 'nagios4Sipwise!', NOW() FROM voip_domains WHERE domain = 'voip.sipwise.local'; diff --git a/db_scripts/base/6254.down b/db_scripts/base/6254.down new file mode 100644 index 00000000..c122cca8 --- /dev/null +++ b/db_scripts/base/6254.down @@ -0,0 +1 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute='e164_to_ruri'; diff --git a/db_scripts/base/6254.up b/db_scripts/base/6254.up new file mode 100644 index 00000000..4ed14c9a --- /dev/null +++ b/db_scripts/base/6254.up @@ -0,0 +1 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) VALUES('e164_to_ruri', 1, 1, 'boolean', 1, 'Send the E164 number instead of SIP AOR as request username when sending INVITE to the subscriber. If a 404 is received the SIP AOR is sent as request URI as fallback.'); diff --git a/db_scripts/base/6346.down b/db_scripts/base/6346.down new file mode 100644 index 00000000..4bb9a333 --- /dev/null +++ b/db_scripts/base/6346.down @@ -0,0 +1,9 @@ +use provisioning; + +DELETE FROM voip_preferences + WHERE attribute = 'user_cli'; + +UPDATE voip_preferences + SET description = 'E.164 number or complete SIP URI. "Calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. Automatically set to the primary E.164 number specified in the subscriber details.' + WHERE attribute = 'cli'; + diff --git a/db_scripts/base/6346.up b/db_scripts/base/6346.up new file mode 100644 index 00000000..43c6b500 --- /dev/null +++ b/db_scripts/base/6346.up @@ -0,0 +1,9 @@ +use provisioning; + +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('user_cli', 0, 1, 'string', 1, 'E.164 number or complete SIP URI. "user-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. If set, this is put in the SIP "From" header (as user-provided calling number) if a client sends a CLI which is not allowed by "allowed_clis" or if "ignore_userprovided_cli" is set.'); + +UPDATE voip_preferences + SET description = 'E.164 number or complete SIP URI. "calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls in the SIP "From" and "P-Asserted-Identity" headers (as user- and network-provided calling numbers). The content of the "From" header may be overridden by the "user_provided_cli" preference and client (if allowed by the "allowed_clis" preference) SIP signalling. Automatically set to the primary E.164 number specified in the subscriber details.' + WHERE attribute = 'cli'; + diff --git a/db_scripts/base/6424.down b/db_scripts/base/6424.down new file mode 100644 index 00000000..cc9a901f --- /dev/null +++ b/db_scripts/base/6424.down @@ -0,0 +1,250 @@ +use accounting; + +ALTER TABLE `cdr` DEFAULT CHARACTER SET latin1; +ALTER TABLE `cdr` MODIFY `source_user_id` char(36) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_provider_id` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_external_subscriber_id` varchar(255) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `source_external_contract_id` varchar(255) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `source_user` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_domain` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_cli` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_user_id` char(36) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_provider_id` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_external_subscriber_id` varchar(255) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `destination_external_contract_id` varchar(255) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `destination_user` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_domain` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_user_dialed` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_user_in` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_domain_in` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `peer_auth_user` varchar(255) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `peer_auth_realm` varchar(255) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `call_type` enum('call','cfu','cft','cfb','cfna') CHARACTER SET latin1 NOT NULL default 'call'; +ALTER TABLE `cdr` MODIFY `call_status` enum('ok','busy','noanswer','cancel','offline','timeout','other') CHARACTER SET latin1 NOT NULL default 'ok'; +ALTER TABLE `cdr` MODIFY `call_code` char(3) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `call_id` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `cdr` MODIFY `rating_status` enum('unrated','ok','failed') CHARACTER SET latin1 NOT NULL default 'unrated'; + +ALTER TABLE `mark` DEFAULT CHARACTER SET latin1; +ALTER TABLE `mark` MODIFY `collector` varchar(255) CHARACTER SET latin1 NOT NULL; + +ALTER TABLE `acc` DEFAULT CHARACTER SET latin1; +ALTER TABLE `acc` MODIFY `method` varchar(16) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `from_tag` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `to_tag` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `callid` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_code` varchar(3) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_reason` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `src_leg` varchar(2048) CHARACTER SET latin1 default NULL; +ALTER TABLE `acc` MODIFY `dst_leg` varchar(2048) CHARACTER SET latin1 default NULL; +ALTER TABLE `acc` MODIFY `dst_user` varchar(64) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_ouser` varchar(64) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_domain` varchar(128) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_user` varchar(64) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_domain` varchar(128) CHARACTER SET latin1 NOT NULL default ''; + +ALTER TABLE `acc_backup` CONVERT TO CHARACTER SET latin1; +ALTER TABLE `acc_trash` CONVERT TO CHARACTER SET latin1; + +use kamailio; + +ALTER DATABASE kamailio DEFAULT CHARACTER SET latin1; + +ALTER TABLE `acc` DEFAULT CHARACTER SET latin1; +ALTER TABLE `acc` MODIFY `method` varchar(16) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `from_tag` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `to_tag` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `callid` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_code` varchar(3) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_reason` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `src_leg` varchar(2048) CHARACTER SET latin1 default NULL; +ALTER TABLE `acc` MODIFY `dst_leg` varchar(2048) CHARACTER SET latin1 default NULL; +ALTER TABLE `acc` MODIFY `dst_user` varchar(64) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_ouser` varchar(64) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_domain` varchar(128) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_user` varchar(64) CHARACTER SET latin1 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_domain` varchar(128) CHARACTER SET latin1 NOT NULL default ''; + +ALTER TABLE `acc_backup` CONVERT TO CHARACTER SET latin1; +ALTER TABLE `acc_trash` CONVERT TO CHARACTER SET latin1; + +ALTER TABLE `dbaliases` DEFAULT CHARACTER SET latin1; +ALTER TABLE `dbaliases` MODIFY `alias_username` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `dbaliases` MODIFY `alias_domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `dbaliases` MODIFY `username` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `dbaliases` MODIFY `domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `dialog` DEFAULT CHARACTER SET latin1; +ALTER TABLE `dialog` MODIFY `callid` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `from_uri` varchar(128) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `from_tag` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `to_uri` varchar(128) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `to_tag` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `caller_cseq` varchar(7) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `callee_cseq` varchar(7) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `caller_route_set` varchar(512) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `dialog` MODIFY `callee_route_set` varchar(512) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `dialog` MODIFY `caller_contact` varchar(128) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `callee_contact` varchar(128) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `caller_sock` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `callee_sock` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialog` MODIFY `req_uri` varchar(128) CHARACTER SET latin1 NOT NULL; + +ALTER TABLE `dialplan` DEFAULT CHARACTER SET latin1; +ALTER TABLE `dialplan` MODIFY `match_exp` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialplan` MODIFY `subst_exp` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialplan` MODIFY `repl_exp` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dialplan` MODIFY `attrs` varchar(32) CHARACTER SET latin1 NOT NULL; + +ALTER TABLE `dispatcher` DEFAULT CHARACTER SET latin1; +ALTER TABLE `dispatcher` MODIFY `destination` varchar(192) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `dispatcher` MODIFY `description` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `domain` DEFAULT CHARACTER SET latin1; +ALTER TABLE `domain` MODIFY `domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `lcr_gw` DEFAULT CHARACTER SET latin1; +ALTER TABLE `lcr_gw` MODIFY `gw_name` varchar(128) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `lcr_gw` MODIFY `ip_addr` varchar(15) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `lcr_gw` MODIFY `hostname` varchar(64) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `lcr_gw` MODIFY `params` varchar(64) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `lcr_gw` MODIFY `tag` varchar(16) CHARACTER SET latin1 DEFAULT NULL; + +ALTER TABLE `lcr_rule` DEFAULT CHARACTER SET latin1; +ALTER TABLE `lcr_rule` MODIFY `prefix` varchar(16) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `lcr_rule` MODIFY `from_uri` varchar(64) CHARACTER SET latin1 DEFAULT NULL; + +ALTER TABLE `lcr_rule_target` DEFAULT CHARACTER SET latin1; + +ALTER TABLE `location` DEFAULT CHARACTER SET latin1; +ALTER TABLE `location` MODIFY `username` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `location` MODIFY `domain` varchar(64) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `location` MODIFY `contact` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `location` MODIFY `received` varchar(128) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `location` MODIFY `path` varchar(128) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `location` MODIFY `callid` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT 'Default-Call-ID'; +ALTER TABLE `location` MODIFY `user_agent` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `location` MODIFY `socket` varchar(64) CHARACTER SET latin1 DEFAULT NULL; + +ALTER TABLE `speed_dial` DEFAULT CHARACTER SET latin1; +ALTER TABLE `speed_dial` MODIFY `username` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `sd_username` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `sd_domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `new_uri` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `fname` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `lname` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `description` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `subscriber` DEFAULT CHARACTER SET latin1; +ALTER TABLE `subscriber` MODIFY `username` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `password` varchar(40) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `email_address` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `ha1` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `ha1b` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `rpid` varchar(64) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `subscriber` MODIFY `uuid` char(36) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `subscriber` MODIFY `timezone` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `trusted` DEFAULT CHARACTER SET latin1; +ALTER TABLE `trusted` MODIFY `src_ip` varchar(50) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `trusted` MODIFY `proto` varchar(4) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `trusted` MODIFY `from_pattern` varchar(64) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `trusted` MODIFY `tag` varchar(64) CHARACTER SET latin1 DEFAULT NULL; + +ALTER TABLE `usr_preferences` DEFAULT CHARACTER SET latin1; +ALTER TABLE `usr_preferences` MODIFY `uuid` char(36) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `usr_preferences` MODIFY `username` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT '0'; +ALTER TABLE `usr_preferences` MODIFY `domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `usr_preferences` MODIFY `attribute` varchar(32) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `usr_preferences` MODIFY `value` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `dom_preferences` DEFAULT CHARACTER SET latin1; +ALTER TABLE `dom_preferences` MODIFY `uuid` char(36) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `dom_preferences` MODIFY `username` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT '0'; +ALTER TABLE `dom_preferences` MODIFY `domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `dom_preferences` MODIFY `attribute` varchar(32) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `dom_preferences` MODIFY `value` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `peer_preferences` DEFAULT CHARACTER SET latin1; +ALTER TABLE `peer_preferences` MODIFY `uuid` varchar(36) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `peer_preferences` MODIFY `username` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT '0'; +ALTER TABLE `peer_preferences` MODIFY `domain` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `peer_preferences` MODIFY `attribute` varchar(32) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `peer_preferences` MODIFY `value` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT ''; + +ALTER TABLE `address` DEFAULT CHARACTER SET latin1; +ALTER TABLE `address` MODIFY `ip_addr` varchar(15) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `address` MODIFY `tag` VARCHAR(64) CHARACTER SET latin1; + +ALTER TABLE `version` DEFAULT CHARACTER SET latin1; +ALTER TABLE `version` MODIFY `table_name` varchar(32) CHARACTER SET latin1 NOT NULL; + +SET FOREIGN_KEY_CHECKS=0; + +ALTER TABLE `voicemail_users` DEFAULT CHARACTER SET latin1; +ALTER TABLE `voicemail_users` MODIFY `customer_id` char(36) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `context` varchar(63) CHARACTER SET latin1 NOT NULL DEFAULT 'default'; +ALTER TABLE `voicemail_users` MODIFY `mailbox` varchar(31) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `voicemail_users` MODIFY `password` varchar(31) CHARACTER SET latin1 NOT NULL DEFAULT '0'; +ALTER TABLE `voicemail_users` MODIFY `fullname` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `email` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `pager` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `tz` varchar(10) CHARACTER SET latin1 NOT NULL DEFAULT 'central'; +ALTER TABLE `voicemail_users` MODIFY `attach` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'yes'; +ALTER TABLE `voicemail_users` MODIFY `saycid` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'yes'; +ALTER TABLE `voicemail_users` MODIFY `dialout` varchar(10) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `callback` varchar(10) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `review` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `operator` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `envelope` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `sayduration` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `sendvoicemail` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `delete` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `nextaftercmd` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'yes'; +ALTER TABLE `voicemail_users` MODIFY `forcename` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `forcegreetings` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `hidefromdir` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'yes'; + +ALTER TABLE `voicemail_spool` DEFAULT CHARACTER SET latin1; +ALTER TABLE `voicemail_spool` MODIFY `dir` varchar(127) CHARACTER SET latin1 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `context` varchar(63) CHARACTER SET latin1 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `macrocontext` varchar(63) CHARACTER SET latin1 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `callerid` varchar(255) CHARACTER SET latin1 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `origtime` varchar(16) CHARACTER SET latin1 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `duration` varchar(16) CHARACTER SET latin1 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `mailboxuser` varchar(255) CHARACTER SET latin1 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `mailboxcontext` varchar(63) CHARACTER SET latin1 DEFAULT ''; + +SET FOREIGN_KEY_CHECKS=1; + +ALTER TABLE `fax_preferences` DEFAULT CHARACTER SET latin1; +ALTER TABLE `fax_preferences` MODIFY `password` varchar(64) CHARACTER SET latin1 default NULL; +ALTER TABLE `fax_preferences` MODIFY `name` varchar(64) CHARACTER SET latin1 default NULL; +ALTER TABLE `fax_preferences` MODIFY `active` enum('true','false') CHARACTER SET latin1 NOT NULL default 'true'; +ALTER TABLE `fax_preferences` MODIFY `send_status` enum('true','false') CHARACTER SET latin1 NOT NULL default 'false'; +ALTER TABLE `fax_preferences` MODIFY `send_copy` enum('true','false') CHARACTER SET latin1 NOT NULL default 'false'; +ALTER TABLE `fax_preferences` MODIFY `send_copy_cc` enum('true','false') CHARACTER SET latin1 NOT NULL default 'false'; + +ALTER TABLE `fax_destinations` DEFAULT CHARACTER SET latin1; +ALTER TABLE `fax_destinations` MODIFY `destination` varchar(64) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `fax_destinations` MODIFY `filetype` enum('ps','tiff','pdf','pdf14') CHARACTER SET latin1 NOT NULL default 'tiff'; +ALTER TABLE `fax_destinations` MODIFY `cc` enum('true','false') CHARACTER SET latin1 NOT NULL default 'false'; +ALTER TABLE `fax_destinations` MODIFY `incoming` enum('true','false') CHARACTER SET latin1 NOT NULL default 'true'; +ALTER TABLE `fax_destinations` MODIFY `outgoing` enum('true','false') CHARACTER SET latin1 NOT NULL default 'false'; +ALTER TABLE `fax_destinations` MODIFY `status` enum('true','false') CHARACTER SET latin1 NOT NULL default 'false'; + +ALTER TABLE `sems_registrations` DEFAULT CHARACTER SET latin1; +ALTER TABLE `sems_registrations` MODIFY `last_reason` varchar(256) CHARACTER SET latin1 DEFAULT NULL; +ALTER TABLE `sems_registrations` MODIFY `contacts` varchar(512) CHARACTER SET latin1 DEFAULT NULL; + +ALTER TABLE `fax_journal` DEFAULT CHARACTER SET latin1; +ALTER TABLE `fax_journal` MODIFY `direction` enum('in','out') CHARACTER SET latin1 NOT NULL DEFAULT 'in'; +ALTER TABLE `fax_journal` MODIFY `peer_number` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `peer_name` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `reason` varchar(255) CHARACTER SET latin1 NOT NULL; +ALTER TABLE `fax_journal` MODIFY `status` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `quality` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `filename` varchar(255) CHARACTER SET latin1 NOT NULL DEFAULT ''; + diff --git a/db_scripts/base/6424.up b/db_scripts/base/6424.up new file mode 100644 index 00000000..19edace6 --- /dev/null +++ b/db_scripts/base/6424.up @@ -0,0 +1,257 @@ +use accounting; + +ALTER TABLE `cdr` DEFAULT CHARACTER SET utf8; +ALTER TABLE `cdr` MODIFY `source_user_id` char(36) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_provider_id` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_external_subscriber_id` varchar(255) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `source_external_contract_id` varchar(255) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `source_user` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_domain` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `source_cli` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_user_id` char(36) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_provider_id` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_external_subscriber_id` varchar(255) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `destination_external_contract_id` varchar(255) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `destination_user` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_domain` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_user_dialed` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_user_in` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `destination_domain_in` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `peer_auth_user` varchar(255) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `peer_auth_realm` varchar(255) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `cdr` MODIFY `call_type` enum('call','cfu','cft','cfb','cfna') CHARACTER SET utf8 NOT NULL default 'call'; +ALTER TABLE `cdr` MODIFY `call_status` enum('ok','busy','noanswer','cancel','offline','timeout','other') CHARACTER SET utf8 NOT NULL default 'ok'; +ALTER TABLE `cdr` MODIFY `call_code` char(3) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `call_id` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `cdr` MODIFY `rating_status` enum('unrated','ok','failed') CHARACTER SET utf8 NOT NULL default 'unrated'; + +ALTER TABLE `mark` DEFAULT CHARACTER SET utf8; +ALTER TABLE `mark` MODIFY `collector` varchar(255) CHARACTER SET utf8 NOT NULL; + +ALTER TABLE `acc` DEFAULT CHARACTER SET utf8; +ALTER TABLE `acc` MODIFY `method` varchar(16) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `from_tag` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `to_tag` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `callid` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_code` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_reason` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `src_leg` varchar(2048) CHARACTER SET utf8 default NULL; +ALTER TABLE `acc` MODIFY `dst_leg` varchar(2048) CHARACTER SET utf8 default NULL; +ALTER TABLE `acc` MODIFY `dst_user` varchar(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_ouser` varchar(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_domain` varchar(128) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_user` varchar(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_domain` varchar(128) CHARACTER SET utf8 NOT NULL default ''; + +ALTER TABLE `acc_backup` CONVERT TO CHARACTER SET utf8; +ALTER TABLE `acc_trash` CONVERT TO CHARACTER SET utf8; + +use kamailio; + +ALTER DATABASE kamailio DEFAULT CHARACTER SET utf8; + +ALTER TABLE `acc` DEFAULT CHARACTER SET utf8; +ALTER TABLE `acc` MODIFY `method` varchar(16) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `from_tag` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `to_tag` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `callid` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_code` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `sip_reason` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc` MODIFY `src_leg` varchar(2048) CHARACTER SET utf8 default NULL; +ALTER TABLE `acc` MODIFY `dst_leg` varchar(2048) CHARACTER SET utf8 default NULL; +ALTER TABLE `acc` MODIFY `dst_user` varchar(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_ouser` varchar(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `dst_domain` varchar(128) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_user` varchar(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE `acc` MODIFY `src_domain` varchar(128) CHARACTER SET utf8 NOT NULL default ''; + +ALTER TABLE `acc_backup` CONVERT TO CHARACTER SET utf8; +ALTER TABLE `acc_backup` MODIFY `sip_reason` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc_backup` MODIFY `src_leg` varchar(2048) CHARACTER SET utf8 default NULL; +ALTER TABLE `acc_backup` MODIFY `dst_leg` varchar(2048) CHARACTER SET utf8 default NULL; + +ALTER TABLE `acc_trash` CONVERT TO CHARACTER SET utf8; +ALTER TABLE `acc_trash` MODIFY `sip_reason` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `acc_trash` MODIFY `src_leg` varchar(2048) CHARACTER SET utf8 default NULL; +ALTER TABLE `acc_trash` MODIFY `dst_leg` varchar(2048) CHARACTER SET utf8 default NULL; + +ALTER TABLE `dbaliases` DEFAULT CHARACTER SET utf8; +ALTER TABLE `dbaliases` MODIFY `alias_username` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `dbaliases` MODIFY `alias_domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `dbaliases` MODIFY `username` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `dbaliases` MODIFY `domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `dialog` DEFAULT CHARACTER SET utf8; +ALTER TABLE `dialog` MODIFY `callid` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `from_uri` varchar(128) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `from_tag` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `to_uri` varchar(128) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `to_tag` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `caller_cseq` varchar(7) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `callee_cseq` varchar(7) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `caller_route_set` varchar(512) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `dialog` MODIFY `callee_route_set` varchar(512) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `dialog` MODIFY `caller_contact` varchar(128) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `callee_contact` varchar(128) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `caller_sock` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `callee_sock` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialog` MODIFY `req_uri` varchar(128) CHARACTER SET utf8 NOT NULL; + +ALTER TABLE `dialplan` DEFAULT CHARACTER SET utf8; +ALTER TABLE `dialplan` MODIFY `match_exp` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialplan` MODIFY `subst_exp` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialplan` MODIFY `repl_exp` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dialplan` MODIFY `attrs` varchar(32) CHARACTER SET utf8 NOT NULL; + +ALTER TABLE `dispatcher` DEFAULT CHARACTER SET utf8; +ALTER TABLE `dispatcher` MODIFY `destination` varchar(192) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `dispatcher` MODIFY `description` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `domain` DEFAULT CHARACTER SET utf8; +ALTER TABLE `domain` MODIFY `domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `lcr_gw` DEFAULT CHARACTER SET utf8; +ALTER TABLE `lcr_gw` MODIFY `gw_name` varchar(128) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `lcr_gw` MODIFY `ip_addr` varchar(15) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `lcr_gw` MODIFY `hostname` varchar(64) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `lcr_gw` MODIFY `params` varchar(64) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `lcr_gw` MODIFY `tag` varchar(16) CHARACTER SET utf8 DEFAULT NULL; + +ALTER TABLE `lcr_rule` DEFAULT CHARACTER SET utf8; +ALTER TABLE `lcr_rule` MODIFY `prefix` varchar(16) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `lcr_rule` MODIFY `from_uri` varchar(64) CHARACTER SET utf8 DEFAULT NULL; + +ALTER TABLE `lcr_rule_target` DEFAULT CHARACTER SET utf8; + +ALTER TABLE `location` DEFAULT CHARACTER SET utf8; +ALTER TABLE `location` MODIFY `username` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `location` MODIFY `domain` varchar(64) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `location` MODIFY `contact` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `location` MODIFY `received` varchar(128) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `location` MODIFY `path` varchar(128) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `location` MODIFY `callid` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'Default-Call-ID'; +ALTER TABLE `location` MODIFY `user_agent` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `location` MODIFY `socket` varchar(64) CHARACTER SET utf8 DEFAULT NULL; + +ALTER TABLE `speed_dial` DEFAULT CHARACTER SET utf8; +ALTER TABLE `speed_dial` MODIFY `username` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `sd_username` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `sd_domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `new_uri` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `fname` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `lname` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `speed_dial` MODIFY `description` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `subscriber` DEFAULT CHARACTER SET utf8; +ALTER TABLE `subscriber` MODIFY `username` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `password` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `email_address` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `ha1` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `ha1b` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `subscriber` MODIFY `rpid` varchar(64) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `subscriber` MODIFY `uuid` char(36) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `subscriber` MODIFY `timezone` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `trusted` DEFAULT CHARACTER SET utf8; +ALTER TABLE `trusted` MODIFY `src_ip` varchar(50) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `trusted` MODIFY `proto` varchar(4) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `trusted` MODIFY `from_pattern` varchar(64) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `trusted` MODIFY `tag` varchar(64) CHARACTER SET utf8 DEFAULT NULL; + +ALTER TABLE `usr_preferences` DEFAULT CHARACTER SET utf8; +ALTER TABLE `usr_preferences` MODIFY `uuid` char(36) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `usr_preferences` MODIFY `username` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT '0'; +ALTER TABLE `usr_preferences` MODIFY `domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `usr_preferences` MODIFY `attribute` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `usr_preferences` MODIFY `value` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `dom_preferences` DEFAULT CHARACTER SET utf8; +ALTER TABLE `dom_preferences` MODIFY `uuid` char(36) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `dom_preferences` MODIFY `username` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT '0'; +ALTER TABLE `dom_preferences` MODIFY `domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `dom_preferences` MODIFY `attribute` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `dom_preferences` MODIFY `value` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `peer_preferences` DEFAULT CHARACTER SET utf8; +ALTER TABLE `peer_preferences` MODIFY `uuid` varchar(36) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `peer_preferences` MODIFY `username` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT '0'; +ALTER TABLE `peer_preferences` MODIFY `domain` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `peer_preferences` MODIFY `attribute` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `peer_preferences` MODIFY `value` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT ''; + +ALTER TABLE `address` DEFAULT CHARACTER SET utf8; +ALTER TABLE `address` MODIFY `ip_addr` varchar(15) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `address` MODIFY `tag` VARCHAR(64) CHARACTER SET utf8; + +ALTER TABLE `version` DEFAULT CHARACTER SET utf8; +ALTER TABLE `version` MODIFY `table_name` varchar(32) CHARACTER SET utf8 NOT NULL; + +SET FOREIGN_KEY_CHECKS=0; + +ALTER TABLE `voicemail_users` DEFAULT CHARACTER SET utf8; +ALTER TABLE `voicemail_users` MODIFY `customer_id` char(36) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `context` varchar(63) CHARACTER SET utf8 NOT NULL DEFAULT 'default'; +ALTER TABLE `voicemail_users` MODIFY `mailbox` varchar(31) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `voicemail_users` MODIFY `password` varchar(31) CHARACTER SET utf8 NOT NULL DEFAULT '0'; +ALTER TABLE `voicemail_users` MODIFY `fullname` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `email` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `pager` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `tz` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT 'central'; +ALTER TABLE `voicemail_users` MODIFY `attach` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'yes'; +ALTER TABLE `voicemail_users` MODIFY `saycid` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'yes'; +ALTER TABLE `voicemail_users` MODIFY `dialout` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `callback` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `voicemail_users` MODIFY `review` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `operator` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `envelope` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `sayduration` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `sendvoicemail` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `delete` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `nextaftercmd` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'yes'; +ALTER TABLE `voicemail_users` MODIFY `forcename` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `forcegreetings` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'no'; +ALTER TABLE `voicemail_users` MODIFY `hidefromdir` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT 'yes'; + +ALTER TABLE `voicemail_spool` DEFAULT CHARACTER SET utf8; +ALTER TABLE `voicemail_spool` MODIFY `dir` varchar(127) CHARACTER SET utf8 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `context` varchar(63) CHARACTER SET utf8 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `macrocontext` varchar(63) CHARACTER SET utf8 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `callerid` varchar(255) CHARACTER SET utf8 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `origtime` varchar(16) CHARACTER SET utf8 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `duration` varchar(16) CHARACTER SET utf8 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `mailboxuser` varchar(255) CHARACTER SET utf8 DEFAULT ''; +ALTER TABLE `voicemail_spool` MODIFY `mailboxcontext` varchar(63) CHARACTER SET utf8 DEFAULT ''; + +SET FOREIGN_KEY_CHECKS=1; + +ALTER TABLE `fax_preferences` DEFAULT CHARACTER SET utf8; +ALTER TABLE `fax_preferences` MODIFY `password` varchar(64) CHARACTER SET utf8 default NULL; +ALTER TABLE `fax_preferences` MODIFY `name` varchar(64) CHARACTER SET utf8 default NULL; +ALTER TABLE `fax_preferences` MODIFY `active` enum('true','false') CHARACTER SET utf8 NOT NULL default 'true'; +ALTER TABLE `fax_preferences` MODIFY `send_status` enum('true','false') CHARACTER SET utf8 NOT NULL default 'false'; +ALTER TABLE `fax_preferences` MODIFY `send_copy` enum('true','false') CHARACTER SET utf8 NOT NULL default 'false'; +ALTER TABLE `fax_preferences` MODIFY `send_copy_cc` enum('true','false') CHARACTER SET utf8 NOT NULL default 'false'; + +ALTER TABLE `fax_destinations` DEFAULT CHARACTER SET utf8; +ALTER TABLE `fax_destinations` MODIFY `destination` varchar(64) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `fax_destinations` MODIFY `filetype` enum('ps','tiff','pdf','pdf14') CHARACTER SET utf8 NOT NULL default 'tiff'; +ALTER TABLE `fax_destinations` MODIFY `cc` enum('true','false') CHARACTER SET utf8 NOT NULL default 'false'; +ALTER TABLE `fax_destinations` MODIFY `incoming` enum('true','false') CHARACTER SET utf8 NOT NULL default 'true'; +ALTER TABLE `fax_destinations` MODIFY `outgoing` enum('true','false') CHARACTER SET utf8 NOT NULL default 'false'; +ALTER TABLE `fax_destinations` MODIFY `status` enum('true','false') CHARACTER SET utf8 NOT NULL default 'false'; + +ALTER TABLE `sems_registrations` DEFAULT CHARACTER SET utf8; +ALTER TABLE `sems_registrations` MODIFY `last_reason` varchar(256) CHARACTER SET utf8 DEFAULT NULL; +ALTER TABLE `sems_registrations` MODIFY `contacts` varchar(512) CHARACTER SET utf8 DEFAULT NULL; + +ALTER TABLE `fax_journal` DEFAULT CHARACTER SET utf8; +ALTER TABLE `fax_journal` MODIFY `direction` enum('in','out') CHARACTER SET utf8 NOT NULL DEFAULT 'in'; +ALTER TABLE `fax_journal` MODIFY `peer_number` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `peer_name` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `reason` varchar(255) CHARACTER SET utf8 NOT NULL; +ALTER TABLE `fax_journal` MODIFY `status` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `quality` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; +ALTER TABLE `fax_journal` MODIFY `filename` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT ''; + diff --git a/db_scripts/base/6435.down b/db_scripts/base/6435.down new file mode 100644 index 00000000..276021fe --- /dev/null +++ b/db_scripts/base/6435.down @@ -0,0 +1,18 @@ +use kamailio; + +ALTER TABLE `acc` DROP COLUMN `time_hires`; +ALTER TABLE `acc_backup` DROP COLUMN `time_hires`; +ALTER TABLE `acc_trash` DROP COLUMN `time_hires`; + +use accounting; + +ALTER TABLE `acc` DROP COLUMN `time_hires`; +ALTER TABLE `acc_backup` DROP COLUMN `time_hires`; +ALTER TABLE `acc_trash` DROP COLUMN `time_hires`; + +ALTER TABLE `cdr` ADD COLUMN `t3mp_start_time` timestamp NOT NULL default '0000-00-00 00:00:00' AFTER `start_time`; + UPDATE `cdr` SET t3mp_start_time=FROM_UNIXTIME(start_time); +ALTER TABLE `cdr` DROP COLUMN `start_time`; +ALTER TABLE `cdr` CHANGE COLUMN `t3mp_start_time` `start_time` timestamp NOT NULL default '0000-00-00 00:00:00'; + +ALTER TABLE `cdr` MODIFY `duration` int(10) unsigned NOT NULL; diff --git a/db_scripts/base/6435.up b/db_scripts/base/6435.up new file mode 100644 index 00000000..ab2495d2 --- /dev/null +++ b/db_scripts/base/6435.up @@ -0,0 +1,20 @@ +use kamailio; + +ALTER TABLE `acc` ADD COLUMN `time_hires` decimal(13,3) NOT NULL AFTER `time`; +UPDATE `acc` SET time_hires=time; +ALTER TABLE `acc_backup` ADD COLUMN `time_hires` decimal(13,3) NOT NULL AFTER `time`; +ALTER TABLE `acc_trash` ADD COLUMN `time_hires` decimal(13,3) NOT NULL AFTER `time`; + +use accounting; + +ALTER TABLE `acc` ADD COLUMN `time_hires` decimal(13,3) NOT NULL AFTER `time`; +UPDATE `acc` SET time_hires=time; +ALTER TABLE `acc_backup` ADD COLUMN `time_hires` decimal(13,3) NOT NULL AFTER `time`; +ALTER TABLE `acc_trash` ADD COLUMN `time_hires` decimal(13,3) NOT NULL AFTER `time`; + +ALTER TABLE `cdr` ADD COLUMN `t3mp_start_time` decimal(13,3) NOT NULL AFTER start_time; + UPDATE `cdr` SET t3mp_start_time=UNIX_TIMESTAMP(start_time); +ALTER TABLE `cdr` DROP COLUMN `start_time`; +ALTER TABLE `cdr` CHANGE COLUMN `t3mp_start_time` `start_time` decimal(13,3) NOT NULL; + +ALTER TABLE `cdr` MODIFY `duration` decimal(13,3) NOT NULL; diff --git a/db_scripts/base/6459.down b/db_scripts/base/6459.down new file mode 100644 index 00000000..263b19fa --- /dev/null +++ b/db_scripts/base/6459.down @@ -0,0 +1 @@ +DELETE FROM provisioning.voip_preferences WHERE attribute = 'prepaid'; diff --git a/db_scripts/base/6459.up b/db_scripts/base/6459.up new file mode 100644 index 00000000..b478a622 --- /dev/null +++ b/db_scripts/base/6459.up @@ -0,0 +1 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('prepaid', 1, 1, 'boolean', 1, 1); diff --git a/db_scripts/base/6465.down b/db_scripts/base/6465.down new file mode 100644 index 00000000..468464e5 --- /dev/null +++ b/db_scripts/base/6465.down @@ -0,0 +1 @@ +UPDATE billing.billing_profiles SET prepaid = 1 WHERE id = 1 AND handle = 'default' and name = 'Default Billing Profile'; diff --git a/db_scripts/base/6465.up b/db_scripts/base/6465.up new file mode 100644 index 00000000..67717d5e --- /dev/null +++ b/db_scripts/base/6465.up @@ -0,0 +1,2 @@ +# set prepaid to default value for the default billing profile +UPDATE billing.billing_profiles SET prepaid = NULL WHERE id = 1 AND handle = 'default' and name = 'Default Billing Profile'; diff --git a/db_scripts/base/6551.down b/db_scripts/base/6551.down new file mode 100644 index 00000000..821a59af --- /dev/null +++ b/db_scripts/base/6551.down @@ -0,0 +1,3 @@ +use carrier; + +ALTER TABLE `contracts` MODIFY `url` varchar(31) NOT NULL; diff --git a/db_scripts/base/6551.up b/db_scripts/base/6551.up new file mode 100644 index 00000000..42f0de5e --- /dev/null +++ b/db_scripts/base/6551.up @@ -0,0 +1,3 @@ +use carrier; + +ALTER TABLE `contracts` MODIFY `url` varchar(31) NULL default NULL; diff --git a/db_scripts/base/6560.down b/db_scripts/base/6560.down new file mode 100644 index 00000000..398302b1 --- /dev/null +++ b/db_scripts/base/6560.down @@ -0,0 +1,5 @@ +use accounting; + +ALTER TABLE cdr DROP COLUMN carrier_free_time, + DROP COLUMN reseller_free_time, + DROP COLUMN customer_free_time; diff --git a/db_scripts/base/6560.up b/db_scripts/base/6560.up new file mode 100644 index 00000000..9a9528e9 --- /dev/null +++ b/db_scripts/base/6560.up @@ -0,0 +1,5 @@ +use accounting; + +ALTER TABLE cdr ADD COLUMN carrier_free_time int unsigned AFTER customer_cost, + ADD COLUMN reseller_free_time int unsigned AFTER carrier_free_time, + ADD COLUMN customer_free_time int unsigned AFTER reseller_free_time; diff --git a/db_scripts/base/6568.down b/db_scripts/base/6568.down new file mode 100644 index 00000000..1c2d3c7a --- /dev/null +++ b/db_scripts/base/6568.down @@ -0,0 +1,3 @@ +use accounting; + +drop table prepaid_costs; diff --git a/db_scripts/base/6568.up b/db_scripts/base/6568.up new file mode 100644 index 00000000..0fb37da7 --- /dev/null +++ b/db_scripts/base/6568.up @@ -0,0 +1,9 @@ +use accounting; + +CREATE TABLE `prepaid_costs` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `call_id` varchar(255) NOT NULL, + `cost` double NOT NULL, + `free_time_used` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; diff --git a/db_scripts/base/6619.down b/db_scripts/base/6619.down new file mode 100644 index 00000000..8ec1740f --- /dev/null +++ b/db_scripts/base/6619.down @@ -0,0 +1,3 @@ +use carrier; + +ALTER TABLE `contracts` MODIFY `sip_uri` varchar(127) NOT NULL; diff --git a/db_scripts/base/6619.up b/db_scripts/base/6619.up new file mode 100644 index 00000000..2c775078 --- /dev/null +++ b/db_scripts/base/6619.up @@ -0,0 +1,3 @@ +use carrier; + +ALTER TABLE `contracts` MODIFY `sip_uri` varchar(127) NULL default NULL; diff --git a/db_scripts/base/6624.down b/db_scripts/base/6624.down new file mode 100644 index 00000000..b6b4d906 --- /dev/null +++ b/db_scripts/base/6624.down @@ -0,0 +1 @@ +ALTER TABLE `billing`.`voip_numbers` DROP KEY `number_idx`; diff --git a/db_scripts/base/6624.up b/db_scripts/base/6624.up new file mode 100644 index 00000000..45dcb18c --- /dev/null +++ b/db_scripts/base/6624.up @@ -0,0 +1 @@ +ALTER TABLE `billing`.`voip_numbers` ADD UNIQUE KEY `number_idx` (`cc`,`ac`,`sn`); diff --git a/db_scripts/base/6643.down b/db_scripts/base/6643.down new file mode 100644 index 00000000..c230c711 --- /dev/null +++ b/db_scripts/base/6643.down @@ -0,0 +1,42 @@ +ALTER TABLE `provisioning`.`voip_peer_hosts` DROP COLUMN `host`; + +USE provisioning; + +DROP TRIGGER voip_phost_crepl_trig; +DROP TRIGGER voip_phost_urepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_phost_crepl_trig AFTER INSERT ON voip_peer_hosts + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_gw (lcr_id, gw_name, ip_addr, port, uri_scheme, transport, strip, flags, group_id) + VALUES(1, NEW.name, NEW.ip, NEW.port, 1, 1, 0, NEW.id, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT rule.lcr_id, rule.id, LAST_INSERT_ID(), vpg.priority, NEW.weight + FROM kamailio.lcr_rule rule + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = rule.group_id + WHERE vpg.id = NEW.group_id; + + END; +| + +CREATE TRIGGER voip_phost_urepl_trig AFTER UPDATE ON voip_peer_hosts + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_gw + SET gw_name = NEW.name, ip_addr = NEW.ip, port = NEW.port, flags = NEW.id + WHERE lcr_id = 1 AND ip_addr = OLD.ip; + + UPDATE kamailio.lcr_rule_target rt, kamailio.lcr_gw gw + SET rt.weight = NEW.weight + WHERE gw.id = rt.gw_id + AND gw.lcr_id = 1 + AND gw.group_id = NEW.group_id + AND gw.ip_addr = NEW.ip; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/6643.up b/db_scripts/base/6643.up new file mode 100644 index 00000000..d2229b8b --- /dev/null +++ b/db_scripts/base/6643.up @@ -0,0 +1,42 @@ +ALTER TABLE `provisioning`.`voip_peer_hosts` ADD COLUMN `host` VARCHAR(64) DEFAULT NULL AFTER `ip`; + +USE provisioning; + +DROP TRIGGER provisioning.voip_phost_crepl_trig; +DROP TRIGGER voip_phost_urepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_phost_crepl_trig AFTER INSERT ON voip_peer_hosts + FOR EACH ROW BEGIN + + INSERT INTO kamailio.lcr_gw (lcr_id, gw_name, ip_addr, hostname, port, uri_scheme, transport, strip, flags, group_id) + VALUES(1, NEW.name, NEW.ip, NEW.host, NEW.port, 1, 1, 0, NEW.id, NEW.group_id); + + INSERT INTO kamailio.lcr_rule_target (lcr_id, rule_id, gw_id, priority, weight) + SELECT rule.lcr_id, rule.id, LAST_INSERT_ID(), vpg.priority, NEW.weight + FROM kamailio.lcr_rule rule + INNER JOIN provisioning.voip_peer_groups vpg ON vpg.id = rule.group_id + WHERE vpg.id = NEW.group_id; + + END; +| + +CREATE TRIGGER voip_phost_urepl_trig AFTER UPDATE ON voip_peer_hosts + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr_gw + SET gw_name = NEW.name, ip_addr = NEW.ip, hostname = NEW.host, port = NEW.port, flags = NEW.id + WHERE lcr_id = 1 AND ip_addr = OLD.ip; + + UPDATE kamailio.lcr_rule_target rt, kamailio.lcr_gw gw + SET rt.weight = NEW.weight + WHERE gw.id = rt.gw_id + AND gw.lcr_id = 1 + AND gw.group_id = NEW.group_id + AND gw.ip_addr = NEW.ip; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/6712.down b/db_scripts/base/6712.down new file mode 100644 index 00000000..b4aafe51 --- /dev/null +++ b/db_scripts/base/6712.down @@ -0,0 +1,13 @@ +use provisioning; + +UPDATE voip_preferences + SET description = 'E.164 number or complete SIP URI. "calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls in the SIP "From" and "P-Asserted-Identity" headers (as user- and network-provided calling numbers). The content of the "From" header may be overridden by the "user_provided_cli" preference and client (if allowed by the "allowed_clis" preference) SIP signalling. Automatically set to the primary E.164 number specified in the subscriber details.' + WHERE attribute = 'cli'; + +UPDATE voip_preferences + SET description = 'E.164 number or complete SIP URI. "user-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. If set, this is put in the SIP "From" header (as user-provided calling number) if a client sends a CLI which is not allowed by "allowed_clis" or if "ignore_userprovided_cli" is set.' + WHERE attribute = 'user_cli'; + +UPDATE voip_preferences + SET attribute='ignore_userprovided_cli', description = 'Discard any subscriber provided CLI information' + WHERE attribute='omit_outbound_displayname'; diff --git a/db_scripts/base/6712.up b/db_scripts/base/6712.up new file mode 100644 index 00000000..d34ff8dc --- /dev/null +++ b/db_scripts/base/6712.up @@ -0,0 +1,13 @@ +use provisioning; + +UPDATE voip_preferences + SET description = 'E.164 number or complete SIP URI. "network-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls in the SIP "From" and "P-Asserted-Identity" headers (as user- and network-provided calling numbers). The content of the "From" header may be overridden by the "user_cli" preference and client (if allowed by the "allowed_clis" preference) SIP signalling. Automatically set to the primary E.164 number specified in the subscriber details.' + WHERE attribute = 'cli'; + +UPDATE voip_preferences + SET description = 'E.164 number or complete SIP URI. "user-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. If set, this is put in the SIP "From" header (as user-provided calling number) if a client sends a CLI which is not allowed by "allowed_clis" or if "allowed_clis" is not set.' + WHERE attribute = 'user_cli'; + +UPDATE voip_preferences + SET attribute='omit_outbound_displayname', description = 'Suppress the caller display-name that is put in the SIP "From" header on outgoing calls.' + WHERE attribute='ignore_userprovided_cli'; diff --git a/db_scripts/base/6746.down b/db_scripts/base/6746.down new file mode 100644 index 00000000..6c07d5a0 --- /dev/null +++ b/db_scripts/base/6746.down @@ -0,0 +1 @@ +-- NOP, because we can't set all voicemail passwords to 0. diff --git a/db_scripts/base/6746.up b/db_scripts/base/6746.up new file mode 100644 index 00000000..1946a59e --- /dev/null +++ b/db_scripts/base/6746.up @@ -0,0 +1 @@ +UPDATE kamailio.voicemail_users SET password=FLOOR(1000+RAND()*9000) WHERE password=0; diff --git a/db_scripts/base/tmp/0010_create_oss.up b/db_scripts/base/tmp/0010_create_oss.up new file mode 100644 index 00000000..fef94be2 --- /dev/null +++ b/db_scripts/base/tmp/0010_create_oss.up @@ -0,0 +1,591 @@ +-- step out of our provisioning DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS provisioning; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE IF NOT EXISTS provisioning CHARACTER SET 'utf8'; + +USE provisioning; + +-- create domain table +CREATE TABLE `voip_domains` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain` varchar(127) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `domain_idx` (`domain`) +) ENGINE=InnoDB; + + +-- create subscriber table +CREATE TABLE `voip_subscribers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `username` varchar(127) NOT NULL, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_domains` (`id`), + `uuid` char(36) NOT NULL, + `password` varchar(40) default NULL, + `admin` bool NOT NULL DEFAULT FALSE, + `account_id` int(11) UNSIGNED NULL DEFAULT NULL, + `webusername` varchar(127) default NULL, + `webpassword` varchar(40) default NULL, + `autoconf_displayname` varchar(255) default NULL, + `autoconf_group_id` int(11) unsigned default NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `user_dom_idx` (`username`,`domain_id`), + UNIQUE KEY `uuid_idx` (`uuid`), + KEY `accountid_idx` (`account_id`), + KEY `domainid_idx` (`domain_id`), + CONSTRAINT `v_s_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create alias table +CREATE TABLE `voip_dbaliases` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `username` varchar(127) NOT NULL, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_domains` (`id`), + `subscriber_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_subscribers` (`id`), + PRIMARY KEY (`id`), + UNIQUE KEY `user_dom_idx` (`username`,`domain_id`), + KEY `domainid_idx` (`domain_id`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_da_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_da_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- sip peering tables +CREATE TABLE `voip_peer_groups` ( + `id` int(11) unsigned NOT NULL auto_increment, + `name` varchar(127) NOT NULL, + `priority` tinyint(3) NOT NULL default '1', + `description` varchar(255), + `peering_contract_id` int(11) unsigned, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_peer_rules` ( + `id` int(11) unsigned NOT NULL auto_increment, + `group_id` int(11) unsigned NOT NULL, + `callee_prefix` varchar(64) NOT NULL default '', + `caller_prefix` varchar(64) default NULL, + `description` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `grpidx` (`group_id`), + CONSTRAINT `v_pg_groupid_ref` FOREIGN KEY (`group_id`) REFERENCES `voip_peer_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_peer_hosts` ( + `id` int(11) unsigned NOT NULL auto_increment, + `group_id` int(11) unsigned NOT NULL, + `name` varchar(64) NOT NULL default '', + `ip` varchar(64) NOT NULL, + `host` varchar(64) DEFAULT NULL, + `port` int(5) NOT NULL default '5060', + `weight` tinyint(3) NOT NULL default '0', + `via_lb` tinyint(1) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `grpname` (`group_id`,`name`), + KEY `grpidx` (`group_id`), + CONSTRAINT `v_ps_groupid_ref` FOREIGN KEY (`group_id`) REFERENCES `voip_peer_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create voip_preferences table +CREATE TABLE `voip_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `attribute` varchar(31) NOT NULL, + `type` tinyint(3) NOT NULL default 0, + `max_occur` tinyint(3) UNSIGNED NOT NULL, + `usr_pref` bool NOT NULL default FALSE, + `dom_pref` bool NOT NULL default FALSE, + `peer_pref` bool NOT NULL default FALSE, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `internal` tinyint(1) NOT NULL default 0, + `data_type` enum('boolean','int','string') NOT NULL default 'string', + `read_only` bool NOT NULL default FALSE, + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `attribute_idx` (`attribute`) +) ENGINE=InnoDB; + +-- create subscriber preferences table +CREATE TABLE `voip_usr_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `subscriber_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_subscribers` (`id`), + `attribute_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_preferences` (`id`), + `value` varchar(128) NOT NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `subidattrid_idx` (`subscriber_id`,`attribute_id`), + KEY `subscriberid_idx` (`subscriber_id`), + KEY `attributeid_idx` (`attribute_id`), + CONSTRAINT `v_u_p_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_u_p_attributeid_ref` FOREIGN KEY (`attribute_id`) + REFERENCES `voip_preferences` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create domain preferences table +CREATE TABLE `voip_dom_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_domains` (`id`), + `attribute_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_preferences` (`id`), + `value` varchar(128) NOT NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `domidattrid_idx` (`domain_id`,`attribute_id`), + KEY `domainid_idx` (`domain_id`), + KEY `attributeid_idx` (`attribute_id`), + CONSTRAINT `v_d_p_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_d_p_attributeid_ref` FOREIGN KEY (`attribute_id`) + REFERENCES `voip_preferences` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create peer host preferences table +CREATE TABLE `voip_peer_preferences` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `peer_host_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_peer_hosts` (`id`), + `attribute_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_preferences` (`id`), + `value` varchar(255) NOT NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `peerhostid_idx` (`peer_host_id`), + KEY `attributeid_idx` (`attribute_id`), + CONSTRAINT `v_p_p_peerhostid_ref` FOREIGN KEY (`peer_host_id`) + REFERENCES `voip_peer_hosts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_p_p_attributeid_ref` FOREIGN KEY (`attribute_id`) + REFERENCES `voip_preferences` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create preliminary address book table +-- this should be moved to LDAP at some time +CREATE TABLE `voip_contacts` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL REFERENCES `voip_subscribers` (`id`), + `firstname` varchar(127), + `lastname` varchar(127), + `company` varchar(127), + `phonenumber` varchar(31), + `homephonenumber` varchar(31), + `mobilenumber` varchar(31), + `faxnumber` varchar(31), + `email` varchar(255), + `homepage` varchar(255), + PRIMARY KEY (`id`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_c_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_speed_dial` ( + `id` int(11) UNSIGNED NOT NULL PRIMARY KEY auto_increment, + `subscriber_id` int(11) UNSIGNED NOT NULL, + `slot` varchar(64) NOT NULL, + `destination` varchar(192) NOT NULL, + UNIQUE KEY `subscriberid_slot_idx` (`subscriber_id`,`slot`), + CONSTRAINT `v_sd_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) engine=InnoDB; + +CREATE TABLE `voip_reminder` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL, + `time` time NOT NULL, + `recur` enum('never','weekdays','always') NOT NULL default 'never', + PRIMARY KEY (`id`), + UNIQUE KEY `subscriber_id` (`subscriber_id`), + CONSTRAINT `v_rem_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create IP groups table containing IPs where users may connect from +-- IP networks are combined to groups to keep usr_preferences a bit smaller +CREATE TABLE `voip_allowed_ip_groups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(10) unsigned NOT NULL, + `ipnet` varchar(18) NOT NULL, + PRIMARY KEY (`id`), + KEY `groupid_idx` (`group_id`), + KEY `ipnet_idx` (`ipnet`), + UNIQUE KEY `groupnet_idx` (`group_id`,`ipnet`) +) ENGINE=InnoDB; + +-- this is a sequencer for `group_id` in `voip_allowed_ip_groups` above +CREATE TABLE `voip_aig_sequence` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- create fax tables +CREATE TABLE `voip_fax_preferences` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL REFERENCES `voip_subscribers` (`id`), + `password` varchar(64), + `name` varchar(64), + `active` bool NOT NULL default FALSE, + `send_status` bool NOT NULL default TRUE, + `send_copy` bool NOT NULL default TRUE, + PRIMARY KEY (`id`), + UNIQUE KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_f_p_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_fax_destinations` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned NOT NULL REFERENCES `voip_subscribers` (`id`), + `destination` varchar(255) NOT NULL, + `filetype` enum('PS','TIFF','PDF','PDF14') NOT NULL default 'TIFF', + `cc` bool NOT NULL default FALSE, + `incoming` bool NOT NULL default TRUE, + `outgoing` bool NOT NULL default FALSE, + `status` bool NOT NULL default FALSE, + PRIMARY KEY (`id`), + UNIQUE KEY `subdest_idx` (`subscriber_id`, `destination`), + CONSTRAINT `v_f_d_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- audio files for IVR, auto-attendant, etc. +CREATE TABLE `voip_audio_files` ( + `id` int(11) unsigned NOT NULL auto_increment, + `subscriber_id` int(11) unsigned REFERENCES `voip_subscribers` (`id`), + `domain_id` int(11) unsigned REFERENCES `voip_domains` (`id`), + `handle` varchar(63) NOT NULL, + `description` text, + `audio` longblob, + PRIMARY KEY (`id`), + UNIQUE KEY `subhand_idx` (`subscriber_id`, `handle`), + UNIQUE KEY `domhand_idx` (`domain_id`, `handle`), + CONSTRAINT `v_a_f_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_a_f_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- VSC table +CREATE TABLE `voip_vscs` ( + `id` int(11) unsigned NOT NULL auto_increment, + `domain_id` int(11) unsigned REFERENCES `voip_domains` (`id`), + `digits` char(2), + `action` varchar(31) NOT NULL, + `audio_id` int(11) unsigned NOT NULL REFERENCES `voip_audio_files` (`id`), + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `domdig_idx` (`domain_id`, `digits`), + UNIQUE KEY `domaction_idx` (`domain_id`, `action`), + KEY `audioid_idx` (`audio_id`), + CONSTRAINT `v_v_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `voip_domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_v_audioid_ref` FOREIGN KEY (`audio_id`) + REFERENCES `voip_audio_files` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + + +-- language strings for error messages +CREATE TABLE language_strings ( + `id` int(11) unsigned NOT NULL auto_increment, + `code` varchar(63) NOT NULL, + `language` char(2) NOT NULL, + `string` text, + PRIMARY KEY (`id`), + UNIQUE KEY `codelang_idx` (code, language) +) ENGINE=InnoDB; + +-- xmlrpc dispatcher tables +CREATE TABLE `xmlqueue` ( + `id` int(10) unsigned NOT NULL auto_increment, + `target` varchar(255) NOT NULL, + `body` text NOT NULL, + `ctime` int(10) unsigned NOT NULL, + `atime` int(10) unsigned NOT NULL, + `tries` int(10) unsigned NOT NULL, + `next_try` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `next_try` (`next_try`,`id`) +) ENGINE=InnoDB; + +CREATE TABLE `xmlhosts` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `ip` varchar(15) NOT NULL, + `port` int(5) unsigned NOT NULL, + `path` varchar(64) NOT NULL DEFAULT '/', + `sip_port` int(5) unsigned DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `xmlgroups` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(32) NOT NULL, + PRIMARY KEY (`id`), + KEY `gname` (`name`) +) ENGINE=InnoDB; + +CREATE TABLE `xmlhostgroups` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(11) unsigned NOT NULL, + `host_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `gidx` (`group_id`), + KEY `xhg_hostid_ref` (`host_id`), + CONSTRAINT `xhg_groupid_ref` FOREIGN KEY (`group_id`) + REFERENCES `xmlgroups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `xhg_hostid_ref` FOREIGN KEY (`host_id`) + REFERENCES `xmlhosts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_rewrite_rule_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(32) NOT NULL, + `description` varchar(255) DEFAULT NULL, + `caller_in_dpid` int(11) unsigned DEFAULT NULL, + `callee_in_dpid` int(11) unsigned DEFAULT NULL, + `caller_out_dpid` int(11) unsigned DEFAULT NULL, + `callee_out_dpid` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_idx` (`name`) +) ENGINE=InnoDB; + +-- this is a sequencer for the dpids in `voip_rewrite_rule_sets` above +CREATE TABLE `voip_rwrs_sequence` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_rewrite_rules` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `set_id` int(11) unsigned NOT NULL, + `match_pattern` varchar(64) NOT NULL DEFAULT '', + `replace_pattern` varchar(64) NOT NULL, + `description` varchar(127) NOT NULL DEFAULT '', + `direction` enum('in','out') NOT NULL DEFAULT 'in', + `field` enum('caller','callee') NOT NULL DEFAULT 'caller', + `priority` int(11) unsigned NOT NULL DEFAULT '50', + PRIMARY KEY (`id`), + KEY `setidx` (`set_id`), + KEY `dirfieldidx` (`direction`,`field`), + CONSTRAINT `v_rwr_setid_ref` FOREIGN KEY (`set_id`) REFERENCES `voip_rewrite_rule_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- call forward tables +CREATE TABLE `voip_cf_destination_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `name_idx` (`name`), + CONSTRAINT `v_s_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_destinations` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `destination_set_id` int(11) unsigned NOT NULL, + `destination` varchar(255) NOT NULL, + `priority` int(3) unsigned DEFAULT NULL, + `timeout` int(11) unsigned NOT NULL DEFAULT 300, + PRIMARY KEY (`id`), + KEY `dset_idx` (`destination_set_id`), + KEY `destination_idx` (`destination`), + CONSTRAINT `v_cf_dsetid_ref` FOREIGN KEY (`destination_set_id`) REFERENCES `voip_cf_destination_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_time_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `name_idx` (`name`), + CONSTRAINT `v_cf_ts_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES +`voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_periods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `time_set_id` int(11) unsigned NOT NULL, + `year` varchar(255) DEFAULT NULL, + `month` varchar(255) DEFAULT NULL, + `mday` varchar(255) DEFAULT NULL, + `wday` varchar(255) DEFAULT NULL, + `hour` varchar(255) DEFAULT NULL, + `minute` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tset_idx` (`time_set_id`), + CONSTRAINT `v_cf_tsetid_ref` FOREIGN KEY (`time_set_id`) REFERENCES +`voip_cf_time_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_mappings` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `type` enum('cfu','cfb','cfna','cft') NOT NULL DEFAULT 'cfu', + `destination_set_id` int(11) unsigned DEFAULT NULL, + `time_set_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `type_idx` (`type`), + CONSTRAINT `v_cfmap_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `cfmap_time_ref` FOREIGN KEY (`time_set_id`) REFERENCES `voip_cf_time_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `cfmap_dest_ref` FOREIGN KEY (`destination_set_id`) REFERENCES `voip_cf_destination_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + +) ENGINE=InnoDB; + +-- INSERT default data + +-- localization language strings +LOAD DATA LOCAL INFILE 'language_strings.txt' INTO TABLE language_strings; + +-- xmlrpc dispatcher +INSERT INTO xmlgroups (id, name) VALUES(1, 'proxy'); +INSERT INTO xmlgroups (id, name) VALUES(2, 'registrar'); +INSERT INTO xmlgroups (id, name) VALUES(3, 'presence'); +INSERT INTO xmlgroups (id, name) VALUES(4, 'loadbalancer'); +INSERT INTO xmlgroups (id, name) VALUES(5, 'appserver'); +-- TODO: SR interface hack to work around rpc/mi discrepancies +INSERT INTO xmlgroups (id, name) VALUES(6, 'proxy-ng'); + +INSERT INTO xmlhosts (id, ip, port, path, sip_port, description) VALUES (1,'127.0.0.1','8000','/RPC2', '5062', 'Kamailio'); +INSERT INTO xmlhosts (id, ip, port, path, description) VALUES (2,'127.0.0.1','8090','/','Sems'); +-- TODO: SR interface hack to work around rpc/mi discrepancies +INSERT INTO xmlhosts (id, ip, port, path, description) VALUES (3,'127.0.0.1','5062','/','Kamailio-SR'); + +INSERT INTO xmlhostgroups (id, group_id, host_id) VALUES (1,1,1); +INSERT INTO xmlhostgroups (id, group_id, host_id) VALUES (2,5,2); +INSERT INTO xmlhostgroups (id, group_id, host_id) VALUES (3,6,3); + +-- regular kamailio preferences +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, read_only, description) + VALUES('lock', 0, 1, 'string', 1, 1, 'See "lock_voip_account_subscriber" for a list of possible values. A lock value of "none" will not be returned to the caller. Read-only setting.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_in_mode', 1, 1, 'boolean', 1, 'Specifies the operational mode of the incoming block list. If unset or set to a false value, it is a blacklist (accept all calls except from numbers listed in the block list), with a true value it is a whitelist (reject all calls except from numbers listed in the block list).'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_in_list', 0, 1, 'string', 0, 'Contains wildcarded E.164 numbers that are (not) allowed to call the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards like in shell patterns.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_in_clir', 1, 1, 'boolean', 1, 'Incoming anonymous calls (with calling line identification restriction) are blocked if set to true.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_out_mode', 1, 1, 'boolean', 1, 'Specifies the operational mode of the outgoing block list. If unset or set to a false value, it is a blacklist (allow all calls except to numbers listed in the block list), with a true value it is a whitelist (deny all calls except to numbers listed in the block list).'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_out_list', 0, 1, 'string', 0, 'Contains wildcarded E.164 numbers that are (not) allowed to be called by the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards like in shell patterns.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_in_mode', 1, 1, 'boolean', 1, 'Same as "block_in_mode" but may only be set by administrators.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_in_list', 0, 1, 'string', 0, 'Same as "block_in_list" but may only be set by administrators and is applied prior to the user setting.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_in_clir', 1, 1, 'boolean', 1, 'Same as "block_in_clir" but may only be set by administrators and is applied prior to the user setting.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_out_mode', 1, 1, 'boolean', 1, 'Same as "block_out_mode" but may only be set by administrators.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_out_list', 0, 1, 'string', 0, 'Same as "block_out_list" but may only be set by administrators and is applied prior to the user setting.'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cfu', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Unconditional" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cfb', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Busy" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cfna', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Unavailable" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (internal, read_only, attribute, type, usr_pref, data_type, max_occur, description) + VALUES(1, 1, 'cft', 1, 1, 'int', 0, 'The id pointing to the "Call Forward Timeout" entry in the voip_cf_mappings table'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('ringtimeout', 1, 1, 'int', 1, 'Specifies how many seconds the system should wait before redirecting the call if "cft" is set.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('cli', 0, 1, 'string', 1, 'E.164 number or complete SIP URI. "network-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls in the SIP "From" and "P-Asserted-Identity" headers (as user- and network-provided calling numbers). The content of the "From" header may be overridden by the "user_cli" preference and client (if allowed by the "allowed_clis" preference) SIP signalling. Automatically set to the primary E.164 number specified in the subscriber details.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('user_cli', 0, 1, 'string', 1, 'E.164 number or complete SIP URI. "user-provided calling line identification" - specifies the source E.164 number or SIP username that is used for outgoing calls. If set, this is put in the SIP "From" header (as user-provided calling number) if a client sends a CLI which is not allowed by "allowed_clis" or "allowed_clis" is not set.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('clir', 1, 1, 'boolean', 1, '"Calling line identification restriction" - if set to true, the CLI is not displayed on outgoing calls.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('cc', 0, 1, 'string', 1, 'The country code that will be used for routing of dialed numbers without a country code. Defaults to the country code of the E.164 number if the subscriber has one.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('ac', 0, 1, 'string', 1, 'The area code that will be used for routing of dialed numbers without an area code. Defaults to the area code of the E.164 number if the subscriber has one.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('svc_ac', 0, 1, 'string', 1, 'The area code that will be used for routing of dialed service numbers without an area code. Defaults to "ac".'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('emerg_ac', 0, 1, 'string', 1, 'The area code that will be used for routing of dialed emergency numbers without an area code. Defaults to "ac".'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('block_out_override_pin', 0, 1, 'string', 1, 'A PIN code which may be used in a VSC to disable the outgoing user block list and NCOS level for a call.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('adm_block_out_override_pin', 0, 1, 'string', 1, 'Same as "block_out_override_pin" but additionally disables the administrative block list and NCOS level.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, description) + VALUES('allowed_clis', 0, 1, 'string', 0, 'A list of shell patterns specifying which CLIs are allowed to be set by the subscriber. "*", "?" and "[x-y]" with "x" and "y" representing numbers from 0 to 9 may be used as wildcards as usual in shell patterns.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('e164_to_ruri', 1, 0, 1, 'boolean', 1, 'Send the E164 number instead of SIP AOR as request username when sending INVITE to the subscriber. If a 404 is received the SIP AOR is sent as request URI as fallback.'); + +-- "external" kamailio preferences - only used for documentation and provisioning parameter checks +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal, description) + VALUES('ncos', 0, 1, 'string', 1, -1, 'Specifies the NCOS level that applies to the user.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal, description) + VALUES('adm_ncos', 0, 1, 'string', 1, -1, 'Same as "ncos", but may only be set by administrators and is applied prior to the user setting.'); + +-- "internal" kamailio preferences - not directly accessible via provisioning (often mapped to an "external" preference somehow) +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ncos_id', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('adm_ncos_id', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('account_id', 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ext_contract_id', 0, 1, 'string', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('ext_subscriber_id', 0, 1, 'string', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, data_type, max_occur, internal) VALUES('prepaid', 1, 1, 'boolean', 1, 1); + +-- domain preferences +INSERT INTO voip_preferences (attribute, type, dom_pref, data_type, max_occur, description) VALUES('unauth_inbound_calls', 1, 1, 'boolean', 1, 'Allow unauthenticated inbound calls from FOREIGN domain to users within this domain. Use with care - it allows to flood your users with voice spam.'); + + +-- peer preferences +INSERT INTO voip_preferences (attribute, type, usr_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_user', 0, 1, 1, 'string', 1, 'A username used for authentication against a peer host.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_pass', 0, 1, 1, 'string', 1, 'A password used for authentication against a peer host.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, peer_pref, data_type, max_occur, description) + VALUES('peer_auth_realm', 0, 1, 1, 'string', 1, 'A realm (hostname) used to identify and for authentication against a peer host.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('find_subscriber_by_auth_user', 1, 0, 0, 1, 'boolean', 1, 'For incoming calls from this peer, find the destination subscriber also using its auth_username used for outbound registration.'); + + +-- user + domain preferences +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('omit_outbound_displayname', 1, 1, 1, 'boolean', 1, 'Suppress the caller display-name that is put in the SIP "From" header on outgoing calls.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, data_type, max_occur, description) VALUES('force_inbound_calls_to_peer', 1, 1, 1, 'boolean', 1, 'Force calls to this user to be treated as if the user was not local. This helps in migration scenarios.'); + + +-- user + domain + peer preferences +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Force rtp relay for this peer/domain/user.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('never_use_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Do not use rtp relay for this peer/domain/user. Rtp will be relayed if other participants have always_use_rtpproxy preference enabled.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('peer_auth_register', 1, 1, 1, 1, 'boolean', 1, 'Specifies whether registration at the peer host is desired.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('concurrent_max', 1, 1, 1, 1, 'int', 1, 'Maximum number of concurrent sessions (calls) for a subscriber or peer.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('concurrent_max_out', 1, 1, 1, 1, 'int', 1, 'Maximum number of concurrent outgoing sessions (calls) coming from a subscriber or going to a peer.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) VALUES('force_outbound_calls_to_peer', 1, 1, 1, 1, 'boolean', 1, 'Force calls from this user/domain/peer to be routed to PSTN even if the callee is local. Use with caution, as this setting may increase your costs! When enabling this option in a peer, make sure you trust it, as the NGCP will become an open relay for it!'); + +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal, description) + VALUES('rewrite_rule_set', 1, 1, 1, 1, 'int', 1, -1, 'Specifies the list of caller and callee rewrite rules which should be applied for incoming and outgoing calls.'); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_caller_in_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_callee_in_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_caller_out_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, internal) + VALUES('rewrite_callee_out_dpid', 1, 1, 1, 1, 'int', 1, 1); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_ipv4_for_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Always force the IPv4 address for the RTP relay, regardless of what is autodetected on SIP/SDP level. This is mutually exclusive with always_use_ipv6_for_rtpproxy.'); +INSERT INTO voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_ipv6_for_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Always force the IPv6 address for the RTP relay, regardless of what is autodetected on SIP/SDP level. This is mutually exclusive with always_use_ipv4_for_rtpproxy.'); diff --git a/db_scripts/base/tmp/0020_create_bss.up b/db_scripts/base/tmp/0020_create_bss.up new file mode 100644 index 00000000..81660703 --- /dev/null +++ b/db_scripts/base/tmp/0020_create_bss.up @@ -0,0 +1,750 @@ +-- step out of our billing DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS billing; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE billing CHARACTER SET 'utf8'; + +USE billing; + +-- create reseller helper table +CREATE TABLE `resellers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `name` varchar(63) NOT NULL, + `status` enum('active','locked','terminated') NOT NULL DEFAULT 'active', + PRIMARY KEY (`id`), + UNIQUE KEY `contractid_idx` (`contract_id`), + UNIQUE KEY `name_idx` (`name`) +) ENGINE=InnoDB; + +-- create domains and reseller mapping tables +CREATE TABLE `domains` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain` varchar(127) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `domain_idx` (`domain`) +) ENGINE=InnoDB; + +CREATE TABLE `domain_resellers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `domains` (`id`), + `reseller_id` int(11) UNSIGNED NOT NULL REFERENCES `resellers` (`id`), + PRIMARY KEY (`id`), + KEY `domainid_idx` (`domain_id`), + CONSTRAINT `dr_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `dr_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create admins table that contains root user as well as reseller admins +CREATE TABLE `admins` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `login` varchar(31) NOT NULL, + `md5pass` char(32), + `is_master` boolean NOT NULL default FALSE, + `is_superuser` boolean NOT NULL default FALSE, + `is_active` boolean NOT NULL default TRUE, + `read_only` boolean NOT NULL default FALSE, + `show_passwords` boolean NOT NULL default TRUE, + `call_data` boolean NOT NULL default FALSE, + `lawful_intercept` boolean NOT NULL default FALSE, + PRIMARY KEY (`id`), + UNIQUE KEY `login_idx` (`login`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `a_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create billing tables +CREATE TABLE `billing_profiles` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `handle` varchar(63) NOT NULL, + `name` varchar(31) NOT NULL, + `prepaid` bool NOT NULL DEFAULT FALSE, + `interval_charge` double NOT NULL DEFAULT 0, + `interval_free_time` int(5) NOT NULL DEFAULT 0, + `interval_free_cash` double NOT NULL DEFAULT 0, + `interval_unit` enum('week','month') NOT NULL DEFAULT 'month', + `interval_count` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, + `fraud_interval_limit` int(11) UNSIGNED NULL DEFAULT NULL, + `fraud_interval_lock` tinyint(3) UNSIGNED NOT NULL DEFAULT 0, + `fraud_interval_notify` varchar(255) NULL DEFAULT NULL, + `currency` varchar(31) NULL DEFAULT NULL, + `vat_rate` tinyint(3) UNSIGNED NULL DEFAULT NULL, + `vat_included` bool NOT NULL DEFAULT TRUE, + PRIMARY KEY (`id`), + UNIQUE KEY `resnam_idx` (`reseller_id`, `name`), + UNIQUE KEY `reshand_idx` (`reseller_id`, `handle`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `b_p_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `billing_zones` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `zone` varchar(127) NOT NULL, -- a zone name for internal use: admin interface, etc. + `detail` varchar(127) NULL, -- will be printed on invoices, etc. + PRIMARY KEY (`id`), + UNIQUE KEY `profnamdes_idx` (`billing_profile_id`, `zone`, `detail`), + CONSTRAINT `b_z_profileid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `billing_zones_history` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `bz_id` int(11) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NOT NULL, + `zone` varchar(127) NOT NULL, + `detail` varchar(127) NULL, + PRIMARY KEY (`id`), + KEY `bzid_idx` (`bz_id`), + CONSTRAINT `b_z_h_bzid_ref` FOREIGN KEY (`bz_id`) + REFERENCES `billing_zones` (`id`) + ON DELETE SET NULL ON UPDATE NO ACTION +) ENGINE=InnoDB; + +DELIMITER | + +CREATE TRIGGER bill_zones_crepl_trig AFTER INSERT ON billing_zones + FOR EACH ROW BEGIN + + INSERT INTO billing_zones_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, NEW.zone, NEW.detail); + + END; +| + +CREATE TRIGGER bill_zones_urepl_trig AFTER UPDATE ON billing_zones + FOR EACH ROW BEGIN + + UPDATE billing_zones_history + SET bz_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + zone = NEW.zone, detail = NEW.detail + WHERE bz_id = OLD.id; + + END; +| + +DELIMITER ; + +CREATE TABLE `billing_fees` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `billing_zone_id` int(11) UNSIGNED NULL REFERENCES `billing_zones` (`id`), + `destination` varchar(255) NOT NULL, + `type` enum('call', 'sms') NOT NULL DEFAULT 'call', + `onpeak_init_rate` double NOT NULL DEFAULT 0, + `onpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `onpeak_follow_rate` double NOT NULL DEFAULT 0, + `onpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_init_rate` double NOT NULL DEFAULT 0, + `offpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_follow_rate` double NOT NULL DEFAULT 0, + `offpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `use_free_time` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_f_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `zoneid_idx` (`billing_zone_id`), + CONSTRAINT `b_f_zoneid_ref` FOREIGN KEY (`billing_zone_id`) + REFERENCES `billing_zones` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + UNIQUE KEY `profdestype_idx` (`billing_profile_id`, `destination`, `type`) +) ENGINE=InnoDB; + +CREATE TABLE `billing_fees_history` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `bf_id` int(11) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NOT NULL, + `billing_zones_history_id` int(11) UNSIGNED NULL, + `destination` varchar(255) NOT NULL, + `type` enum('call', 'sms') NOT NULL DEFAULT 'call', + `onpeak_init_rate` double NOT NULL DEFAULT 0, + `onpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `onpeak_follow_rate` double NOT NULL DEFAULT 0, + `onpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_init_rate` double NOT NULL DEFAULT 0, + `offpeak_init_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `offpeak_follow_rate` double NOT NULL DEFAULT 0, + `offpeak_follow_interval` int(5) UNSIGNED NOT NULL DEFAULT 0, + `use_free_time` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + KEY `bfid_idx` (`bf_id`), + CONSTRAINT `b_f_h_bfid_ref` FOREIGN KEY (`bf_id`) + REFERENCES `billing_fees` (`id`) + ON DELETE SET NULL ON UPDATE NO ACTION, + KEY `zonehid_idx` (`billing_zones_history_id`), + CONSTRAINT `b_f_h_bzhid_ref` FOREIGN KEY (`billing_zones_history_id`) + REFERENCES `billing_zones_history` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + +DELIMITER | + +CREATE TRIGGER bill_fees_crepl_trig AFTER INSERT ON billing_fees + FOR EACH ROW BEGIN + DECLARE my_bzh_id int UNSIGNED; + + SELECT id INTO my_bzh_id FROM billing_zones_history WHERE bz_id = NEW.billing_zone_id; + + INSERT INTO billing_fees_history + VALUES(NULL, NEW.id, NEW.billing_profile_id, my_bzh_id, NEW.destination, + NEW.type, NEW.onpeak_init_rate, NEW.onpeak_init_interval, NEW.onpeak_follow_rate, + NEW.onpeak_follow_interval, NEW.offpeak_init_rate, NEW.offpeak_init_interval, + NEW.offpeak_follow_rate, NEW.offpeak_follow_interval, NEW.use_free_time); + + END; +| + +CREATE TRIGGER bill_fees_urepl_trig AFTER UPDATE ON billing_fees + FOR EACH ROW BEGIN + DECLARE my_bzh_id int UNSIGNED; + + SELECT id INTO my_bzh_id FROM billing_zones_history WHERE bz_id = NEW.billing_zone_id; + + UPDATE billing_fees_history + SET bf_id = NEW.id, billing_profile_id = NEW.billing_profile_id, + billing_zones_history_id = my_bzh_id, destination = NEW.destination, type = NEW.type, + onpeak_init_rate = NEW.onpeak_init_rate, onpeak_init_interval = NEW.onpeak_init_interval, + onpeak_follow_rate = NEW.onpeak_follow_rate, onpeak_follow_interval = NEW.onpeak_follow_interval, + offpeak_init_rate = NEW.offpeak_init_rate, offpeak_init_interval = NEW.offpeak_init_interval, + offpeak_follow_rate = NEW.offpeak_follow_rate, offpeak_follow_interval = NEW.offpeak_follow_interval, + use_free_time = NEW.use_free_time + WHERE bf_id = OLD.id; + + END; +| + +DELIMITER ; + +CREATE TABLE `billing_peaktime_weekdays` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `weekday` tinyint(3) UNSIGNED NOT NULL, + `start` time, + `end` time, + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_p_w_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `billing_peaktime_special` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `billing_profile_id` int(11) UNSIGNED NOT NULL REFERENCES `billing_profiles` (`id`), + `start` datetime, + `end` datetime, + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_p_s_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create LNP tables +CREATE TABLE `lnp_providers` ( + `id` int(11) UNSIGNED NOT NULL, + `name` varchar(255), + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `lnp_numbers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `number` varchar(31) NOT NULL, + `lnp_provider_id` int(11) UNSIGNED NOT NULL REFERENCES `lnp_providers` (`id`), + `start` datetime NULL DEFAULT NULL, + `end` datetime NULL DEFAULT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `l_n_lnpproid_ref` FOREIGN KEY (`lnp_provider_id`) + REFERENCES `lnp_providers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create NCOS tables +CREATE TABLE `ncos_levels` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED REFERENCES `resellers` (`id`), + `level` varchar(31) NOT NULL, + `mode` enum('blacklist', 'whitelist') NOT NULL default 'blacklist', + `local_ac` bool NOT NULL DEFAULT FALSE, + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `reslev_idx` (`reseller_id`, `level`), + CONSTRAINT `c_l_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `ncos_pattern_list` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `ncos_level_id` int(11) UNSIGNED NOT NULL REFERENCES `ncos_levels` (`id`), + `pattern` varchar(255) NOT NULL, + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `levpat_idx` (`ncos_level_id`, `pattern`), + CONSTRAINT `c_p_l_ncoslevid_ref` FOREIGN KEY (`ncos_level_id`) + REFERENCES `ncos_levels` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `ncos_lnp_list` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `ncos_level_id` int(11) UNSIGNED NOT NULL REFERENCES `ncos_levels` (`id`), + `lnp_provider_id` int(11) UNSIGNED NOT NULL REFERENCES `lnp_providers` (`id`), + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `levpro_idx` (`ncos_level_id`, `lnp_provider_id`), + CONSTRAINT `c_l_l_ncoslevid_ref` FOREIGN KEY (`ncos_level_id`) + REFERENCES `ncos_levels` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `c_l_l_lnpproid_ref` FOREIGN KEY (`lnp_provider_id`) + REFERENCES `lnp_providers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create contact information table +CREATE TABLE `contacts` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `gender` enum('male','female'), + `firstname` varchar(127), + `lastname` varchar(127), + `comregnum` varchar(31), + `company` varchar(127), + `street` varchar(127), + `postcode` int(6), + `city` varchar(127), + `country` char(2), + `phonenumber` varchar(31), + `mobilenumber` varchar(31), + `email` varchar(255), + `newsletter` bool NOT NULL DEFAULT FALSE, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- create customer tables +CREATE TABLE `customers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `shopuser` varchar(31) NULL, + `shoppass` varchar(31) NULL, + `business` bool NOT NULL DEFAULT FALSE, + `contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `tech_contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `comm_contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `external_id` varchar(255) NULL default NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`), + UNIQUE KEY (`reseller_id`, `shopuser`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `cu_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `contactid_idx` (`contact_id`), + CONSTRAINT `cu_contactid_ref` FOREIGN KEY (`contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `commcontactid_idx` (`comm_contact_id`), + CONSTRAINT `cu_commcontactid_ref` FOREIGN KEY (`comm_contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `techcontact_idx` (`tech_contact_id`), + CONSTRAINT `cu_techcontact_ref` FOREIGN KEY (`tech_contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `externalid_idx` (`external_id`) +) ENGINE=InnoDB; + +CREATE TABLE `customer_registers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `customer_id` int(11) UNSIGNED NOT NULL REFERENCES `customers` (`id`), + `actor` varchar(15), + `type` varchar(31) NOT NULL, + `data` text, + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `c_r_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `products` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `class` enum('sippeering', 'pstnpeering', 'reseller', 'voip', 'hardware', 'auxiliary') NOT NULL, + `handle` varchar(63) NOT NULL, + `name` varchar(127) NOT NULL, + `on_sale` bool NOT NULL DEFAULT FALSE, + `price` double, + `weight` mediumint(9) UNSIGNED, + `billing_profile_id` int(11) UNSIGNED NULL REFERENCES `billing_profiles` (`id`), + PRIMARY KEY (`id`), + UNIQUE KEY `resnam_idx` (`reseller_id`, `name`), + UNIQUE KEY `reshand_idx` (`reseller_id`, `handle`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `p_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `p_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `invoices` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `year` smallint(4) UNSIGNED NOT NULL, + `month` tinyint(2) UNSIGNED NOT NULL, + `serial` int(5) UNSIGNED NOT NULL, + `data` blob, + PRIMARY KEY (`id`), + UNIQUE KEY `yms_idx` (`year`,`month`,`serial`) +) ENGINE=InnoDB; + +CREATE TABLE `orders` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED REFERENCES `resellers` (`id`), + `customer_id` int(11) UNSIGNED REFERENCES `customers` (`id`), + `delivery_contact_id` int(11) UNSIGNED REFERENCES `contacts` (`id`), + `type` varchar(31), + `state` enum('init','transact','failed','success') NOT NULL DEFAULT 'init', + `value` int(11), + `shipping_costs` int(11), + `invoice_id` int(11) UNSIGNED REFERENCES `invoices` (`id`), + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + `complete_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `o_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `o_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `contactid_idx` (`delivery_contact_id`), + CONSTRAINT `o_contactid_ref` FOREIGN KEY (`delivery_contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `invoiceid_idx` (`invoice_id`), + CONSTRAINT `o_invoiceid_ref` FOREIGN KEY (`invoice_id`) + REFERENCES `invoices` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create payment table +CREATE TABLE `payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `amount` int(11), + `type` varchar(31), + `state` enum('init','transact','failed','success'), + `mpaytid` int(11) UNSIGNED, + `status` varchar(31), + `errno` int(11), + `returncode` varchar(63), + `externalstatus` text, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `state_idx` (`state`), + KEY `mpaytid_idx` (`mpaytid`), + KEY `status_idx` (`status`) +) ENGINE=InnoDB; + +-- create mapping table between orders and payments +CREATE TABLE `order_payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `order_id` int(11) UNSIGNED NOT NULL REFERENCES `orders` (`id`), + `payment_id` int(11) UNSIGNED NOT NULL REFERENCES `payments` (`id`), + PRIMARY KEY (`id`), + KEY `orderid_idx` (`order_id`), + CONSTRAINT `op_orderid_ref` FOREIGN KEY (`order_id`) + REFERENCES `orders` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `paymentid_idx` (`payment_id`), + CONSTRAINT `op_paymentid_ref` FOREIGN KEY (`payment_id`) + REFERENCES `payments` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create contract tables +CREATE TABLE `contracts` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `customer_id` int(11) UNSIGNED NULL REFERENCES `customers` (`id`), + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `contact_id` int(11) UNSIGNED NULL REFERENCES `contacts` (`id`), + `order_id` int(11) UNSIGNED NULL REFERENCES `orders` (`id`), + `status` enum('pending','active','locked','terminated') NOT NULL DEFAULT 'active', + `external_id` varchar(255) NULL default NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp NOT NULL, + `activate_timestamp` timestamp NULL, + `terminate_timestamp` timestamp NULL, + PRIMARY KEY (`id`), + KEY `contactid_idx` (`contact_id`), + CONSTRAINT `co_contactid_ref` FOREIGN KEY (`contact_id`) + REFERENCES `contacts` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE, + KEY `customerid_idx` (`customer_id`), + CONSTRAINT `c_customerid_ref` FOREIGN KEY (`customer_id`) + REFERENCES `customers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `co_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `orderid_idx` (`order_id`), + CONSTRAINT `co_orderid_ref` FOREIGN KEY (`order_id`) + REFERENCES `orders` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE, + KEY `externalid_idx` (`external_id`) +) ENGINE=InnoDB; + +-- create resellers->contracts foreign key +ALTER TABLE resellers + ADD CONSTRAINT `r_contractid_ref` + FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +; + +CREATE TABLE `contract_registers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `actor` varchar(15), + `type` varchar(31) NOT NULL, + `data` text, + PRIMARY KEY (`id`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `c_r_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_subscribers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `uuid` char(36) NOT NULL, + `username` varchar(127) NOT NULL, + `domain_id` int(11) UNSIGNED NOT NULL REFERENCES `domains` (`id`), + `status` enum('active','locked','terminated') NOT NULL DEFAULT 'active', + `primary_number_id` int(11) unsigned default NULL, + `external_id` varchar(255) NULL default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uuid_idx` (uuid), + KEY `username_idx` (`username`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `v_s_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `domainid_idx` (`domain_id`), + CONSTRAINT `v_s_domainid_ref` FOREIGN KEY (`domain_id`) + REFERENCES `domains` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `pnumid_idx` (`primary_number_id`), + KEY `externalid_idx` (`external_id`) +) ENGINE=InnoDB; + +-- create table that stores all known E.164 numbers +CREATE TABLE `voip_numbers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `cc` int(4) UNSIGNED NOT NULL, + `ac` varchar(7) NOT NULL, + `sn` varchar(31) NOT NULL, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `subscriber_id` int(11) UNSIGNED NULL REFERENCES `voip_subscribers` (`id`), + `status` enum('active','reserved','locked','deported') NOT NULL DEFAULT 'active', + `ported` bool NOT NULL DEFAULT FALSE, + `list_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `listts_idx` (`list_timestamp`), + UNIQUE KEY `number_idx` (`cc`,`ac`,`sn`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `v_n_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE, + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_n_subscriberid_ref` FOREIGN KEY (`subscriber_id`) + REFERENCES `voip_subscribers` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- define local number blocks +CREATE TABLE `voip_number_blocks` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `cc` int(4) UNSIGNED NOT NULL, + `ac` varchar(7) NOT NULL, + `sn_prefix` varchar(31) NOT NULL, + `sn_length` tinyint(2) UNSIGNED NOT NULL, + `allocable` bool NOT NULL DEFAULT FALSE, + `authoritative` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + UNIQUE KEY `prefix_idx` (`cc`, `ac`, `sn_prefix`) +) ENGINE=InnoDB; + +CREATE TABLE `voip_number_block_resellers` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `number_block_id` int(11) UNSIGNED NOT NULL REFERENCES `voip_number_blocks` (`id`), + `reseller_id` int(11) UNSIGNED NOT NULL REFERENCES `resellers` (`id`), + PRIMARY KEY (`id`), + KEY `numblockid_idx` (`number_block_id`), + CONSTRAINT `vnbr_numblockid_ref` FOREIGN KEY (`number_block_id`) + REFERENCES `voip_number_blocks` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `vnbr_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create subscribers->primary-number foreign key +ALTER TABLE voip_subscribers + ADD CONSTRAINT `v_s_pnumid_ref` + FOREIGN KEY (`primary_number_id`) + REFERENCES `voip_numbers` (`id`) + ON DELETE SET NULL ON UPDATE CASCADE +; + +-- create account status table +CREATE TABLE `contract_balances` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `cash_balance` double, + `cash_balance_interval` double NOT NULL DEFAULT 0, + `free_time_balance` int(11), + `free_time_balance_interval` int(11) NOT NULL DEFAULT 0, + `start` datetime NOT NULL, + `end` datetime NOT NULL, + `invoice_id` int(11) UNSIGNED REFERENCES `invoices` (`id`), + PRIMARY KEY (`id`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `c_b_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `invoiceid_idx` (`invoice_id`), + CONSTRAINT `cb_invoiceid_ref` FOREIGN KEY (`invoice_id`) + REFERENCES `invoices` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create table that holds credits and debits +CREATE TABLE `contract_credits` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `balance_id` int(11) UNSIGNED NOT NULL REFERENCES `contract_balances` (`id`), + `state` enum('init','transact','charged','failed','success') NOT NULL DEFAULT 'init', + `amount` double, + `reason` text, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp, + PRIMARY KEY (`id`), + KEY `balanceid_idx` (`balance_id`), + CONSTRAINT `cc_balanceid_ref` FOREIGN KEY (`balance_id`) + REFERENCES `contract_balances` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create mapping table between orders and payments +CREATE TABLE `credit_payments` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `credit_id` int(11) UNSIGNED NOT NULL REFERENCES `contract_credits` (`id`), + `payment_id` int(11) UNSIGNED NOT NULL REFERENCES `payments` (`id`), + PRIMARY KEY (`id`), + KEY `creditid_idx` (`credit_id`), + CONSTRAINT `cp_creditid_ref` FOREIGN KEY (`credit_id`) + REFERENCES `contract_credits` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `paymentid_idx` (`payment_id`), + CONSTRAINT `cp_paymentid_ref` FOREIGN KEY (`payment_id`) + REFERENCES `payments` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- create mapping table between contracts and billing_profiles, billing_groups and products +CREATE TABLE `billing_mappings` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `start_date` datetime, + `end_date` datetime, + `billing_profile_id` int(11) UNSIGNED REFERENCES `billing_profiles` (`id`), + `contract_id` int(11) UNSIGNED NOT NULL REFERENCES `contracts` (`id`), + `product_id` int(11) UNSIGNED REFERENCES `products` (`id`), + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `b_m_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) + REFERENCES `billing_profiles` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE, + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `b_m_contractid_ref` FOREIGN KEY (`contract_id`) + REFERENCES `contracts` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `productid_idx` (`product_id`), + CONSTRAINT `b_m_productid_ref` FOREIGN KEY (`product_id`) + REFERENCES `products` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; + +-- lawful intercept table +CREATE TABLE `voip_intercept` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `reseller_id` int(11) UNSIGNED NULL REFERENCES `resellers` (`id`), + `LIID` int(11) UNSIGNED, + `number` varchar(63), + `cc_required` bool NOT NULL DEFAULT FALSE, + `delivery_host` varchar(15), + `delivery_port` smallint(5) UNSIGNED, + `delivery_user` text NULL, + `delivery_pass` text NULL, + `modify_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `create_timestamp` timestamp NOT NULL, + `deleted` bool NOT NULL DEFAULT FALSE, + PRIMARY KEY (`id`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `vi_resellerid_ref` FOREIGN KEY (`reseller_id`) + REFERENCES `resellers` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + KEY `number_idx` (`number`), + KEY `deleted_idx` (`deleted`) +) ENGINE=InnoDB; + +-- insert some data to get rating and the web interface working + +-- system internal products +INSERT INTO `products` (id,class,handle,name,on_sale) + VALUES (1,'pstnpeering','PSTN_PEERING','PSTN Peering',1), + (2,'sippeering','SIP_PEERING','SIP Peering',1), + (3,'reseller','VOIP_RESELLER','VoIP Reseller',1); +-- the default reseller contract, will be the only one unless multitenancy is enabled +INSERT INTO `contracts` (id,status,modify_timestamp,create_timestamp,activate_timestamp) VALUES (1,'active',now(),now(),now()); +INSERT INTO `resellers` (id,contract_id,name,status) VALUES (1,1,'default','active'); +INSERT INTO `billing_mappings` (id,start_date,end_date,contract_id,product_id) VALUES (1,NULL,NULL,1,3); +-- first administrative account, change password after first login +INSERT INTO `admins` (id,reseller_id,login,md5pass,is_master,is_superuser,call_data,lawful_intercept) + VALUES (1,1,'administrator',md5('administrator'),1,1,1,1); +-- default billing profile creation +INSERT INTO `billing_profiles` (id,reseller_id,handle,name,interval_unit,interval_count) + VALUES(1,1,'default','Default Billing Profile','month',1); +INSERT INTO `billing_zones` (id,billing_profile_id,zone,detail) VALUES (1,1,'Free Default Zone','All Destinations'); +INSERT INTO `billing_fees` (id,billing_profile_id,billing_zone_id,destination,type, + onpeak_init_rate,onpeak_init_interval,onpeak_follow_rate,onpeak_follow_interval, + offpeak_init_rate,offpeak_init_interval,offpeak_follow_rate,offpeak_follow_interval) + VALUES (1,1,1,'.*','call',0,600,0,600,0,600,0,600); diff --git a/db_scripts/base/tmp/0030_create_kamailio.up b/db_scripts/base/tmp/0030_create_kamailio.up new file mode 100644 index 00000000..deca5732 --- /dev/null +++ b/db_scripts/base/tmp/0030_create_kamailio.up @@ -0,0 +1,390 @@ +USE mysql; +DROP DATABASE IF EXISTS kamailio; + +CREATE DATABASE IF NOT EXISTS kamailio CHARACTER SET 'utf8'; + +USE kamailio; + +CREATE TABLE `acc` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `method` varchar(16) NOT NULL DEFAULT '', + `from_tag` varchar(64) NOT NULL DEFAULT '', + `to_tag` varchar(64) NOT NULL DEFAULT '', + `callid` varchar(255) NOT NULL DEFAULT '', + `sip_code` varchar(3) NOT NULL DEFAULT '', + `sip_reason` varchar(128) NOT NULL DEFAULT '', + `time` datetime NOT NULL, + `time_hires` decimal(13,3) NOT NULL, + `src_leg` varchar(2048) default NULL, + `dst_leg` varchar(2048) default NULL, + `dst_user` varchar(64) NOT NULL default '', + `dst_ouser` varchar(64) NOT NULL default '', + `dst_domain` varchar(128) NOT NULL default '', + `src_user` varchar(64) NOT NULL default '', + `src_domain` varchar(128) NOT NULL default '', + PRIMARY KEY (`id`), + KEY `callid_idx` (`callid`) +) ENGINE=InnoDB; + +CREATE TABLE `dbaliases` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `alias_username` varchar(64) NOT NULL DEFAULT '', + `alias_domain` varchar(64) NOT NULL DEFAULT '', + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `alias_idx` (`alias_username`,`alias_domain`), + KEY `target_idx` (`username`,`domain`) +) ENGINE=InnoDB; + +CREATE TABLE `dialog` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hash_entry` int(10) unsigned NOT NULL, + `hash_id` int(10) unsigned NOT NULL, + `callid` varchar(255) NOT NULL, + `from_uri` varchar(128) NOT NULL, + `from_tag` varchar(64) NOT NULL, + `to_uri` varchar(128) NOT NULL, + `to_tag` varchar(64) NOT NULL, + `caller_cseq` varchar(7) NOT NULL, + `callee_cseq` varchar(7) NOT NULL, + `caller_route_set` varchar(512) DEFAULT NULL, + `callee_route_set` varchar(512) DEFAULT NULL, + `caller_contact` varchar(128) NOT NULL, + `callee_contact` varchar(128) NOT NULL, + `caller_sock` varchar(64) NOT NULL, + `callee_sock` varchar(64) NOT NULL, + `state` int(10) unsigned NOT NULL, + `start_time` int(10) unsigned NOT NULL, + `timeout` int(10) unsigned NOT NULL DEFAULT '0', + `sflags` int(10) unsigned NOT NULL DEFAULT '0', + `toroute` int(10) unsigned NOT NULL DEFAULT '0', + `req_uri` varchar(128) NOT NULL, + PRIMARY KEY (`id`), + KEY `hash_idx` (`hash_entry`,`hash_id`) +) ENGINE=InnoDB; + +CREATE TABLE `dialplan` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `dpid` int(11) NOT NULL, + `pr` int(11) NOT NULL, + `match_op` int(11) NOT NULL, + `match_exp` varchar(64) NOT NULL, + `match_len` int(11) NOT NULL, + `subst_exp` varchar(64) NOT NULL, + `repl_exp` varchar(64) NOT NULL, + `attrs` varchar(32) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `dispatcher` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `setid` int(11) NOT NULL DEFAULT '0', + `destination` varchar(192) NOT NULL DEFAULT '', + `flags` int(11) NOT NULL DEFAULT '0', + `priority` int(11) NOT NULL DEFAULT '0', + `description` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `domain` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(64) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + UNIQUE KEY `domain_idx` (`domain`) +) ENGINE=InnoDB; + +CREATE TABLE `lcr_gw` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `gw_name` varchar(128) NOT NULL, + `ip_addr` varchar(64) NOT NULL, + `hostname` varchar(64) DEFAULT NULL, + `port` smallint(5) unsigned DEFAULT NULL, + `params` varchar(64) DEFAULT NULL, + `uri_scheme` tinyint(3) unsigned DEFAULT NULL, + `transport` tinyint(3) unsigned DEFAULT NULL, + `strip` tinyint(3) unsigned DEFAULT NULL, + `tag` varchar(16) DEFAULT NULL, + `flags` int(10) unsigned NOT NULL DEFAULT '0', + `defunct` int(10) unsigned DEFAULT NULL, + `group_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `lcr_id_gw_name_idx` (`lcr_id`,`gw_name`), + UNIQUE KEY `lcr_id_ip_addr_idx` (`lcr_id`,`ip_addr`) +) ENGINE=InnoDB; + +CREATE TABLE `lcr_rule` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `prefix` varchar(16) DEFAULT NULL, + `from_uri` varchar(64) DEFAULT NULL, + `stopper` int(10) unsigned NOT NULL DEFAULT '0', + `enabled` int(10) unsigned NOT NULL DEFAULT '1', + `group_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `lcr_id_idx` (`lcr_id`) +) ENGINE=InnoDB; + +CREATE TABLE `lcr_rule_target` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `rule_id` int(10) unsigned NOT NULL, + `gw_id` int(10) unsigned NOT NULL, + `priority` tinyint(3) unsigned NOT NULL, + `weight` int(10) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `rule_id_gw_id_idx` (`rule_id`,`gw_id`), + KEY `lcr_id_idx` (`lcr_id`), + KEY `gw_id_idx` (`gw_id`), + CONSTRAINT `l_r_t_ruleid_ref` FOREIGN KEY (`rule_id`) + REFERENCES `lcr_rule` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `l_r_t_gwid_ref` FOREIGN KEY (`gw_id`) + REFERENCES `lcr_gw` (`id`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `location` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) DEFAULT NULL, + `contact` varchar(255) NOT NULL DEFAULT '', + `received` varchar(128) DEFAULT NULL, + `path` varchar(128) DEFAULT NULL, + `expires` datetime NOT NULL DEFAULT '2020-05-28 21:32:15', + `q` float(10,2) NOT NULL DEFAULT '1.00', + `callid` varchar(255) NOT NULL DEFAULT 'Default-Call-ID', + `cseq` int(11) NOT NULL DEFAULT '13', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + `flags` int(11) NOT NULL DEFAULT '0', + `cflags` int(11) NOT NULL DEFAULT '0', + `user_agent` varchar(255) NOT NULL DEFAULT '', + `socket` varchar(64) DEFAULT NULL, + `methods` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `account_contact_idx` (`username`,`domain`,`contact`) +) ENGINE=InnoDB; + +CREATE TABLE `speed_dial` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + `sd_username` varchar(64) NOT NULL DEFAULT '', + `sd_domain` varchar(64) NOT NULL DEFAULT '', + `new_uri` varchar(128) NOT NULL DEFAULT '', + `fname` varchar(64) NOT NULL DEFAULT '', + `lname` varchar(64) NOT NULL DEFAULT '', + `description` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `speed_dial_idx` (`username`,`domain`,`sd_domain`,`sd_username`) +) ENGINE=InnoDB; + +CREATE TABLE `subscriber` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + `password` varchar(40) NOT NULL DEFAULT '', + `email_address` varchar(64) NOT NULL DEFAULT '', + `ha1` varchar(64) NOT NULL DEFAULT '', + `ha1b` varchar(64) NOT NULL DEFAULT '', + `rpid` varchar(64) DEFAULT NULL, + `uuid` char(36) NOT NULL, + `timezone` varchar(64) NOT NULL DEFAULT '', + `datetime_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `account_idx` (`username`,`domain`), + KEY `username_idx` (`username`) +) ENGINE=InnoDB; + +CREATE TABLE `trusted` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `src_ip` varchar(50) NOT NULL, + `proto` varchar(4) NOT NULL, + `from_pattern` varchar(64) DEFAULT NULL, + `tag` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `peer_idx` (`src_ip`) +) ENGINE=InnoDB; + +CREATE TABLE `usr_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`), + KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB; + +CREATE TABLE `dom_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`), + KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB; + +CREATE TABLE `peer_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`) +-- not used -- KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB; + +CREATE TABLE `address` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `grp` smallint(5) unsigned NOT NULL DEFAULT '0', + `ip_addr` varchar(15) NOT NULL, + `mask` tinyint(4) NOT NULL DEFAULT '32', + `port` smallint(5) unsigned NOT NULL DEFAULT '0', + `tag` VARCHAR(64), + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +CREATE TABLE `version` ( + `table_name` varchar(32) NOT NULL, + `table_version` int(10) unsigned NOT NULL DEFAULT '0' +) ENGINE=InnoDB; + +CREATE TABLE `voicemail_users` ( + `uniqueid` int(10) unsigned NOT NULL AUTO_INCREMENT, + `customer_id` char(36) NOT NULL DEFAULT '', + `context` varchar(63) NOT NULL DEFAULT 'default', + `mailbox` varchar(31) NOT NULL, + `password` varchar(31) NOT NULL DEFAULT '0', + `fullname` varchar(255) NOT NULL DEFAULT '', + `email` varchar(255) NOT NULL DEFAULT '', + `pager` varchar(255) NOT NULL DEFAULT '', + `tz` varchar(10) NOT NULL DEFAULT 'central', + `attach` varchar(4) NOT NULL DEFAULT 'yes', + `saycid` varchar(4) NOT NULL DEFAULT 'yes', + `dialout` varchar(10) NOT NULL DEFAULT '', + `callback` varchar(10) NOT NULL DEFAULT '', + `review` varchar(4) NOT NULL DEFAULT 'no', + `operator` varchar(4) NOT NULL DEFAULT 'no', + `envelope` varchar(4) NOT NULL DEFAULT 'no', + `sayduration` varchar(4) NOT NULL DEFAULT 'no', + `saydurationm` tinyint(4) NOT NULL DEFAULT '1', + `sendvoicemail` varchar(4) NOT NULL DEFAULT 'no', + `delete` varchar(4) NOT NULL DEFAULT 'no', + `nextaftercmd` varchar(4) NOT NULL DEFAULT 'yes', + `forcename` varchar(4) NOT NULL DEFAULT 'no', + `forcegreetings` varchar(4) NOT NULL DEFAULT 'no', + `hidefromdir` varchar(4) NOT NULL DEFAULT 'yes', + `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`uniqueid`), + KEY `customer_idx` (`customer_id`), + KEY `mailbox_context` (`mailbox`,`context`) +) ENGINE=InnoDB; + +CREATE TABLE `voicemail_spool` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `msgnum` int(11) NOT NULL DEFAULT '0', + `dir` varchar(127) DEFAULT '', + `context` varchar(63) DEFAULT '', + `macrocontext` varchar(63) DEFAULT '', + `callerid` varchar(255) DEFAULT '', + `origtime` varchar(16) DEFAULT '', + `duration` varchar(16) DEFAULT '', + `mailboxuser` varchar(255) DEFAULT '', + `mailboxcontext` varchar(63) DEFAULT '', + `recording` longblob, + PRIMARY KEY (`id`), + KEY `dir` (`dir`), + KEY `mailboxuser_idx` (`mailboxuser`), + CONSTRAINT `v_s_mailboxuser_ref` FOREIGN KEY (`mailboxuser`) REFERENCES `voicemail_users` (`customer_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `fax_preferences` ( + `subscriber_id` int(10) unsigned NOT NULL, + `password` varchar(64) default NULL, + `name` varchar(64) default NULL, + `active` enum('true','false') NOT NULL default 'true', + `send_status` enum('true','false') NOT NULL default 'false', + `send_copy` enum('true','false') NOT NULL default 'false', + `send_copy_cc` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`subscriber_id`) +) ENGINE=InnoDB; + +CREATE TABLE `fax_destinations` ( + `id` int(10) unsigned NOT NULL auto_increment, + `subscriber_id` int(10) unsigned NOT NULL, + `destination` varchar(64) NOT NULL, + `filetype` enum('ps','tiff','pdf','pdf14') NOT NULL default 'tiff', + `cc` enum('true','false') NOT NULL default 'false', + `incoming` enum('true','false') NOT NULL default 'true', + `outgoing` enum('true','false') NOT NULL default 'false', + `status` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`id`), + KEY `subscriber_id` (`subscriber_id`) +) ENGINE=InnoDB; + +CREATE TABLE `sems_registrations` ( + `subscriber_id` int(11) NOT NULL, + `registration_status` tinyint(1) NOT NULL DEFAULT '0', + `last_registration` datetime DEFAULT NULL, + `expiry` datetime DEFAULT NULL, + `last_code` smallint(2) DEFAULT NULL, + `last_reason` varchar(256) DEFAULT NULL, + `contacts` varchar(512) DEFAULT NULL, + PRIMARY KEY (`subscriber_id`) +) ENGINE=InnoDB; + +CREATE TABLE `fax_journal` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(10) unsigned NOT NULL DEFAULT '0', + `the_timestamp` int(11) unsigned NOT NULL DEFAULT '0', + `duration` int(11) unsigned NOT NULL DEFAULT '0', + `direction` enum('in','out') NOT NULL DEFAULT 'in', + `peer_number` varchar(255) NOT NULL DEFAULT '', + `peer_name` varchar(255) NOT NULL DEFAULT '', + `pages` int(10) unsigned NOT NULL DEFAULT '0', + `reason` varchar(255) NOT NULL, + `status` varchar(255) NOT NULL DEFAULT '', + `signal_rate` int(10) unsigned NOT NULL DEFAULT '0', + `quality` varchar(255) NOT NULL DEFAULT '', + `filename` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `selkey` (`subscriber_id`,`direction`) +) ENGINE=InnoDB; + +INSERT INTO `version` VALUES + ('acc',4), + ('lcr_gw',1), + ('lcr_rule_target',1), + ('lcr_rule',1), + ('domain',1), + ('trusted',5), + ('location',1004), + ('dbaliases',1), + ('speed_dial',2), + ('usr_preferences',2), + ('subscriber',6), + ('dialog',4), + ('dispatcher',3), + ('address',4), + ('dialplan',1); + + +INSERT INTO `dispatcher` VALUES ('1','2','sip:127.0.0.1:5070','0','0','Voicemail servers'); +INSERT INTO `dispatcher` VALUES ('2','3','sip:127.0.0.1:5080','0','0','Application servers'); +INSERT INTO `dispatcher` VALUES ('3','4','sip:127.0.0.1:5090','0','0','Fax2Mail servers'); diff --git a/db_scripts/base/tmp/0040_create_accounting.up b/db_scripts/base/tmp/0040_create_accounting.up new file mode 100644 index 00000000..7c553fb3 --- /dev/null +++ b/db_scripts/base/tmp/0040_create_accounting.up @@ -0,0 +1,71 @@ +-- step out of our provisioning DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS accounting; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE IF NOT EXISTS accounting CHARACTER SET 'utf8'; + +USE accounting; + +-- create accounting tables + +CREATE TABLE `acc` like kamailio.acc; + +CREATE TABLE `cdr` ( + `id` int(10) unsigned NOT NULL auto_increment, + `update_time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `source_user_id` char(36) NOT NULL, + `source_provider_id` varchar(255) NOT NULL, + `source_user` varchar(255) NOT NULL, + `source_domain` varchar(255) NOT NULL, + `source_cli` varchar(64) NOT NULL, + `source_clir` tinyint(1) NOT NULL default '0', + `destination_user_id` char(36) NOT NULL, + `destination_provider_id` varchar(255) NOT NULL, + `destination_user` varchar(255) NOT NULL, + `destination_domain` varchar(255) NOT NULL, + `destination_user_dialed` varchar(255) NOT NULL, + `destination_user_in` varchar(255) NOT NULL, + `destination_domain_in` varchar(255) NOT NULL, + `call_type` enum('call','cfu','cft','cfb','cfna') NOT NULL default 'call', + `call_status` enum('ok','busy','noanswer','cancel','offline','timeout','other') NOT NULL default 'ok', + `call_code` char(3) NOT NULL, + `start_time` timestamp NOT NULL default '0000-00-00 00:00:00', + `duration` int(10) unsigned NOT NULL, + `call_id` varchar(255) NOT NULL, + `carrier_cost` float default NULL, + `reseller_cost` float default NULL, + `customer_cost` float default NULL, + `carrier_billing_fee_id` int(11) unsigned default NULL, + `reseller_billing_fee_id` int(11) unsigned default NULL, + `customer_billing_fee_id` int(11) unsigned default NULL, + `carrier_billing_zone_id` int(11) unsigned default NULL, + `reseller_billing_zone_id` int(11) unsigned default NULL, + `customer_billing_zone_id` int(11) unsigned default NULL, + `frag_carrier_onpeak` tinyint(1) default NULL, + `frag_reseller_onpeak` tinyint(1) default NULL, + `frag_customer_onpeak` tinyint(1) default NULL, + `is_fragmented` tinyint(1) default NULL, + `rated_at` datetime default NULL, + `rating_status` enum('unrated','ok','failed') NOT NULL default 'unrated', + PRIMARY KEY (`id`), + KEY `suid` (`source_user_id`), + KEY `duid` (`destination_user_id`), + KEY `suri` (`source_user`,`source_domain`,`source_cli`), + KEY `duri` (`destination_user`,`destination_domain`), + KEY `sprov` (`source_provider_id`), + KEY `dprov` (`destination_provider_id`), + KEY `kcid` (`call_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `mark` ( + `id` int(10) unsigned NOT NULL auto_increment, + `collector` varchar(255) NOT NULL, + `acc_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + diff --git a/db_scripts/base/tmp/0050_create_kamailio_301.up b/db_scripts/base/tmp/0050_create_kamailio_301.up new file mode 100644 index 00000000..473e2871 --- /dev/null +++ b/db_scripts/base/tmp/0050_create_kamailio_301.up @@ -0,0 +1,324 @@ +USE mysql; +DROP DATABASE IF EXISTS kamailio; + +CREATE DATABASE IF NOT EXISTS kamailio CHARACTER SET 'latin1'; + +USE kamailio; + +CREATE TABLE `acc` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `method` varchar(16) NOT NULL DEFAULT '', + `from_tag` varchar(64) NOT NULL DEFAULT '', + `to_tag` varchar(64) NOT NULL DEFAULT '', + `callid` varchar(64) NOT NULL DEFAULT '', + `sip_code` varchar(3) NOT NULL DEFAULT '', + `sip_reason` varchar(128) NOT NULL DEFAULT '', + `time` datetime NOT NULL, + `src_leg` varchar(255) default NULL, + `dst_leg` varchar(255) default NULL, + `dst_user` varchar(64) NOT NULL default '', + `dst_ouser` varchar(64) NOT NULL default '', + `dst_domain` varchar(128) NOT NULL default '', + `src_user` varchar(64) NOT NULL default '', + `src_domain` varchar(128) NOT NULL default '', + PRIMARY KEY (`id`), + KEY `callid_idx` (`callid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `dbaliases` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `alias_username` varchar(64) NOT NULL DEFAULT '', + `alias_domain` varchar(64) NOT NULL DEFAULT '', + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `alias_idx` (`alias_username`,`alias_domain`), + KEY `target_idx` (`username`,`domain`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `dialog` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hash_entry` int(10) unsigned NOT NULL, + `hash_id` int(10) unsigned NOT NULL, + `callid` varchar(255) NOT NULL, + `from_uri` varchar(128) NOT NULL, + `from_tag` varchar(64) NOT NULL, + `to_uri` varchar(128) NOT NULL, + `to_tag` varchar(64) NOT NULL, + `caller_cseq` varchar(7) NOT NULL, + `callee_cseq` varchar(7) NOT NULL, + `caller_route_set` varchar(512) DEFAULT NULL, + `callee_route_set` varchar(512) DEFAULT NULL, + `caller_contact` varchar(128) NOT NULL, + `callee_contact` varchar(128) NOT NULL, + `caller_sock` varchar(64) NOT NULL, + `callee_sock` varchar(64) NOT NULL, + `state` int(10) unsigned NOT NULL, + `start_time` int(10) unsigned NOT NULL, + `timeout` int(10) unsigned NOT NULL DEFAULT '0', + `sflags` int(10) unsigned NOT NULL DEFAULT '0', + `toroute` int(10) unsigned NOT NULL DEFAULT '0', + `req_uri` varchar(128) NOT NULL, + PRIMARY KEY (`id`), + KEY `hash_idx` (`hash_entry`,`hash_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `dialplan` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `dpid` int(11) NOT NULL, + `pr` int(11) NOT NULL, + `match_op` int(11) NOT NULL, + `match_exp` varchar(64) NOT NULL, + `match_len` int(11) NOT NULL, + `subst_exp` varchar(64) NOT NULL, + `repl_exp` varchar(32) NOT NULL, + `attrs` varchar(32) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `dispatcher` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `setid` int(11) NOT NULL DEFAULT '0', + `destination` varchar(192) NOT NULL DEFAULT '', + `flags` int(11) NOT NULL DEFAULT '0', + `priority` int(11) NOT NULL DEFAULT '0', + `description` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `domain` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(64) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + UNIQUE KEY `domain_idx` (`domain`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `gw` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `gw_name` varchar(128) NOT NULL, + `grp_id` int(10) unsigned NOT NULL, + `ip_addr` varchar(15) NOT NULL, + `hostname` varchar(64) DEFAULT NULL, + `port` smallint(5) unsigned DEFAULT NULL, + `uri_scheme` tinyint(3) unsigned DEFAULT NULL, + `transport` tinyint(3) unsigned DEFAULT NULL, + `strip` tinyint(3) unsigned DEFAULT NULL, + `tag` varchar(16) DEFAULT NULL, + `weight` int(10) unsigned DEFAULT NULL, + `flags` int(10) unsigned NOT NULL DEFAULT '0', + `defunct` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `lcr_id_grp_id_gw_name_idx` (`lcr_id`,`grp_id`,`gw_name`), + UNIQUE KEY `lcr_id_grp_id_ip_addr_idx` (`lcr_id`,`grp_id`,`ip_addr`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `lcr` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `lcr_id` smallint(5) unsigned NOT NULL, + `prefix` varchar(16) DEFAULT NULL, + `from_uri` varchar(64) DEFAULT NULL, + `grp_id` int(10) unsigned NOT NULL, + `priority` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `lcr_id_idx` (`lcr_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `location` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) DEFAULT NULL, + `contact` varchar(255) NOT NULL DEFAULT '', + `received` varchar(128) DEFAULT NULL, + `path` varchar(128) DEFAULT NULL, + `expires` datetime NOT NULL DEFAULT '2020-05-28 21:32:15', + `q` float(10,2) NOT NULL DEFAULT '1.00', + `callid` varchar(255) NOT NULL DEFAULT 'Default-Call-ID', + `cseq` int(11) NOT NULL DEFAULT '13', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + `flags` int(11) NOT NULL DEFAULT '0', + `cflags` int(11) NOT NULL DEFAULT '0', + `user_agent` varchar(255) NOT NULL DEFAULT '', + `socket` varchar(64) DEFAULT NULL, + `methods` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `account_contact_idx` (`username`,`domain`,`contact`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `speed_dial` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + `sd_username` varchar(64) NOT NULL DEFAULT '', + `sd_domain` varchar(64) NOT NULL DEFAULT '', + `new_uri` varchar(128) NOT NULL DEFAULT '', + `fname` varchar(64) NOT NULL DEFAULT '', + `lname` varchar(64) NOT NULL DEFAULT '', + `description` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `speed_dial_idx` (`username`,`domain`,`sd_domain`,`sd_username`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `subscriber` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(64) NOT NULL DEFAULT '', + `domain` varchar(64) NOT NULL DEFAULT '', + `password` varchar(25) NOT NULL DEFAULT '', + `email_address` varchar(64) NOT NULL DEFAULT '', + `ha1` varchar(64) NOT NULL DEFAULT '', + `ha1b` varchar(64) NOT NULL DEFAULT '', + `rpid` varchar(64) DEFAULT NULL, + `uuid` char(36) NOT NULL, + `timezone` varchar(64) NOT NULL DEFAULT '', + `datetime_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `account_idx` (`username`,`domain`), + KEY `username_idx` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `trusted` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `src_ip` varchar(50) NOT NULL, + `proto` varchar(4) NOT NULL, + `from_pattern` varchar(64) DEFAULT NULL, + `tag` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `peer_idx` (`src_ip`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `usr_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`), + KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `dom_preferences` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) NOT NULL, + `username` varchar(128) NOT NULL DEFAULT '0', + `domain` varchar(64) NOT NULL DEFAULT '', + `attribute` varchar(32) NOT NULL DEFAULT '', + `type` int(11) NOT NULL DEFAULT '0', + `value` varchar(128) NOT NULL DEFAULT '', + `last_modified` datetime NOT NULL DEFAULT '1900-01-01 00:00:01', + PRIMARY KEY (`id`), + KEY `ua_idx` (`uuid`,`attribute`), + KEY `uda_idx` (`username`,`domain`,`attribute`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `address` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `grp` smallint(5) unsigned NOT NULL DEFAULT '0', + `ip_addr` varchar(15) NOT NULL, + `mask` tinyint(4) NOT NULL DEFAULT '32', + `port` smallint(5) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `version` ( + `table_name` varchar(32) NOT NULL, + `table_version` int(10) unsigned NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `voicemail_users` ( + `uniqueid` int(10) unsigned NOT NULL AUTO_INCREMENT, + `customer_id` char(36) NOT NULL DEFAULT '', + `context` varchar(63) NOT NULL DEFAULT 'default', + `mailbox` varchar(31) NOT NULL, + `password` varchar(31) NOT NULL DEFAULT '0', + `fullname` varchar(255) NOT NULL DEFAULT '', + `email` varchar(255) NOT NULL DEFAULT '', + `pager` varchar(255) NOT NULL DEFAULT '', + `tz` varchar(10) NOT NULL DEFAULT 'central', + `attach` varchar(4) NOT NULL DEFAULT 'yes', + `saycid` varchar(4) NOT NULL DEFAULT 'yes', + `dialout` varchar(10) NOT NULL DEFAULT '', + `callback` varchar(10) NOT NULL DEFAULT '', + `review` varchar(4) NOT NULL DEFAULT 'no', + `operator` varchar(4) NOT NULL DEFAULT 'no', + `envelope` varchar(4) NOT NULL DEFAULT 'no', + `sayduration` varchar(4) NOT NULL DEFAULT 'no', + `saydurationm` tinyint(4) NOT NULL DEFAULT '1', + `sendvoicemail` varchar(4) NOT NULL DEFAULT 'no', + `delete` varchar(4) NOT NULL DEFAULT 'no', + `nextaftercmd` varchar(4) NOT NULL DEFAULT 'yes', + `forcename` varchar(4) NOT NULL DEFAULT 'no', + `forcegreetings` varchar(4) NOT NULL DEFAULT 'no', + `hidefromdir` varchar(4) NOT NULL DEFAULT 'yes', + `stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`uniqueid`), + KEY `customer_idx` (`customer_id`), + KEY `mailbox_context` (`mailbox`,`context`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `voicemail_spool` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `msgnum` int(11) NOT NULL DEFAULT '0', + `dir` varchar(127) DEFAULT '', + `context` varchar(63) DEFAULT '', + `macrocontext` varchar(63) DEFAULT '', + `callerid` varchar(255) DEFAULT '', + `origtime` int(11) unsigned DEFAULT '0', + `duration` int(11) unsigned DEFAULT '0', + `mailboxuser` varchar(255) DEFAULT '', + `mailboxcontext` varchar(63) DEFAULT '', + `recording` longblob, + PRIMARY KEY (`id`), + KEY `dir` (`dir`), + KEY `mailboxuser_idx` (`mailboxuser`), + CONSTRAINT `v_s_mailboxuser_ref` FOREIGN KEY (`mailboxuser`) REFERENCES `voicemail_users` (`customer_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `fax_preferences` ( + `subscriber_id` int(10) unsigned NOT NULL, + `password` varchar(64) default NULL, + `name` varchar(64) default NULL, + `active` enum('true','false') NOT NULL default 'true', + `send_status` enum('true','false') NOT NULL default 'false', + `send_copy` enum('true','false') NOT NULL default 'false', + `send_copy_cc` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`subscriber_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `fax_destinations` ( + `id` int(10) unsigned NOT NULL auto_increment, + `subscriber_id` int(10) unsigned NOT NULL, + `destination` varchar(64) NOT NULL, + `filetype` enum('ps','tiff','pdf','pdf14') NOT NULL default 'tiff', + `cc` enum('true','false') NOT NULL default 'false', + `incoming` enum('true','false') NOT NULL default 'true', + `outgoing` enum('true','false') NOT NULL default 'false', + `status` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`id`), + KEY `subscriber_id` (`subscriber_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO `version` VALUES + ('acc',4), + ('gw',10), + ('lcr',3), + ('domain',1), + ('trusted',5), + ('location',1004), + ('dbaliases',1), + ('speed_dial',2), + ('usr_preferences',2), + ('subscriber',6), + ('dialog',4), + ('dispatcher',3), + ('address',3), + ('dialplan',1); + + +INSERT INTO `dispatcher` VALUES ('1','2','sip:127.0.0.1:5070','0','0','Voicemail servers'); +INSERT INTO `dispatcher` VALUES ('2','3','sip:127.0.0.1:5080','0','0','Application servers'); +INSERT INTO `dispatcher` VALUES ('3','4','sip:127.0.0.1:5090','0','0','Fax2Mail servers'); diff --git a/db_scripts/base/tmp/0060_create_faxserver.up b/db_scripts/base/tmp/0060_create_faxserver.up new file mode 100644 index 00000000..58651113 --- /dev/null +++ b/db_scripts/base/tmp/0060_create_faxserver.up @@ -0,0 +1,61 @@ +USE `kamailio`; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + + + +DROP TABLE IF EXISTS `fax_destinations`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `fax_destinations` ( + `id` int(10) unsigned NOT NULL auto_increment, + `subscriber_id` int(10) unsigned NOT NULL, + `destination` varchar(64) NOT NULL, + `filetype` enum('ps','tiff','pdf','pdf14') NOT NULL default 'tiff', + `cc` enum('true','false') NOT NULL default 'false', + `incoming` enum('true','false') NOT NULL default 'true', + `outgoing` enum('true','false') NOT NULL default 'false', + `status` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`id`), + KEY `subscriber_id` (`subscriber_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + + + + +DROP TABLE IF EXISTS `fax_preferences`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `fax_preferences` ( + `subscriber_id` int(10) unsigned NOT NULL, + `password` varchar(64), + `name` varchar(64), + `active` enum('true','false') NOT NULL default 'true', + `send_status` enum('true','false') NOT NULL default 'false', + `send_copy` enum('true','false') NOT NULL default 'false', + `send_copy_cc` enum('true','false') NOT NULL default 'false', + PRIMARY KEY (`subscriber_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; + + + +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; diff --git a/db_scripts/base/tmp/0070_create_no_replicates.up b/db_scripts/base/tmp/0070_create_no_replicates.up new file mode 100644 index 00000000..11d9a66b --- /dev/null +++ b/db_scripts/base/tmp/0070_create_no_replicates.up @@ -0,0 +1,8 @@ +USE accounting; +create table acc_backup like kamailio.acc; +create table acc_trash like kamailio.acc; + +USE kamailio; +create table acc_backup like kamailio.acc; +create table acc_trash like kamailio.acc; + diff --git a/db_scripts/base/tmp/0080_create_oss_triggers_kamailio.up b/db_scripts/base/tmp/0080_create_oss_triggers_kamailio.up new file mode 100644 index 00000000..585a892a --- /dev/null +++ b/db_scripts/base/tmp/0080_create_oss_triggers_kamailio.up @@ -0,0 +1,862 @@ + +USE provisioning; + +-- create triggers that populate kamailio tables +DELIMITER | + +CREATE TRIGGER voip_sub_crepl_trig AFTER INSERT ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE subscriber_domain varchar(127); + + SELECT domain INTO subscriber_domain FROM voip_domains where id = NEW.domain_id; + + INSERT INTO kamailio.subscriber (username, domain, uuid, timezone, password, datetime_created, ha1, ha1b) + VALUES(NEW.username, subscriber_domain, NEW.uuid, NEW.timezone, NEW.password, now(), + MD5(CONCAT(NEW.username, ':', subscriber_domain, ':', NEW.password)), + MD5(CONCAT(NEW.username, '@', subscriber_domain, ':', subscriber_domain, ':', NEW.password))); + END; +| + +CREATE TRIGGER voip_sub_urepl_trig AFTER UPDATE ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE old_subscriber_domain varchar(127); + DECLARE new_subscriber_domain varchar(127); + + SELECT domain INTO old_subscriber_domain FROM voip_domains where id = OLD.domain_id; + SELECT domain INTO new_subscriber_domain FROM voip_domains where id = NEW.domain_id; + + UPDATE kamailio.subscriber SET username = NEW.username, domain = new_subscriber_domain, + uuid = NEW.uuid, timezone = NEW.timezone, password = NEW.password, + ha1 = MD5(CONCAT(NEW.username, ':', new_subscriber_domain, ':', NEW.password)), + ha1b = MD5(CONCAT(NEW.username, '@', new_subscriber_domain, ':', new_subscriber_domain, ':', NEW.password)) + WHERE username = OLD.username + AND domain = old_subscriber_domain; + END; +| + +CREATE TRIGGER voip_sub_drepl_trig BEFORE DELETE ON voip_subscribers + FOR EACH ROW BEGIN + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + + SELECT domain INTO subscriber_domain FROM voip_domains where id = OLD.domain_id; + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = OLD.username AND domain = subscriber_domain; + + DELETE FROM kamailio.subscriber WHERE username = OLD.username + AND domain = subscriber_domain; + + -- should be implemented via a provisioning.voicemail_users table + -- and a foreign key to voip_subscribers + DELETE FROM kamailio.voicemail_users WHERE customer_id = OLD.uuid; + + -- work around MySQL bug. the cascaded delete should trigger our + -- delete actions on the provisioning tables, but doesn't + DELETE FROM kamailio.usr_preferences WHERE username = OLD.username + AND domain = subscriber_domain; + DELETE FROM kamailio.dbaliases WHERE username = OLD.username + AND domain = subscriber_domain; + DELETE FROM kamailio.speed_dial WHERE username = OLD.username + AND domain = subscriber_domain; + DELETE FROM kamailio.fax_preferences WHERE subscriber_id = os_subscriber_id; + DELETE FROM kamailio.fax_destinations WHERE subscriber_id = os_subscriber_id; + END; +| + +CREATE TRIGGER voip_dba_crepl_trig AFTER INSERT ON voip_dbaliases + FOR EACH ROW BEGIN + DECLARE dbalias_domain varchar(127); + DECLARE target_username varchar(127); + DECLARE target_domain varchar(127); + + SELECT domain INTO dbalias_domain FROM voip_domains where id = NEW.domain_id; + SELECT a.username, b.domain INTO target_username, target_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + INSERT INTO kamailio.dbaliases (alias_username, alias_domain, username, domain) + VALUES(NEW.username, dbalias_domain, target_username, target_domain); + END; +| + +CREATE TRIGGER voip_dba_urepl_trig AFTER UPDATE ON voip_dbaliases + FOR EACH ROW BEGIN + DECLARE old_dbalias_domain varchar(127); + DECLARE new_dbalias_domain varchar(127); + DECLARE target_username varchar(127); + DECLARE target_domain varchar(127); + + SELECT domain INTO old_dbalias_domain FROM voip_domains where id = OLD.domain_id; + SELECT domain INTO new_dbalias_domain FROM voip_domains where id = NEW.domain_id; + SELECT a.username, b.domain INTO target_username, target_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + UPDATE kamailio.dbaliases SET alias_username = NEW.username, alias_domain = new_dbalias_domain, + username = target_username, domain = target_domain + WHERE alias_username = OLD.username + AND alias_domain = old_dbalias_domain; + END; +| + +CREATE TRIGGER voip_dba_drepl_trig BEFORE DELETE ON voip_dbaliases + FOR EACH ROW BEGIN + DECLARE dbalias_domain varchar(127); + + SELECT domain INTO dbalias_domain FROM voip_domains where id = OLD.domain_id; + + DELETE FROM kamailio.dbaliases WHERE alias_username = OLD.username + AND alias_domain = dbalias_domain; + END; +| + +CREATE TRIGGER voip_prul_crepl_trig AFTER INSERT ON voip_peer_rules + FOR EACH ROW BEGIN + DECLARE prio int(11) unsigned; + + SELECT priority INTO prio FROM voip_peer_groups + WHERE id = NEW.group_id; + + INSERT INTO kamailio.lcr (lcr_id, prefix, from_uri, grp_id, priority) + VALUES(1, NEW.callee_prefix, IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), ''), NEW.group_id, prio); + + END; +| + +CREATE TRIGGER voip_prul_urepl_trig AFTER UPDATE ON voip_peer_rules + FOR EACH ROW BEGIN + DECLARE prio int(11) unsigned; + + SELECT priority INTO prio FROM voip_peer_groups + WHERE id = NEW.group_id; + + UPDATE kamailio.lcr SET prefix = NEW.callee_prefix, + from_uri = IF(LENGTH(NEW.caller_prefix), CONCAT('^', NEW.caller_prefix), '') + WHERE grp_id = OLD.group_id + AND prefix = OLD.callee_prefix + AND from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') + AND priority = prio; + + END; +| + +CREATE TRIGGER voip_pgrp_urepl_trig AFTER UPDATE ON voip_peer_groups + FOR EACH ROW BEGIN + + UPDATE kamailio.lcr SET priority = NEW.priority + WHERE grp_id = NEW.id; + + END; +| + +CREATE TRIGGER voip_prul_drepl_trig AFTER DELETE ON voip_peer_rules + FOR EACH ROW BEGIN + DECLARE prio int(11) unsigned; + + SELECT priority INTO prio FROM voip_peer_groups + WHERE id = OLD.group_id; + + DELETE FROM kamailio.lcr + WHERE grp_id = OLD.group_id AND + prefix = OLD.callee_prefix AND + from_uri = IF(LENGTH(OLD.caller_prefix), CONCAT('^', OLD.caller_prefix), '') AND + priority = prio; + + END; +| + +CREATE TRIGGER voip_pgrp_drepl_trig AFTER DELETE ON voip_peer_groups + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr WHERE grp_id = OLD.id; + DELETE FROM kamailio.gw WHERE grp_id = OLD.id; + + END; +| + +CREATE TRIGGER voip_phost_crepl_trig AFTER INSERT ON voip_peer_hosts + FOR EACH ROW BEGIN + + INSERT INTO kamailio.gw (lcr_id, gw_name, grp_id, ip_addr, port, weight, + uri_scheme, transport, strip, tag, flags, defunct) VALUES + (1, NEW.name, NEW.group_id, NEW.ip, NEW.port, NEW.weight, + 1, 1, 0, NULL, NEW.id, NULL); + + END; +| + +CREATE TRIGGER voip_phost_urepl_trig AFTER UPDATE ON voip_peer_hosts + FOR EACH ROW BEGIN + + UPDATE kamailio.gw SET gw_name = NEW.name, + ip_addr = NEW.ip, port = NEW.port, weight = NEW.weight, tag = NULL + WHERE grp_id = OLD.group_id AND gw_name = OLD.name AND + ip_addr = OLD.ip AND port = OLD.port AND weight = OLD.weight; + + END; +| + +CREATE TRIGGER voip_phost_drepl_trig AFTER DELETE ON voip_peer_hosts + FOR EACH ROW BEGIN + + DELETE FROM kamailio.gw + WHERE grp_id = OLD.group_id AND gw_name = OLD.name AND + ip_addr = OLD.ip AND port = OLD.port AND weight = OLD.weight; + DELETE FROM kamailio.dialplan + WHERE dpid IN (OLD.dp_caller_in_id, OLD.dp_callee_in_id, + OLD.dp_caller_out_id, OLD.dp_callee_out_id); + + END; +| + + +CREATE TRIGGER voip_domrw_crepl_trig AFTER INSERT ON voip_domain_rewrites + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + INSERT INTO kamailio.dialplan (dpid, pr, match_op, match_exp, + match_len, subst_exp, repl_exp, attrs) + VALUES(dp_id, NEW.priority, 1, NEW.match_pattern, 0, NEW.match_pattern, NEW.replace_pattern, ''); + + END; +| + +CREATE TRIGGER voip_domrw_urepl_trig AFTER UPDATE ON voip_domain_rewrites + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_caller_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = NEW.domain_id AND vp.attribute = 'dp_dom_callee_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + UPDATE kamailio.dialplan SET match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, repl_exp = NEW.replace_pattern, pr = NEW.priority + WHERE dpid = dp_id AND match_exp = OLD.match_pattern AND pr = OLD.priority + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_domrw_drepl_trig AFTER DELETE ON voip_domain_rewrites + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_caller_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_callee_in' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_caller_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp, + voip_domains vd WHERE vd.id = OLD.domain_id AND vp.attribute = 'dp_dom_callee_out' + AND vdp.attribute_id = vp.id AND vd.id = vdp.domain_id; + + IF OLD.direction = 'in' AND OLD.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF OLD.direction = 'in' AND OLD.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + DELETE FROM kamailio.dialplan + WHERE dpid = dp_id AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_peerrw_crepl_trig AFTER INSERT ON voip_peer_rewrites + FOR EACH ROW BEGIN + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + INTO caller_in_id, callee_in_id, caller_out_id, callee_out_id + FROM voip_peer_hosts WHERE id = NEW.peer_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + INSERT INTO kamailio.dialplan (dpid, pr, match_op, match_exp, + match_len, subst_exp, repl_exp, attrs) + VALUES(dp_id, NEW.priority, 1, NEW.match_pattern, 0, NEW.match_pattern, NEW.replace_pattern, ''); + + END; +| + +CREATE TRIGGER voip_peerrw_urepl_trig AFTER UPDATE ON voip_peer_rewrites + FOR EACH ROW BEGIN + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + INTO caller_in_id, callee_in_id, caller_out_id, callee_out_id + FROM voip_peer_hosts WHERE id = NEW.peer_id; + + IF NEW.direction = 'in' AND NEW.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF NEW.direction = 'in' AND NEW.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF NEW.direction = 'out' AND NEW.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + UPDATE kamailio.dialplan SET match_exp = NEW.match_pattern, + subst_exp = NEW.match_pattern, repl_exp = NEW.replace_pattern, + pr = NEW.priority + WHERE dpid = dp_id AND match_exp = OLD.match_pattern AND pr = OLD.priority + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_peerrw_drepl_trig AFTER DELETE ON voip_peer_rewrites + FOR EACH ROW BEGIN + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + DECLARE dp_id int(11) unsigned default 0; + + SELECT dp_caller_in_id, dp_callee_in_id, dp_caller_out_id, dp_callee_out_id + INTO caller_in_id, callee_in_id, caller_out_id, callee_out_id + FROM voip_peer_hosts WHERE id = OLD.peer_id; + + IF OLD.direction = 'in' AND OLD.field = 'caller' THEN + SET dp_id = caller_in_id; + ELSEIF OLD.direction = 'in' AND OLD.field = 'callee' THEN + SET dp_id = callee_in_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'caller' THEN + SET dp_id = caller_out_id; + ELSEIF OLD.direction = 'out' AND OLD.field = 'callee' THEN + SET dp_id = callee_out_id; + END IF; + + DELETE FROM kamailio.dialplan + WHERE dpid = dp_id AND match_exp = OLD.match_pattern + AND subst_exp = OLD.match_pattern AND repl_exp = OLD.replace_pattern; + + END; +| + +CREATE TRIGGER voip_usrpref_crepl_trig AFTER INSERT ON voip_usr_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE subscriber_uuid char(36); + DECLARE attribute_name varchar(31); + DECLARE attribute_type tinyint(3); + + SELECT a.username, b.domain, a.uuid INTO subscriber_username, subscriber_domain, subscriber_uuid + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND a.domain_id = b.id; + SELECT attribute, type INTO attribute_name, attribute_type + FROM voip_preferences + WHERE id = NEW.attribute_id; + + INSERT INTO kamailio.usr_preferences (uuid, username, domain, attribute, type, value) + VALUES(subscriber_uuid, subscriber_username, subscriber_domain, + attribute_name, attribute_type, NEW.value); + END; +| + +CREATE TRIGGER voip_usrpref_urepl_trig AFTER UPDATE ON voip_usr_preferences + FOR EACH ROW BEGIN + DECLARE old_subscriber_username varchar(127); + DECLARE new_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE new_subscriber_domain varchar(127); + DECLARE old_attribute_name varchar(31); + DECLARE new_attribute_name varchar(31); + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND a.domain_id = b.id; + SELECT a.username, b.domain INTO new_subscriber_username, new_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND a.domain_id = b.id; + SELECT attribute INTO old_attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + SELECT attribute INTO new_attribute_name + FROM voip_preferences + WHERE id = NEW.attribute_id; + + UPDATE kamailio.usr_preferences SET username = new_subscriber_username, domain = new_subscriber_domain, + attribute = new_attribute_name, value = NEW.value + WHERE username = old_subscriber_username + AND domain = old_subscriber_domain + AND attribute = old_attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_usrpref_drepl_trig BEFORE DELETE ON voip_usr_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE attribute_name varchar(31); + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND a.domain_id = b.id; + SELECT attribute INTO attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + + DELETE FROM kamailio.usr_preferences WHERE username = subscriber_username + AND domain = subscriber_domain + AND attribute = attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_dom_crepl_trig AFTER INSERT ON voip_domains + FOR EACH ROW BEGIN + + IF NEW.local IS TRUE THEN + INSERT INTO kamailio.domain (domain) VALUES(NEW.domain); + END IF; + + END; +| + +CREATE TRIGGER voip_dom_urepl_trig AFTER UPDATE ON voip_domains + FOR EACH ROW BEGIN + + IF NEW.local IS TRUE AND OLD.local IS FALSE THEN + INSERT INTO kamailio.domain (domain) VALUES(NEW.domain); + ELSEIF NEW.local IS FALSE AND OLD.local IS TRUE THEN + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + END IF; + + END; +| + +CREATE TRIGGER voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DECLARE caller_in_id int(11) unsigned; + DECLARE callee_in_id int(11) unsigned; + DECLARE caller_out_id int(11) unsigned; + DECLARE callee_out_id int(11) unsigned; + + SELECT vdp.value INTO caller_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_in_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_in' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO caller_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_caller_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + SELECT vdp.value INTO callee_out_id FROM voip_dom_preferences vdp, voip_preferences vp + WHERE vp.attribute = 'dp_dom_callee_out' AND vdp.attribute_id = vp.id AND vdp.domain_id = OLD.id; + + IF OLD.local IS TRUE THEN + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + END IF; + + DELETE FROM kamailio.dialplan WHERE dpid IN + (caller_in_id, callee_in_id, caller_out_id, callee_out_id); + + -- work around MySQL bug. the cascaded delete should trigger our + -- voip_dom_preferences delete action, but doesn't + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + -- this will trigger the delete action for each subscriber + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + + END; +| + +CREATE TRIGGER voip_dompref_crepl_trig AFTER INSERT ON voip_dom_preferences + FOR EACH ROW BEGIN + DECLARE domain_name varchar(127); + DECLARE attribute_name varchar(31); + DECLARE attribute_type tinyint(3); + + SELECT domain INTO domain_name + FROM voip_domains + WHERE id = NEW.domain_id; + SELECT attribute, type INTO attribute_name, attribute_type + FROM voip_preferences + WHERE id = NEW.attribute_id; + + INSERT INTO kamailio.dom_preferences (domain, attribute, type, value) + VALUES(domain_name, attribute_name, attribute_type, NEW.value); + END; +| + +CREATE TRIGGER voip_dompref_urepl_trig AFTER UPDATE ON voip_dom_preferences + FOR EACH ROW BEGIN + DECLARE old_domain_name varchar(127); + DECLARE new_domain_name varchar(127); + DECLARE old_attribute_name varchar(31); + DECLARE new_attribute_name varchar(31); + + SELECT domain INTO old_domain_name + FROM voip_domains + WHERE id = OLD.domain_id; + SELECT domain INTO new_domain_name + FROM voip_domains + WHERE id = NEW.domain_id; + SELECT attribute INTO old_attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + SELECT attribute INTO new_attribute_name + FROM voip_preferences + WHERE id = NEW.attribute_id; + + UPDATE kamailio.dom_preferences SET domain = new_domain_name, + attribute = new_attribute_name, + value = NEW.value + WHERE domain = old_domain_name + AND attribute = old_attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_dompref_drepl_trig BEFORE DELETE ON voip_dom_preferences + FOR EACH ROW BEGIN + DECLARE domain_name varchar(127); + DECLARE attribute_name varchar(31); + + SELECT domain INTO domain_name + FROM voip_domains + WHERE id = OLD.domain_id; + SELECT attribute INTO attribute_name + FROM voip_preferences + WHERE id = OLD.attribute_id; + + DELETE FROM kamailio.dom_preferences WHERE domain = domain_name + AND attribute = attribute_name + AND value = OLD.value; + END; +| + +CREATE TRIGGER voip_sd_crepl_trig AFTER INSERT ON voip_speed_dial + FOR EACH ROW BEGIN + DECLARE target_username varchar(64); + DECLARE target_domain varchar(64); + + SELECT a.username, b.domain INTO target_username, target_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + INSERT INTO kamailio.speed_dial (username, domain, sd_username, sd_domain, + new_uri, fname, lname, description) + VALUES(target_username, target_domain, + NEW.slot, target_domain, + NEW.destination, '', '', ''); + END; +| + +CREATE TRIGGER voip_sd_urepl_trig AFTER UPDATE ON voip_speed_dial + FOR EACH ROW BEGIN + DECLARE old_username varchar(127); + DECLARE old_domain varchar(127); + DECLARE new_username varchar(127); + DECLARE new_domain varchar(127); + + SELECT a.username, b.domain INTO old_username, old_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + SELECT a.username, b.domain INTO new_username, new_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + UPDATE kamailio.speed_dial SET username = new_username, domain = new_domain, + sd_username = NEW.slot, sd_domain = new_domain, + new_uri = NEW.destination + WHERE username = old_username + AND domain = old_domain + AND sd_username = OLD.slot; + END; +| + +CREATE TRIGGER voip_sd_drepl_trig BEFORE DELETE ON voip_speed_dial + FOR EACH ROW BEGIN + DECLARE old_username varchar(127); + DECLARE old_domain varchar(127); + + SELECT a.username, b.domain INTO old_username, old_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + DELETE FROM kamailio.speed_dial WHERE username = old_username + AND domain = old_domain + AND sd_username = OLD.slot; + END; +| + +CREATE TRIGGER voip_faxp_crepl_trig AFTER INSERT ON voip_fax_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + INSERT INTO kamailio.fax_preferences + (subscriber_id, password, name, active, send_status, send_copy) + VALUES(os_subscriber_id, NEW.password, NEW.name, IF(NEW.active, 'true', 'false'), + IF(NEW.send_status, 'true', 'false'), IF(NEW.send_copy, 'true', 'false')); + + END; +| + +CREATE TRIGGER voip_faxp_urepl_trig AFTER UPDATE ON voip_fax_preferences + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + UPDATE kamailio.fax_preferences SET subscriber_id = os_subscriber_id, password = NEW.password, + name = NEW.name, active = IF(NEW.active, 'true', 'false'), + send_status = IF(NEW.send_status, 'true', 'false'), + send_copy = IF(NEW.send_copy, 'true', 'false') + WHERE subscriber_id = old_os_subscriber_id; + + END; +| + +CREATE TRIGGER voip_faxp_drepl_trig BEFORE DELETE ON voip_fax_preferences + FOR EACH ROW BEGIN + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + DELETE FROM kamailio.fax_preferences WHERE subscriber_id = old_os_subscriber_id; + + END; +| + +CREATE TRIGGER voip_faxd_crepl_trig AFTER INSERT ON voip_fax_destinations + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + INSERT INTO kamailio.fax_destinations (subscriber_id, destination, filetype, + cc, incoming, outgoing, status) + VALUES(os_subscriber_id, NEW.destination, NEW.filetype, + IF(NEW.cc, 'true', 'false'), IF(NEW.incoming, 'true', 'false'), + IF(NEW.outgoing, 'true', 'false'), IF(NEW.status, 'true', 'false')); + + END; +| + +CREATE TRIGGER voip_faxd_urepl_trig AFTER UPDATE ON voip_fax_destinations + FOR EACH ROW BEGIN + DECLARE subscriber_username varchar(127); + DECLARE subscriber_domain varchar(127); + DECLARE os_subscriber_id int(10) UNSIGNED; + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO subscriber_username, subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = NEW.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO os_subscriber_id FROM kamailio.subscriber + WHERE username = subscriber_username AND domain = subscriber_domain; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + UPDATE kamailio.fax_destinations SET subscriber_id = os_subscriber_id, destination = NEW.destination, + filetype = NEW.filetype, cc = IF(NEW.cc, 'true', 'false'), + incoming = IF(NEW.incoming, 'true', 'false'), + outgoing = IF(NEW.outgoing, 'true', 'false'), + status = IF(NEW.status, 'true', 'false') + WHERE subscriber_id = old_os_subscriber_id + AND destination = OLD.destination; + + END; +| + +CREATE TRIGGER voip_faxd_drepl_trig BEFORE DELETE ON voip_fax_destinations + FOR EACH ROW BEGIN + DECLARE old_subscriber_username varchar(127); + DECLARE old_subscriber_domain varchar(127); + DECLARE old_os_subscriber_id int(10) UNSIGNED; + + SELECT a.username, b.domain INTO old_subscriber_username, old_subscriber_domain + FROM voip_subscribers a, voip_domains b + WHERE a.id = OLD.subscriber_id + AND b.id = a.domain_id; + + SELECT id INTO old_os_subscriber_id FROM kamailio.subscriber + WHERE username = old_subscriber_username AND domain = old_subscriber_domain; + + DELETE FROM kamailio.fax_destinations WHERE subscriber_id = old_os_subscriber_id + AND destination = OLD.destination; + + END; +| + +CREATE TRIGGER voip_aig_crepl_trig AFTER INSERT ON voip_allowed_ip_groups + FOR EACH ROW BEGIN + + INSERT INTO kamailio.address (id, grp, ip_addr, mask) + VALUES(NEW.id, NEW.group_id, + IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', 1), NEW.ipnet), + IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', -1), 32)); + + END; +| + +CREATE TRIGGER voip_aig_urepl_trig AFTER UPDATE ON voip_allowed_ip_groups + FOR EACH ROW BEGIN + + UPDATE kamailio.address SET id = NEW.id, grp = NEW.group_id, + ip_addr = IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', 1), NEW.ipnet), + mask = IF(LOCATE('/', NEW.ipnet), SUBSTRING_INDEX(NEW.ipnet, '/', -1), 32) + WHERE id = OLD.id; + + END; +| + +CREATE TRIGGER voip_aig_drepl_trig BEFORE DELETE ON voip_allowed_ip_groups + FOR EACH ROW BEGIN + + DELETE FROM kamailio.address WHERE id = OLD.id; + + END; +| + +DELIMITER ; diff --git a/db_scripts/base/tmp/0090_create_syslog.up b/db_scripts/base/tmp/0090_create_syslog.up new file mode 100644 index 00000000..09524ed6 --- /dev/null +++ b/db_scripts/base/tmp/0090_create_syslog.up @@ -0,0 +1,99 @@ +-- step out of our provisioning DB +USE mysql; + +-- drop database if it allready exists +-- this will drop all tables and triggers +DROP DATABASE IF EXISTS syslog; + +-- create DB with utf8 default charset, so we don't have to +-- specify charset for each table +CREATE DATABASE IF NOT EXISTS syslog CHARACTER SET 'utf8'; + +USE syslog; + + +CREATE TABLE `se1` ( + `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `CustomerID` bigint(20) DEFAULT NULL, + `ReceivedAt` datetime DEFAULT NULL, + `DeviceReportedTime` datetime DEFAULT NULL, + `Facility` smallint(6) DEFAULT NULL, + `Priority` smallint(6) DEFAULT NULL, + `FromHost` varchar(60) DEFAULT NULL, + `Message` text, + `NTSeverity` int(11) DEFAULT NULL, + `Importance` int(11) DEFAULT NULL, + `EventSource` varchar(60) DEFAULT NULL, + `EventUser` varchar(60) DEFAULT NULL, + `EventCategory` int(11) DEFAULT NULL, + `EventID` int(11) DEFAULT NULL, + `EventBinaryData` text, + `MaxAvailable` int(11) DEFAULT NULL, + `CurrUsage` int(11) DEFAULT NULL, + `MinUsage` int(11) DEFAULT NULL, + `MaxUsage` int(11) DEFAULT NULL, + `InfoUnitID` int(11) DEFAULT NULL, + `SysLogTag` varchar(60) DEFAULT NULL, + `EventLogType` varchar(60) DEFAULT NULL, + `GenericFileName` varchar(60) DEFAULT NULL, + `SystemID` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE `se2` like `se1`; +CREATE TABLE `se3` like `se1`; +CREATE TABLE `se4` like `se1`; +CREATE TABLE `se5` like `se1`; +CREATE TABLE `se6` like `se1`; +CREATE TABLE `se7` like `se1`; +CREATE TABLE `se8` like `se1`; +CREATE TABLE `se9` like `se1`; +CREATE TABLE `se10` like `se1`; +CREATE TABLE `se11` like `se1`; +CREATE TABLE `se12` like `se1`; +CREATE TABLE `se13` like `se1`; +CREATE TABLE `se14` like `se1`; +CREATE TABLE `se15` like `se1`; +CREATE TABLE `se16` like `se1`; +CREATE TABLE `se17` like `se1`; +CREATE TABLE `se18` like `se1`; +CREATE TABLE `se19` like `se1`; +CREATE TABLE `se20` like `se1`; +CREATE TABLE `se21` like `se1`; +CREATE TABLE `se22` like `se1`; +CREATE TABLE `se23` like `se1`; +CREATE TABLE `se24` like `se1`; +CREATE TABLE `se25` like `se1`; +CREATE TABLE `se26` like `se1`; +CREATE TABLE `se27` like `se1`; +CREATE TABLE `se28` like `se1`; + +CREATE TABLE `SystemEvents` ( + `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `CustomerID` bigint(20) DEFAULT NULL, + `ReceivedAt` datetime DEFAULT NULL, + `DeviceReportedTime` datetime DEFAULT NULL, + `Facility` smallint(6) DEFAULT NULL, + `Priority` smallint(6) DEFAULT NULL, + `FromHost` varchar(60) DEFAULT NULL, + `Message` text, + `NTSeverity` int(11) DEFAULT NULL, + `Importance` int(11) DEFAULT NULL, + `EventSource` varchar(60) DEFAULT NULL, + `EventUser` varchar(60) DEFAULT NULL, + `EventCategory` int(11) DEFAULT NULL, + `EventID` int(11) DEFAULT NULL, + `EventBinaryData` text, + `MaxAvailable` int(11) DEFAULT NULL, + `CurrUsage` int(11) DEFAULT NULL, + `MinUsage` int(11) DEFAULT NULL, + `MaxUsage` int(11) DEFAULT NULL, + `InfoUnitID` int(11) DEFAULT NULL, + `SysLogTag` varchar(60) DEFAULT NULL, + `EventLogType` varchar(60) DEFAULT NULL, + `GenericFileName` varchar(60) DEFAULT NULL, + `SystemID` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=FIRST UNION=(`se1`,`se2`,`se3`,`se4`,`se5`,`se6`,`se7`,`se8`,`se9`,`se10`,`se11`,`se12`,`se13`,`se14`,`se15`,`se16`,`se17`,`se18`,`se19`,`se20`,`se21`,`se22`,`se23`,`se24`,`se25`,`se26`,`se27`,`se28`); + + diff --git a/db_scripts/base/tmp/0100_grants_dbs.up b/db_scripts/base/tmp/0100_grants_dbs.up new file mode 100644 index 00000000..ff519949 --- /dev/null +++ b/db_scripts/base/tmp/0100_grants_dbs.up @@ -0,0 +1,59 @@ +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO replicator@"192.168.255.%" IDENTIFIED BY 'PW_REPLICATOR'; + +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON mysql.* TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON mysql.* TO nagios@localhost IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON kamailio.location TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON kamailio.location TO nagios@localhost IDENTIFIED BY 'PW_CHECKTOOL'; + +GRANT SELECT ON kamailio.* TO kamailioro@localhost IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT ALL ON kamailio.* TO kamailio@localhost IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON kamailio.location TO natping@'192.168.255.%' IDENTIFIED BY 'PW_NATPING'; +GRANT SELECT ON kamailio.location TO natping@localhost IDENTIFIED BY 'PW_NATPING'; + +GRANT ALL ON accounting.* TO 'collector'@'localhost' IDENTIFIED BY 'PW_COLLECTOR'; +GRANT ALL ON accounting.* TO 'collector'@'192.168.255.%' IDENTIFIED BY 'PW_COLLECTOR'; + +GRANT ALL ON accounting.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR'; +GRANT ALL ON accounting.* TO 'mediator'@'192.168.255.%' IDENTIFIED BY 'PW_MEDIATOR'; +GRANT SELECT ON provisioning.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR'; +GRANT SELECT ON provisioning.* TO 'mediator'@'192.168.255.%' IDENTIFIED BY 'PW_MEDIATOR'; +GRANT SELECT ON billing.* TO 'mediator'@'localhost' IDENTIFIED BY 'PW_MEDIATOR'; +GRANT SELECT ON billing.* TO 'mediator'@'192.168.255.%' IDENTIFIED BY 'PW_MEDIATOR'; + +GRANT ALL ON accounting.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON accounting.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON billing.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON billing.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP'; + +GRANT ALL PRIVILEGES ON kamailio.voicemail_users TO asterisk@'192.168.255.%' IDENTIFIED BY 'PW_ASTERISK'; +GRANT ALL PRIVILEGES ON kamailio.voicemail_users TO asterisk@localhost IDENTIFIED BY 'PW_ASTERISK'; +GRANT ALL PRIVILEGES ON kamailio.voicemail_spool TO asterisk@'192.168.255.%' IDENTIFIED BY 'PW_ASTERISK'; +GRANT ALL PRIVILEGES ON kamailio.voicemail_spool TO asterisk@localhost IDENTIFIED BY 'PW_ASTERISK'; + +GRANT ALL ON provisioning.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON provisioning.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON kamailio.* TO 'soap'@'localhost' IDENTIFIED BY 'PW_SOAP'; +GRANT ALL ON kamailio.* TO 'soap'@'192.168.255.%' IDENTIFIED BY 'PW_SOAP'; + +GRANT SELECT ON powerdns.* TO pdns@'192.168.255.%' IDENTIFIED BY 'dns4Sipwise!'; + +GRANT SELECT ON accounting.cdr TO exporter@'192.168.255.%' IDENTIFIED BY 'PW_EXPORTER'; +GRANT SELECT ON accounting.cdr TO exporter@localhost IDENTIFIED BY 'PW_EXPORTER'; +GRANT SELECT,INSERT,UPDATE ON accounting.mark TO exporter@'192.168.255.%' IDENTIFIED BY 'PW_EXPORTER'; +GRANT SELECT,INSERT,UPDATE ON accounting.mark TO exporter@localhost IDENTIFIED BY 'PW_EXPORTER'; + +GRANT RELOAD ON *.* TO rsyslog@localhost IDENTIFIED BY 'PW_RSYSLOG'; +GRANT ALL on syslog.* TO rsyslog@localhost IDENTIFIED BY 'PW_RSYSLOG'; + +GRANT SELECT,INSERT,UPDATE ON accounting.* TO rateomat@'192.168.255.%' IDENTIFIED BY 'PW_RATEOMAT'; +GRANT SELECT,INSERT,UPDATE ON accounting.* TO rateomat@localhost IDENTIFIED BY 'PW_RATEOMAT'; +GRANT SELECT,INSERT,UPDATE ON billing.* TO rateomat@'192.168.255.%' IDENTIFIED BY 'PW_RATEOMAT'; +GRANT SELECT,INSERT,UPDATE ON billing.* TO rateomat@localhost IDENTIFIED BY 'PW_RATEOMAT'; + +GRANT ALL PRIVILEGES ON *.* TO sipwise@localhost IDENTIFIED BY 'PW_SIPWISE' WITH GRANT OPTION; + +GRANT ALL PRIVILEGES ON kamailio.* to dbcleaner@localhost IDENTIFIED BY 'PW_CLEANUP_TOOLS'; +GRANT ALL PRIVILEGES ON kamailio.* to dbcleaner@'192.168.255.%' IDENTIFIED BY 'PW_CLEANUP_TOOLS'; +GRANT ALL PRIVILEGES ON accounting.* to dbcleaner@localhost IDENTIFIED BY 'PW_CLEANUP_TOOLS'; +GRANT ALL PRIVILEGES ON accounting.* to dbcleaner@'192.168.255.%' IDENTIFIED BY 'PW_CLEANUP_TOOLS'; diff --git a/db_scripts/base/tmp/0110_grants_proxies_kamailio.up b/db_scripts/base/tmp/0110_grants_proxies_kamailio.up new file mode 100644 index 00000000..eec8f62d --- /dev/null +++ b/db_scripts/base/tmp/0110_grants_proxies_kamailio.up @@ -0,0 +1,11 @@ +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SUPER,REPLICATION CLIENT,REPLICATION SLAVE,RELOAD ON *.* TO nagios@localhost IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON mysql.* TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON mysql.* TO nagios@localhost IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON kamailio.location TO nagios@"192.168.255.%" IDENTIFIED BY 'PW_CHECKTOOL'; +GRANT SELECT ON kamailio.location TO nagios@localhost IDENTIFIED BY 'PW_CHECKTOOL'; + +GRANT SELECT ON kamailio.* TO kamailioro@localhost IDENTIFIED BY 'PW_KAMAILIORO'; +GRANT ALL ON kamailio.* TO kamailio@localhost IDENTIFIED BY 'PW_KAMAILIORW'; +GRANT SELECT ON provisioning.voip_peer_hosts TO kamailio@localhost IDENTIFIED BY 'PW_KAMAILIORW'; + diff --git a/db_scripts/diff/7006.down b/db_scripts/diff/7006.down new file mode 100644 index 00000000..3261fa2a --- /dev/null +++ b/db_scripts/diff/7006.down @@ -0,0 +1 @@ +ALTER TABLE provisioning.voip_peer_hosts change column ip ip varchar(15) NOT NULL; diff --git a/db_scripts/diff/7006.up b/db_scripts/diff/7006.up new file mode 100644 index 00000000..dac409b3 --- /dev/null +++ b/db_scripts/diff/7006.up @@ -0,0 +1 @@ +ALTER TABLE provisioning.voip_peer_hosts change column ip ip varchar(64) NOT NULL; diff --git a/db_scripts/diff/7036.down b/db_scripts/diff/7036.down new file mode 100644 index 00000000..d37190f7 --- /dev/null +++ b/db_scripts/diff/7036.down @@ -0,0 +1,2 @@ +DELETE FROM provisioning.voip_preferences where attribute = 'always_use_ipv4_for_rtpproxy'; +DELETE FROM provisioning.voip_preferences where attribute = 'always_use_ipv6_for_rtpproxy'; diff --git a/db_scripts/diff/7036.up b/db_scripts/diff/7036.up new file mode 100644 index 00000000..edbcbd88 --- /dev/null +++ b/db_scripts/diff/7036.up @@ -0,0 +1,2 @@ +INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_ipv4_for_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Always force the IPv4 address for the RTP relay, regardless of what is autodetected on SIP/SDP level. This is mutually exclusive with always_use_ipv6_for_rtpproxy.'); +INSERT INTO provisioning.voip_preferences (attribute, type, dom_pref, usr_pref, peer_pref, data_type, max_occur, description) VALUES('always_use_ipv6_for_rtpproxy', 1, 1, 1, 1, 'boolean', 1, 'Always force the IPv6 address for the RTP relay, regardless of what is autodetected on SIP/SDP level. This is mutually exclusive with always_use_ipv4_for_rtpproxy.'); diff --git a/db_scripts/diff/7065.down b/db_scripts/diff/7065.down new file mode 100644 index 00000000..a9c1f39d --- /dev/null +++ b/db_scripts/diff/7065.down @@ -0,0 +1 @@ +ALTER TABLE kamailio.lcr_gw CHANGE COLUMN ip_addr ip_addr varchar(15) NOT NULL; diff --git a/db_scripts/diff/7065.up b/db_scripts/diff/7065.up new file mode 100644 index 00000000..c63f602f --- /dev/null +++ b/db_scripts/diff/7065.up @@ -0,0 +1 @@ +ALTER TABLE kamailio.lcr_gw CHANGE COLUMN ip_addr ip_addr varchar(64) NOT NULL; diff --git a/db_scripts/diff/7095.down b/db_scripts/diff/7095.down new file mode 100644 index 00000000..002bd7d7 --- /dev/null +++ b/db_scripts/diff/7095.down @@ -0,0 +1,4 @@ +USE `provisioning`; + +DROP TABLE `voip_cf_destinations`; +DROP TABLE `voip_cf_destination_sets`; diff --git a/db_scripts/diff/7095.up b/db_scripts/diff/7095.up new file mode 100644 index 00000000..ff466922 --- /dev/null +++ b/db_scripts/diff/7095.up @@ -0,0 +1,22 @@ +USE `provisioning`; + +CREATE TABLE `voip_cf_destination_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `name_idx` (`name`), + CONSTRAINT `v_s_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_destinations` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `destination_set_id` int(11) unsigned NOT NULL, + `destination` varchar(255) NOT NULL, + `priority` int(3) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `dset_idx` (`destination_set_id`), + KEY `destination_idx` (`destination`), + CONSTRAINT `v_cf_dsetid_ref` FOREIGN KEY (`destination_set_id`) REFERENCES `voip_cf_destination_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; diff --git a/db_scripts/diff/7209.down b/db_scripts/diff/7209.down new file mode 100644 index 00000000..645b0d13 --- /dev/null +++ b/db_scripts/diff/7209.down @@ -0,0 +1,4 @@ +USE provisioning; + +DROP TABLE voip_cf_periods; +DROP TABLE voip_cf_time_sets; diff --git a/db_scripts/diff/7209.up b/db_scripts/diff/7209.up new file mode 100644 index 00000000..54c77bbe --- /dev/null +++ b/db_scripts/diff/7209.up @@ -0,0 +1,27 @@ +USE provisioning; + +CREATE TABLE `voip_cf_time_sets` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `name_idx` (`name`), + CONSTRAINT `v_cf_ts_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES +`voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE `voip_cf_periods` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `time_set_id` int(11) unsigned NOT NULL, + `year` varchar(255) DEFAULT NULL, + `month` varchar(255) DEFAULT NULL, + `mday` varchar(255) DEFAULT NULL, + `wday` varchar(255) DEFAULT NULL, + `hour` varchar(255) DEFAULT NULL, + `minute` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tset_idx` (`time_set_id`), + CONSTRAINT `v_cf_tsetid_ref` FOREIGN KEY (`time_set_id`) REFERENCES +`voip_cf_time_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; diff --git a/db_scripts/diff/7252.down b/db_scripts/diff/7252.down new file mode 100644 index 00000000..7bef7d47 --- /dev/null +++ b/db_scripts/diff/7252.down @@ -0,0 +1,2 @@ +USE provisioning; +DROP TABLE `voip_cf_mappings`; diff --git a/db_scripts/diff/7252.up b/db_scripts/diff/7252.up new file mode 100644 index 00000000..03281eab --- /dev/null +++ b/db_scripts/diff/7252.up @@ -0,0 +1,14 @@ +USE provisioning; + +CREATE TABLE `voip_cf_mappings` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `type` enum('cfu','cfb','cfna','cft') NOT NULL DEFAULT 'cfu', + `destination_set_id` int(11) unsigned DEFAULT NULL, + `time_set_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `sub_idx` (`subscriber_id`), + KEY `type_idx` (`type`), + CONSTRAINT `v_cfmap_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES +`voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; diff --git a/db_scripts/diff/7259.down b/db_scripts/diff/7259.down new file mode 100644 index 00000000..d07efe99 --- /dev/null +++ b/db_scripts/diff/7259.down @@ -0,0 +1,5 @@ +REVOKE ALL PRIVILEGES ON provisioning.voip_cf_destination_sets FROM 'kamailio'@'localhost'; +REVOKE ALL PRIVILEGES ON provisioning.voip_cf_destinatios FROM 'kamailio'@'localhost'; +REVOKE ALL PRIVILEGES ON provisioning.voip_cf_time_sets FROM 'kamailio'@'localhost'; +REVOKE ALL PRIVILEGES ON provisioning.voip_cf_periods FROM 'kamailio'@'localhost'; +REVOKE ALL PRIVILEGES ON provisioning.voip_cf_mappings FROM 'kamailio'@'localhost'; diff --git a/db_scripts/diff/7259.up b/db_scripts/diff/7259.up new file mode 100644 index 00000000..2244cebe --- /dev/null +++ b/db_scripts/diff/7259.up @@ -0,0 +1,5 @@ +GRANT SELECT ON provisioning.voip_cf_destination_sets TO 'kamailio'@'localhost'; +GRANT SELECT ON provisioning.voip_cf_destinations TO 'kamailio'@'localhost'; +GRANT SELECT ON provisioning.voip_cf_periods TO 'kamailio'@'localhost'; +GRANT SELECT ON provisioning.voip_cf_time_sets TO 'kamailio'@'localhost'; +GRANT SELECT ON provisioning.voip_cf_mappings TO 'kamailio'@'localhost'; diff --git a/db_scripts/diff/7260.down b/db_scripts/diff/7260.down new file mode 100644 index 00000000..b186da9f --- /dev/null +++ b/db_scripts/diff/7260.down @@ -0,0 +1,94 @@ +use provisioning; + +set autocommit=0; + +-- tmp table holding priority 0 CF destinations +drop table if exists tmp_cf_map; +create table tmp_cf_map ( + id int(11) unsigned not null auto_increment primary key, + subscriber_id int(11) unsigned not null, + type enum('cfu', 'cft', 'cfb', 'cfna') not null default 'cfu', + destination varchar(255) not null, + key tidx(type) +) engine=innodb; + +-- fetch topmost CFUs +insert into tmp_cf_map (subscriber_id, type, destination) + select m.subscriber_id, m.type, d.destination from voip_cf_destinations d, + voip_cf_destination_sets s, voip_cf_mappings m, voip_usr_preferences p, + voip_preferences vp + where vp.attribute = 'cfu' and m.type = 'cfu' and p.attribute_id = vp.id + and p.value = m.id and m.destination_set_id = s.id + and p.subscriber_id = s.subscriber_id and d.destination_set_id = s.id + and d.priority = 0 + group by m.subscriber_id; + +-- fetch topmost CFBs +insert into tmp_cf_map (subscriber_id, type, destination) + select m.subscriber_id, m.type, d.destination from voip_cf_destinations d, + voip_cf_destination_sets s, voip_cf_mappings m, voip_usr_preferences p, + voip_preferences vp + where vp.attribute = 'cfb' and m.type = 'cfb' and p.attribute_id = vp.id + and p.value = m.id and m.destination_set_id = s.id + and p.subscriber_id = s.subscriber_id and d.destination_set_id = s.id + and d.priority = 0 + group by m.subscriber_id; + +-- fetch topmost CFTs +insert into tmp_cf_map (subscriber_id, type, destination) + select m.subscriber_id, m.type, d.destination from voip_cf_destinations d, + voip_cf_destination_sets s, voip_cf_mappings m, voip_usr_preferences p, + voip_preferences vp + where vp.attribute = 'cft' and m.type = 'cft' and p.attribute_id = vp.id + and p.value = m.id and m.destination_set_id = s.id + and p.subscriber_id = s.subscriber_id and d.destination_set_id = s.id + and d.priority = 0 + group by m.subscriber_id; + +-- fetch topmost CFNAs +insert into tmp_cf_map (subscriber_id, type, destination) + select m.subscriber_id, m.type, d.destination from voip_cf_destinations d, + voip_cf_destination_sets s, voip_cf_mappings m, voip_usr_preferences p, + voip_preferences vp + where vp.attribute = 'cfna' and m.type = 'cfna' and p.attribute_id = vp.id + and p.value = m.id and m.destination_set_id = s.id + and p.subscriber_id = s.subscriber_id and d.destination_set_id = s.id + and d.priority = 0 + group by m.subscriber_id; + +-- now get rid of existing CF preferences +delete up.* from voip_usr_preferences up, voip_preferences p + where p.attribute in ('cfu', 'cfb', 'cfna', 'cft') + and up.attribute_id = p.id; + +-- and change back the settings to the old ones +update voip_preferences set type=0, data_type='string', internal=0, read_only=0, max_occur=1, + description='E.164 number or complete SIP URI. "Call forward unconditional" - if set, all incoming calls are forwarded to this destination. E.164 numbers have to be fully qualified and may be prefixed by a plus sign. E.164 numbers specified in SIP URIs have to be prefixed by a plus sign if they are fully qualified but they must always carry the subscriber\'s own domain, like in "sip:+@".' + where attribute='cfu'; + +update voip_preferences set type=0, data_type='string', internal=0, read_only=0, max_occur=1, + description='E.164 number or complete SIP URI. "Call forward busy" - if set, all incoming calls are forwarded to this destination while the subscriber is on a call. Same syntax as for "cfu".' + where attribute='cfb'; + +update voip_preferences set type=0, data_type='string', internal=0, read_only=0, max_occur=1, + description='E.164 number or complete SIP URI. "Call forward not available" - if set, all incoming calls are forwarded to this destination if the subscriber is not online and registered. Same syntax as for "cfu".' + where attribute='cfna'; + +update voip_preferences set type=0, data_type='string', internal=0, read_only=0, max_occur=1, + description='E.164 number or complete SIP URI. "Call forward timeout" - if set, all incoming calls are forwarded to this destination after a timeout that can be set via "ringtimeout" below. Same syntax as for "cfu".' + where attribute='cft'; + +-- finally copy over the vars from the tmp table and drop it +insert into voip_usr_preferences(subscriber_id, attribute_id, value) select t.subscriber_id, p.id, t.destination from tmp_cf_map t, voip_preferences p where t.type = p.attribute; + +drop table tmp_cf_map; + +-- clean up after us, just in case +delete from voip_cf_mappings; +delete from voip_cf_time_sets; +delete from voip_cf_destination_sets; +delete from voip_cf_destinations; +delete from voip_cf_periods; + +commit; +set autocommit=1; diff --git a/db_scripts/diff/7260.up b/db_scripts/diff/7260.up new file mode 100644 index 00000000..1728c221 --- /dev/null +++ b/db_scripts/diff/7260.up @@ -0,0 +1,58 @@ +use provisioning; + +set autocommit=0; + +-- clean up before starting, just in case +delete from voip_cf_mappings; +delete from voip_cf_time_sets; +delete from voip_cf_destination_sets; +delete from voip_cf_destinations; +delete from voip_cf_periods; + +-- create destination sets +insert into voip_cf_destination_sets (subscriber_id, name) + select up.subscriber_id, concat(p.attribute, '_set') + from voip_usr_preferences up, voip_preferences p + where p.attribute in ('cfu', 'cfna', 'cft', 'cfb') + and up.attribute_id = p.id; + +-- fill destinations +insert into voip_cf_destinations (destination_set_id, destination, priority) + select s.id, up.value, 0 + from voip_cf_destination_sets s, voip_usr_preferences up, voip_preferences p + where p.attribute in ('cfu', 'cfna', 'cft', 'cfb') + and p.id = up.attribute_id and up.subscriber_id = s.subscriber_id + and concat(p.attribute, '_set') = s.name; + +-- fill cf mappings +insert into voip_cf_mappings(subscriber_id, type, destination_set_id) + select s.subscriber_id, substring_index(s.name, '_', 1), s.id + from voip_cf_destination_sets s; + +-- now get rid of existing CF preferences +delete up.* from voip_usr_preferences up, voip_preferences p + where p.attribute in ('cfu', 'cfb', 'cfna', 'cft') + and up.attribute_id = p.id; + +-- and change the preference settings to the new ones +update voip_preferences set type=1, data_type='int', internal=1, read_only=1, max_occur=0, + description='The id pointing to the "Call Forward Unconditional" entry in the voip_cf_mappings table' + where attribute='cfu'; + +update voip_preferences set type=1, data_type='int', internal=1, read_only=1, max_occur=0, + description='The id pointing to the "Call Forward Busy" entry in the voip_cf_mappings table' + where attribute='cfb'; + +update voip_preferences set type=1, data_type='int', internal=1, read_only=1, max_occur=0, + description='The id pointing to the "Call Forward Unavailable" entry in the voip_cf_mappings table' + where attribute='cfna'; + +update voip_preferences set type=1, data_type='int', internal=1, read_only=1, max_occur=0, + description='The id pointing to the "Call Forward Timeout" entry in the voip_cf_mappings table' + where attribute='cft'; + +-- finally copy over the vars from the mapping table +insert into voip_usr_preferences(subscriber_id, attribute_id, value) select m.subscriber_id, p.id, m.id from voip_cf_mappings m, voip_preferences p where m.type = p.attribute; + +commit; +set autocommit=1; diff --git a/db_scripts/diff/7485.down b/db_scripts/diff/7485.down new file mode 100644 index 00000000..ea976abb --- /dev/null +++ b/db_scripts/diff/7485.down @@ -0,0 +1,2 @@ +USE provisioning; +ALTER TABLE voip_cf_destinations DROP COLUMN timeout; diff --git a/db_scripts/diff/7485.up b/db_scripts/diff/7485.up new file mode 100644 index 00000000..3b812496 --- /dev/null +++ b/db_scripts/diff/7485.up @@ -0,0 +1,2 @@ +USE provisioning; +ALTER TABLE voip_cf_destinations ADD COLUMN timeout int(11) UNSIGNED NOT NULL DEFAULT 300; diff --git a/db_scripts/diff/7493.down b/db_scripts/diff/7493.down new file mode 100644 index 00000000..0164c27d --- /dev/null +++ b/db_scripts/diff/7493.down @@ -0,0 +1,16 @@ +use provisioning; + +DROP TRIGGER voip_pgrp_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_pgrp_drepl_trig AFTER DELETE ON voip_peer_groups + FOR EACH ROW BEGIN + + DELETE kamailio.rule, kamailio.gw FROM kamailio.lcr_rule rule, kamailio.lcr_gw gw + WHERE rule.group_id = OLD.id and gw.group_id = OLD.id; + + END; +| + +DELIMITER ; diff --git a/db_scripts/diff/7493.up b/db_scripts/diff/7493.up new file mode 100644 index 00000000..b225147f --- /dev/null +++ b/db_scripts/diff/7493.up @@ -0,0 +1,16 @@ +use provisioning; + +DROP TRIGGER voip_pgrp_drepl_trig; + +DELIMITER | + +CREATE TRIGGER voip_pgrp_drepl_trig AFTER DELETE ON voip_peer_groups + FOR EACH ROW BEGIN + + DELETE FROM kamailio.lcr_rule WHERE group_id = OLD.id; + DELETE FROM kamailio.lcr_gw WHERE group_id = OLD.id; + + END; +| + +DELIMITER ; diff --git a/db_scripts/diff/7496.down b/db_scripts/diff/7496.down new file mode 100644 index 00000000..89e0d5c7 --- /dev/null +++ b/db_scripts/diff/7496.down @@ -0,0 +1,3 @@ +use provisioning; + +DELETE FROM voip_preferences WHERE attribute = 'force_inbound_calls_to_peer'; \ No newline at end of file diff --git a/db_scripts/diff/7496.up b/db_scripts/diff/7496.up new file mode 100644 index 00000000..a81b3d28 --- /dev/null +++ b/db_scripts/diff/7496.up @@ -0,0 +1,4 @@ +use provisioning; + +INSERT INTO voip_preferences (attribute, type, usr_pref, dom_pref, peer_pref, data_type, max_occur, description) + VALUES('force_inbound_calls_to_peer', 1, 1, 1, 0, 'boolean', 1, 'Force calls to this user to be treated as if the user was not local. This helps in migration scenarios.'); diff --git a/db_scripts/diff/7500.down b/db_scripts/diff/7500.down new file mode 100644 index 00000000..001312b4 --- /dev/null +++ b/db_scripts/diff/7500.down @@ -0,0 +1,3 @@ +use provisioning; + +UPDATE voip_preferences SET attribute='force_to_pstn' WHERE attribute='force_outbound_calls_to_peer'; diff --git a/db_scripts/diff/7500.up b/db_scripts/diff/7500.up new file mode 100644 index 00000000..ec5d0662 --- /dev/null +++ b/db_scripts/diff/7500.up @@ -0,0 +1,3 @@ +use provisioning; + +UPDATE voip_preferences SET attribute='force_outbound_calls_to_peer' WHERE attribute='force_to_pstn'; diff --git a/db_scripts/diff/7644.down b/db_scripts/diff/7644.down new file mode 100644 index 00000000..c3d723e2 --- /dev/null +++ b/db_scripts/diff/7644.down @@ -0,0 +1 @@ +ALTER TABLE `accounting`.`cdr` DROP COLUMN `init_time`; diff --git a/db_scripts/diff/7644.up b/db_scripts/diff/7644.up new file mode 100644 index 00000000..e969a47d --- /dev/null +++ b/db_scripts/diff/7644.up @@ -0,0 +1 @@ +ALTER TABLE `accounting`.`cdr` ADD COLUMN `init_time` decimal(13,3) NOT NULL AFTER `call_code`; diff --git a/db_scripts/diff/7647.down b/db_scripts/diff/7647.down new file mode 100644 index 00000000..0b83612a --- /dev/null +++ b/db_scripts/diff/7647.down @@ -0,0 +1,3 @@ +ALTER TABLE `billing`.`billing_profiles` DROP COLUMN `fraud_interval_limit`; +ALTER TABLE `billing`.`billing_profiles` DROP COLUMN `fraud_interval_lock`; +ALTER TABLE `billing`.`billing_profiles` DROP COLUMN `fraud_interval_notify`; diff --git a/db_scripts/diff/7647.up b/db_scripts/diff/7647.up new file mode 100644 index 00000000..f0eaef8d --- /dev/null +++ b/db_scripts/diff/7647.up @@ -0,0 +1,3 @@ +ALTER TABLE `billing`.`billing_profiles` ADD COLUMN `fraud_interval_limit` int(11) UNSIGNED NULL DEFAULT NULL AFTER `interval_count`; +ALTER TABLE `billing`.`billing_profiles` ADD COLUMN `fraud_interval_lock` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `fraud_interval_limit`; +ALTER TABLE `billing`.`billing_profiles` ADD COLUMN `fraud_interval_notify` varchar(255) NULL DEFAULT NULL AFTER `fraud_interval_lock`; diff --git a/db_scripts/diff/7655.down b/db_scripts/diff/7655.down new file mode 100644 index 00000000..d0ac5141 --- /dev/null +++ b/db_scripts/diff/7655.down @@ -0,0 +1 @@ +DROP DATABASE IF EXISTS sipstats; diff --git a/db_scripts/diff/7655.up b/db_scripts/diff/7655.up new file mode 100644 index 00000000..4308264e --- /dev/null +++ b/db_scripts/diff/7655.up @@ -0,0 +1,37 @@ +CREATE DATABASE IF NOT EXISTS sipstats CHARACTER SET 'utf8'; + +USE sipstats; + +-- create packets tables + +CREATE TABLE `packets` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `timestamp` decimal(17,6) NOT NULL, + `src_mac` binary(6) NOT NULL, + `dst_mac` binary(6) NOT NULL, + `protocol` enum('IPv4','IPv6') NOT NULL, + `src_ip` varchar(39) NOT NULL, + `dst_ip` varchar(39) NOT NULL, + `src_port` smallint(5) unsigned NOT NULL, + `dst_port` smallint(5) unsigned NOT NULL, + `header` blob NOT NULL, + `payload` blob NOT NULL, + `trailer` blob NOT NULL, + `method` varchar(20) NOT NULL, + `cseq_method` varchar(16) NOT NULL, + `call_id` varchar(255) NOT NULL, + `request_uri` varchar(255) NOT NULL, + `from_uri` varchar(255) NOT NULL, + `caller_uuid` varchar(255) NOT NULL, + `callee_uuid` varchar(255) NOT NULL, + `was_fragmented` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`,`timestamp`), + KEY `call_id_idx` (`call_id`), + KEY `caller_uuid_idx` (`caller_uuid`), + KEY `callee_uuid_idx` (`callee_uuid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +PARTITION BY RANGE (FLOOR(`timestamp`)) +(PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM); + +GRANT ALL ON sipstats.* TO 'soap'@'localhost'; +GRANT ALL ON sipstats.* to 'voisniff'@'localhost' IDENTIFIED BY 'PW_VOISNIFF'; diff --git a/db_scripts/diff/7764.down b/db_scripts/diff/7764.down new file mode 100644 index 00000000..ee947c7f --- /dev/null +++ b/db_scripts/diff/7764.down @@ -0,0 +1,4 @@ +use provisioning; + +alter table voip_cf_mappings drop foreign key cfmap_time_ref; +alter table voip_cf_mappings drop foreign key cfmap_dest_ref diff --git a/db_scripts/diff/7764.up b/db_scripts/diff/7764.up new file mode 100644 index 00000000..62fa2e3b --- /dev/null +++ b/db_scripts/diff/7764.up @@ -0,0 +1,4 @@ +use provisioning; + +alter table voip_cf_mappings add constraint cfmap_time_ref foreign key (time_set_id) references voip_cf_time_sets(id); +alter table voip_cf_mappings add constraint cfmap_dest_ref foreign key (destination_set_id) references voip_cf_destination_sets(id); diff --git a/db_scripts/diff/7931.down b/db_scripts/diff/7931.down new file mode 100644 index 00000000..8cd66f17 --- /dev/null +++ b/db_scripts/diff/7931.down @@ -0,0 +1,3 @@ +use provisioning; + +delete from language_strings where code='Client.Syntax.ProfileNameTooLong'; diff --git a/db_scripts/diff/7931.up b/db_scripts/diff/7931.up new file mode 100644 index 00000000..acd090d8 --- /dev/null +++ b/db_scripts/diff/7931.up @@ -0,0 +1,6 @@ +use provisioning; + +insert into language_strings (code,language,string) values ('Client.Syntax.ProfileNameTooLong', 'en', 'Name is too long (maximum is 31 characters).'); +insert into language_strings (code,language,string) values ('Client.Syntax.ProfileNameTooLong', 'de', 'Der gewählte Name ist zu lang (max. 31 Zeichen).'); +insert into language_strings (code,language,string) values ('Client.Syntax.ProfileNameTooLong', 'es', 'Name is too long (maximum is 31 characters).'); +insert into language_strings (code,language,string) values ('Client.Syntax.ProfileNameTooLong', 'fr', 'Name is too long (maximum is 31 characters).'); diff --git a/db_scripts/diff/7937.down b/db_scripts/diff/7937.down new file mode 100644 index 00000000..1fa95a45 --- /dev/null +++ b/db_scripts/diff/7937.down @@ -0,0 +1 @@ +REVOKE SELECT ON billing.voip_subscribers FROM 'exporter'@'localhost'; diff --git a/db_scripts/diff/7937.up b/db_scripts/diff/7937.up new file mode 100644 index 00000000..47ac4f1e --- /dev/null +++ b/db_scripts/diff/7937.up @@ -0,0 +1 @@ +GRANT SELECT ON billing.voip_subscribers TO 'exporter'@'localhost'; diff --git a/db_scripts/diff/7938.down b/db_scripts/diff/7938.down new file mode 100644 index 00000000..afc874bd --- /dev/null +++ b/db_scripts/diff/7938.down @@ -0,0 +1,12 @@ +use provisioning; + +delete from language_strings where code='Client.Syntax.InvalidYear'; +delete from language_strings where code='Client.Syntax.InvalidMonth'; +delete from language_strings where code='Client.Syntax.InvalidMDay'; +delete from language_strings where code='Client.Syntax.InvalidWDay'; +delete from language_strings where code='Client.Syntax.InvalidHour'; +delete from language_strings where code='Client.Syntax.InvalidMinute'; +delete from language_strings where code='Client.Syntax.FromMissing'; +delete from language_strings where code='Client.Syntax.FromAfterTo'; +delete from language_strings where code='Client.Syntax.EmptySetName'; +delete from language_strings where code='Client.Syntax.MissingDestinationSet'; diff --git a/db_scripts/diff/7938.up b/db_scripts/diff/7938.up new file mode 100644 index 00000000..33fa3680 --- /dev/null +++ b/db_scripts/diff/7938.up @@ -0,0 +1,42 @@ +use provisioning; + +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidYear','en','Invalid year.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidYear','de','Ungültiges Jahr.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidYear','es','Invalid year.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidYear','fr','Invalid year.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMonth','en','Invalid month.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMonth','de','Ungültiges Monat.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMonth','es','Invalid month.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMonth','fr','Invalid month.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMDay','en','Invalid day of month.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMDay','de','Ungültiger Tag.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMDay','es','Invalid day of month.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMDay','fr','Invalid day of month.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidWDay','en','Invalid day of week.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidWDay','de','Ungültiger Wochentag.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidWDay','es','Invalid day of week.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidWDay','fr','Invalid day of week.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidHour','en','Invalid hour.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidHour','de','Ungültige Stunde.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidHour','es','Invalid hour.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidHour','fr','Invalid hour.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMinute','en','Invalid minute.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMinute','de','Ungültige Minute.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMinute','es','Invalid minute.'); +insert into language_strings (code, language, string) values ('Client.Syntax.InvalidMinute','fr','Invalid minute.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromMissing','en','Beginning missing.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromMissing','de','Beginn fehlt.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromMissing','es','Beginning missing.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromMissing','fr','Beginning missing.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromAfterTo','en','Beginning after End.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromAfterTo','de','Beginn nach Ende.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromAfterTo','es','Beginning after End.'); +insert into language_strings (code, language, string) values ('Client.Syntax.FromAfterTo','fr','Beginning after End.'); +insert into language_strings (code, language, string) values ('Client.Syntax.EmptySetName','en','Setname can not be empty.'); +insert into language_strings (code, language, string) values ('Client.Syntax.EmptySetName','de','Setname darf nicht leer sein.'); +insert into language_strings (code, language, string) values ('Client.Syntax.EmptySetName','es','Setname can not be empty.'); +insert into language_strings (code, language, string) values ('Client.Syntax.EmptySetName','fr','Setname can not be empty.'); +insert into language_strings (code,language,string) values ('Client.Syntax.MissingDestinationSet','en','Please choose a destination set'); +insert into language_strings (code,language,string) values ('Client.Syntax.MissingDestinationSet','de','Bitte wälhlen Sie eine Zielmenge'); +insert into language_strings (code,language,string) values ('Client.Syntax.MissingDestinationSet','es','Please choose a destination set'); +insert into language_strings (code,language,string) values ('Client.Syntax.MissingDestinationSet','fr','Please choose a destination set'); diff --git a/db_scripts/diff/7991.up b/db_scripts/diff/7991.up new file mode 100644 index 00000000..02be6850 --- /dev/null +++ b/db_scripts/diff/7991.up @@ -0,0 +1,905 @@ +USE provisioning; + +TRUNCATE TABLE language_strings; + +INSERT INTO language_strings (code, language, string) VALUES +('Client.Billing.MalformedAmount', 'de', 'Bitte geben Sie einen ganzzahligen Betrag ein.'), +('Client.Billing.MalformedAmount', 'en', 'Please specify the amount as an integral number.'), +('Client.Billing.MalformedAmount', 'es', 'Por favor, especifique la cantidad como un número entero.'), +('Client.Billing.MalformedAmount', 'fr', 'Spécifiez la quantité comme un numéro intégral.'), +('Client.Billing.NoPayType', 'de', 'Bitte wählen Sie eine Zahlungsweise aus.'), +('Client.Billing.NoPayType', 'en', 'Please choose a payment type.'), +('Client.Billing.NoPayType', 'es', 'Por favor, elija un método de pago.'), +('Client.Billing.NoPayType', 'fr', 'Choisissez un type de paiement.'), +('Client.Syntax.Date', 'de', 'Bitte geben Sie ein gültiges Datum ein.'), +('Client.Syntax.Date', 'en', 'Invalid date format.'), +('Client.Syntax.Date', 'es', 'Formato de fecha inválido.'), +('Client.Syntax.Date', 'fr', 'Format date invalide.'), +('Client.Syntax.Email', 'de', 'Ungültige E-Mail Adresse.'), +('Client.Syntax.Email', 'en', 'Invalid e-mail address.'), +('Client.Syntax.Email', 'es', 'Dirección de correo inválida.'), +('Client.Syntax.Email', 'fr', 'Adresse électronique Invalide.'), +('Client.Syntax.MalformedDomain', 'de', 'Ungültige Zeichen in der Domain.'), +('Client.Syntax.MalformedDomain', 'en', 'Invalid characters in domain.'), +('Client.Syntax.MalformedDomain', 'es', 'Caracteres inválidos en dominio.'), +('Client.Syntax.MalformedDomain', 'fr', 'Caractères Invalides dans domaine.'), +('Client.Syntax.MalformedUsername', 'de', 'Ungültige Zeichen im Usernamen.'), +('Client.Syntax.MalformedUsername', 'en', 'Invalid characters in username.'), +('Client.Syntax.MalformedUsername', 'es', 'Caracteres inválidos en el nombre de usuario.'), +('Client.Syntax.MalformedUsername', 'fr', 'Nom d'utilisateur Invalides.'), +('Client.Syntax.MissingDomain', 'de', 'Bitte geben Sie Ihren Usernamen inklusive Domain ein.'), +('Client.Syntax.MissingDomain', 'en', 'Please enter username including domain.'), +('Client.Syntax.MissingDomain', 'es', 'Por favor, introduzca el nombre de usuario incluyendo el dominio.'), +('Client.Syntax.MissingDomain', 'fr', 'Entrez nom d'utilisateur incluant le domaine.'), +('Client.Syntax.MissingParam', 'en', 'A mandatory parameter is missing.'), +('Client.Syntax.MissingParam', 'de', 'Ein verplichtender Parameter fehlt.'), +('Client.Syntax.MissingParam', 'es', 'Falta un campo obligatorio.'), +('Client.Syntax.MissingParam', 'fr', 'Il manque un paramètre obligatoire.'), +('Client.Syntax.MalformedUri', 'en', 'Invalid SIP URI.'), +('Client.Syntax.MalformedUri', 'de', 'Ungültige SIP URI.'), +('Client.Syntax.MalformedUri', 'es', 'Caracteres inválidos en el URI SIP.'), +('Client.Syntax.MalformedUri', 'fr', 'SIP URI Invalides.'), +('Client.Syntax.MissingUsername', 'de', 'Bitte geben Sie einen Usernamen ein.'), +('Client.Syntax.MissingUsername', 'en', 'Please enter a username.'), +('Client.Syntax.MissingUsername', 'es', 'Por favor,introduzca un nombre de usuario.'), +('Client.Syntax.MissingUsername', 'fr', 'Entrez un nom d'utilisateur.'), +('Client.Syntax.VoiceBoxPin', 'de', 'Bitte geben Sie 4 Ziffern ein oder lassen Sie das Feld leer.'), +('Client.Syntax.VoiceBoxPin', 'en', 'Please enter 4 digits, or leave the textfield empty.'), +('Client.Syntax.VoiceBoxPin', 'es', 'Por favor, introduzca 4 dígitos o deje el campo en blanco.'), +('Client.Syntax.VoiceBoxPin', 'fr', 'Entrez 4 chiffres, ou laissez le champ texte vide.'), +('Client.Voip.AssignedExtension', 'de', 'Die gewählte Durchwahl ist bereits vergeben.'), +('Client.Voip.AssignedExtension', 'en', 'This extension is already in use.'), +('Client.Voip.AssignedExtension', 'es', 'Esta extensión ya se encuentra en uso.'), +('Client.Voip.AssignedExtension', 'fr', 'Cette extension est déjà utilisée.'), +('Client.Voip.AssignedNumber', 'de', 'Die Telefonnummer ist nicht mehr verfügbar.'), +('Client.Voip.AssignedNumber', 'en', 'The specified telephone number is not available any more.'), +('Client.Voip.AssignedNumber', 'es', 'Este número ya no se encuentra disponible.'), +('Client.Voip.AssignedNumber', 'fr', 'Le numéro de téléphone indiqué n'est désormais plus disponible.'), +('Client.Voip.AuthFailed', 'de', 'Login fehlgeschlagen, bitte überprüfen Sie Ihren Usernamen und Ihr Passwort.'), +('Client.Voip.AuthFailed', 'en', 'Login failed, please verify username and password.'), +('Client.Voip.AuthFailed', 'es', 'Acceso denegado. Por favor, compruebe el nombre de usuario y la contraseña.'), +('Client.Voip.AuthFailed', 'fr', 'L'établissement de la connexion a échoué, vérifiez le nom d’utilisateur et le mot de passe.'), +('Client.Voip.ChooseNumber', 'de', 'Bitte wählen Sie eine Nummer aus der Liste.'), +('Client.Voip.ChooseNumber', 'en', 'Please select a number from the list.'), +('Client.Voip.ChooseNumber', 'es', 'Por favor, seleccione un número de la lista.'), +('Client.Voip.ChooseNumber', 'fr', 'Choisissez s'il vous plaît un numéro de la liste.'), +('Client.Voip.DeniedNumber', 'de', 'Die Telefonnummer ist nicht mehr verfügbar.'), +('Client.Voip.DeniedNumber', 'en', 'The specified telephonenumber is not available.'), +('Client.Voip.DeniedNumber', 'es', 'Este número no se encuentra disponible.'), +('Client.Voip.DeniedNumber', 'fr', 'Le numéro de téléphone indiqué n'est pas disponible.'), +('Client.Voip.ExistingSubscriber', 'de', 'Dieser Username ist nicht mehr verfügbar.'), +('Client.Voip.ExistingSubscriber', 'en', 'This username is already in use.'), +('Client.Voip.ExistingSubscriber', 'es', 'El nombre de usuario ya se encuentra en uso.'), +('Client.Voip.ExistingSubscriber', 'fr', 'Ce nom d'utilisateur est déjà utilisé'), +('Client.Voip.ForwardSelect', 'de', 'Bitte wählen Sie unter welchen Umständen ein Anruf weitergeleitet werden soll.'), +('Client.Voip.ForwardSelect', 'en', 'Please select when to forward a call.'), +('Client.Voip.ForwardSelect', 'es', 'Por favor, seleccione cuándo desea reenviar llamadas.'), +('Client.Voip.ForwardSelect', 'fr', 'Choisissez quand transféré un appel.'), +('Client.Voip.IncorrectPass', 'de', 'Das Passwort ist nicht korrekt, bitte überprüfen Sie die Eingabe.'), +('Client.Voip.IncorrectPass', 'en', 'Wrong password, please verify your input.'), +('Client.Voip.IncorrectPass', 'es', 'Contraseña incorrecta. Por favor, verifique que la ha escrito correctamente.'), +('Client.Voip.IncorrectPass', 'fr', 'Mauvais mot de passe, vérifiez votre saisie.'), +('Client.Voip.InputErrorFound', 'de', 'Fehlende oder fehlerhafte Eingabedaten gefunden.'), +('Client.Voip.InputErrorFound', 'en', 'Missing or invalid input found.'), +('Client.Voip.InputErrorFound', 'es', 'Entrada inválida o ausente.'), +('Client.Voip.InputErrorFound', 'fr', 'La saisie trouvée est invalide.'), +('Client.Voip.MalformedAc', 'de', 'Ungültige Ortsvorwahl, bitte geben Sie nur Ziffern, ohne führende Null ein.'), +('Client.Voip.MalformedAc', 'en', 'Invalid area code, please use digits only and don't enter a leading zero.'), +('Client.Voip.MalformedAc', 'es', 'Código de área erroneo. Por favor, use dígitos únicamente y no introduzca un cero inicial.'), +('Client.Voip.MalformedAc', 'fr', 'L'indicatif invalide, utilisez uniquement des chiffres et n'entrez pas dans un zéro principal.'), +('Client.Voip.MalformedCc', 'de', 'Ungültige Ländervorwahl, bitte geben Sie nur Ziffern, ohne führende Nullen ein.'), +('Client.Voip.MalformedCc', 'en', 'Invalid country code, please use digits only, without leading zeros.'), +('Client.Voip.MalformedCc', 'es', 'Código de país erroneo. Por favor, use dígitos únicamente y no introduzca un cero inicial.'), +('Client.Voip.MalformedCc', 'fr', 'Le code du pays est invalide, utilisez uniquement des chiffres, sans zéros principaux.'), +('Client.Voip.MalformedSn', 'de', 'Ungültige Rufnummer, bitte geben Sie nur Ziffern ein. (Die Nummer darf nicht mit Null beginnen.)'), +('Client.Voip.MalformedSn', 'en', 'Invalid subscriber number, please use digits only. (The number can not start with a zero.)'), +('Client.Voip.MalformedSn', 'es', 'Número de suscriptor inválido. Por favor, use dígitos unicamente. (El número no puede empezar por cero).'), +('Client.Voip.MalformedSn', 'fr', 'Le numéro de l'abonné est invalide, utilisez uniquement des chiffres. (Le numéro ne peut pas commencer par un zéro).'), +('Client.Voip.MalformedNumber', 'de', 'Ungültige Eingabe, bitte geben Sie Rufnummern numerisch und inklusive Vorwahl an.'), +('Client.Voip.MalformedNumber', 'en', 'Invalid number, please use digits only and include the area code.'), +('Client.Voip.MalformedNumber', 'es', 'Número inválido. Por favor, use dígitos únicamente e incluya el código de área.'), +('Client.Voip.MalformedNumber', 'fr', 'Le numéro est invalide, utilisez uniquement des chiffres et incluez l'indicatif.'), +('Client.Voip.MalformedNumberPattern', 'de', 'Ungültiger Eintrag, bitte verwenden Sie nur Ziffern und "?" bzw. "*" als Platzhalter für ein, bzw. beliebig viele Zeichen.'), +('Client.Voip.MalformedNumberPattern', 'en', 'Invalid entry, please use numbers only and "?" or "*" as placeholder for one or an arbitrary number of digits.'), +('Client.Voip.MalformedNumberPattern', 'es', 'Entrada inválida. Por favor, use dígitos únicamente y "?" o "*" como comodines para uno o un número arbitrario de dígitos.'), +('Client.Voip.MalformedNumberPattern', 'fr', 'Saisie invalide, utilisez uniquement des numéros et "?" Ou "*" comme détenteur d’endroit pour un ou un numéro arbitraire de chiffres.'), +('Client.Voip.MalformedTargetClass', 'de', 'Bitte wählen Sie ein Ziel.'), +('Client.Voip.MalformedTargetClass', 'en', 'Please choose a target.'), +('Client.Voip.MalformedTargetClass', 'es', 'Por favor, escoja un objetivo.'), +('Client.Voip.MalformedTargetClass', 'fr', 'Choisissez une destination (cible).'), +('Client.Voip.MalformedTarget', 'de', 'Ungültige Zielangabe, bitte verwenden Sie entweder nur Ziffern, oder geben Sie einen gültigen SIP User ein.'), +('Client.Voip.MalformedTarget', 'en', 'Invalid destination, please use digits only or enter a valid SIP URI.'), +('Client.Voip.MalformedTarget', 'es', 'Destino inválido. Por favor, use dígitos exclusivamente o introduzca una SIP URI válida.'), +('Client.Voip.MalformedTarget', 'fr', 'La destination invalide, utilisez uniquement des chiffres ou entrez dans une SIP URI valide'), +('Client.Voip.MalformedTimeout', 'de', 'Ungültiger Timeout, bitte verwenden Sie nur Ziffern.'), +('Client.Voip.MalformedTimeout', 'en', 'Invalid timeout, please use digits only.'), +('Client.Voip.MalformedTimeout', 'es', 'Invalid timeout, please use digits only.'), +('Client.Voip.MalformedTimeout', 'fr', 'Invalid timeout, please use digits only.'), +('Client.Voip.MissingName', 'de', 'Bitte geben Sie zumindest Vor- oder Nachnamen ein.'), +('Client.Voip.MissingName', 'en', 'Please enter at least a first or last name.'), +('Client.Voip.MissingName', 'es', 'Por favor, introduzca al menos un nombre o un apellido.'), +('Client.Voip.MissingName', 'fr', 'Entrez au moins un prénom ou nom de famille.'), +('Client.Voip.MissingOldPass', 'de', 'Bitte geben Sie Ihr aktuelles Passwort ein.'), +('Client.Voip.MissingOldPass', 'en', 'Please enter your current password.'), +('Client.Voip.MissingOldPass', 'es', 'Por favor, introduzca su contraseña actual.'), +('Client.Voip.MissingOldPass', 'fr', 'Entrez votre mot de passe actuel.'), +('Client.Voip.MissingPass2', 'de', 'Bitte geben Sie das Passwort in beide Felder ein.'), +('Client.Voip.MissingPass2', 'en', 'Please enter the password in both fields.'), +('Client.Voip.MissingPass2', 'es', 'Por favor, introduzca la contraseña en ambos campos.'), +('Client.Voip.MissingPass2', 'fr', 'Entrez le mot de passe dans les deux champs.'), +('Client.Voip.MissingPass', 'de', 'Bitte geben Sie ein Passwort ein.'), +('Client.Voip.MissingPass', 'en', 'Please enter a password.'), +('Client.Voip.MissingPass', 'es', 'Por favor, introduzca una contraseña.'), +('Client.Voip.MissingPass', 'fr', 'Entrez votre mot de passe.'), +('Client.Voip.MissingRingtimeout', 'de', 'Bitte wählen Sie die Zeitdauer nach der Anrufe weitergeleitet werden sollen. (In Sekunden, von 5 bis 300).'), +('Client.Voip.MissingRingtimeout', 'en', 'Please specify a timeout for incoming calls. (In seconds from 5 to 300).'), +('Client.Voip.MissingRingtimeout', 'es', 'Por favor, especifique un tiempo límite para llamadas entrantes. (En segundos, en el rango de 5 a 300).'), +('Client.Voip.MissingRingtimeout', 'fr', 'Spécifiez un temps mort pour des appels entrants. (En secondes 5 à 300).'), +('Client.Voip.NoSuchDomain', 'de', 'Die angegebene Domain existiert nicht in der Datenbank.'), +('Client.Voip.NoSuchDomain', 'en', 'The specified domain does not exist.'), +('Client.Voip.NoSuchDomain', 'es', 'El dominio especificado no existe.'), +('Client.Voip.NoSuchDomain', 'fr', 'Le domaine indiqué n'existe pas.'), +('Client.Voip.NoSuchNumber', 'de', 'Die Telefonnummer ist nicht verfügbar.'), +('Client.Voip.NoSuchNumber', 'en', 'The specified telephonenumber is not available.'), +('Client.Voip.NoSuchNumber', 'es', 'El número especificado no se encuentra disponible.'), +('Client.Voip.NoSuchNumber', 'fr', 'Le numéro de téléphone indiqué n'est pas disponible.'), +('Client.Voip.PassLength', 'de', 'Das Passwort ist zu kurz, bitte verwenden Sie mindestens 6 Zeichen.'), +('Client.Voip.PassLength', 'en', 'The password is too short, please use 6 characters at least.'), +('Client.Voip.PassLength', 'es', 'La contraseña es demasiado corta. Por favor use una de al menos 6 caracteres.'), +('Client.Voip.PassLength', 'fr', 'Le mot de passe est trop court, utilisez au moins 6 caractères.'), +('Client.Voip.PassNoMatch', 'de', 'Die Passwörter stimmen nicht überein, bitte überprüfen Sie die Eingabe.'), +('Client.Voip.PassNoMatch', 'en', 'Passwords do not match, please try again.'), +('Client.Voip.PassNoMatch', 'es', 'Las contraseñas no coinciden. Por favor, inténtelo de nuevo.'), +('Client.Voip.PassNoMatch', 'fr', 'Les mots de passe ne correspondent pas, essayez de nouveau.'), +('Client.Voip.ToManyPreference', 'de', 'Maximale Anzahl von Einträgen erreicht.'), +('Client.Voip.ToManyPreference', 'en', 'Maximum number of entries reached.'), +('Client.Voip.ToManyPreference', 'es', 'Alcanzado el número máximo de entradas.'), +('Client.Voip.ToManyPreference', 'fr', 'Le nombre maximal d'entrées est atteint.'), +('Server.Billing.Success', 'de', 'Ihr Konto wurde erfolgreich aufgeladen.'), +('Server.Billing.Success', 'en', 'Your account has been topped up successfully.'), +('Server.Billing.Success', 'es', 'Su cobro se ha realizado correctamente.'), +('Server.Billing.Success', 'fr', 'Votre compte a été rechargé avec succès.'), +('Server.Internal', 'de', 'Ein interner Systemfehler ist aufgetreten, bitte versuchen Sie es später wieder.'), +('Server.Internal', 'en', 'Internal error, please try again later.'), +('Server.Internal', 'es', 'Se ha detectado un error interno. Por favor, inténtelo de nuevo más tarde.'), +('Server.Internal', 'fr', 'Erreur interne, essayez de nouveau plus tard.'), +('Server.Paypal.Error', 'de', 'Bitte folgen Sie den Anweisungen auf der PayPal Webseite um die Überweisung durchzuführen.'), +('Server.Paypal.Error', 'en', 'Please follow the instrutions on the PayPal website to transfer the credit.'), +('Server.Paypal.Error', 'es', 'Por favor, siga las instrucciones en la web de PayPal para realizar la transferencia.'), +('Server.Paypal.Error', 'fr', 'Suivez s'il vous plaît les instructions sur le site Web PayPal pour transférer le crédit.'), +('Server.Paypal.Fault', 'de', 'Fehler in der Kommunikation mit PayPal, bitte versuchen Sie es etwas später noch einmal.'), +('Server.Paypal.Fault', 'en', 'Communication error with PayPal server, please try again later.'), +('Server.Paypal.Fault', 'es', 'No se puede comunicar con el servidor de PayPal. Por favor, inténtelo de nuevo más tarde.'), +('Server.Paypal.Fault', 'fr', 'Erreur de communication avec le serveur PayPal, essayez de nouveau plus tard.'), +('Server.Paypal.Invalid', 'de', 'Fehler in der Kommunikation mit PayPal, bitte versuchen Sie es etwas später noch einmal.'), +('Server.Paypal.Invalid', 'en', 'Communication error with PayPal server, please try again later.'), +('Server.Paypal.Invalid', 'es', 'Ha ocurrido un error de comunicación con el servidor de PayPal. Por favor, inténtelo de nuevo más tarde.'), +('Server.Paypal.Invalid', 'fr', 'Erreur de communication avec le serveur PayPal, essayez de nouveau plus tard.'), +('Server.Voip.RemovedContact', 'de', 'Der Kontakteintrag wurde gelöscht.'), +('Server.Voip.RemovedContact', 'en', 'The contact entry has been deleted.'), +('Server.Voip.RemovedContact', 'es', 'El contacto ha sido eliminado.'), +('Server.Voip.RemovedContact', 'fr', 'Le contact saisi a été supprimée.'), +('Server.Voip.RemovedRegisteredContact', 'de', 'Die Registrierung wurde gelöscht.'), +('Server.Voip.RemovedRegisteredContact', 'en', 'The registered contact has been deleted.'), +('Server.Voip.RemovedRegisteredContact', 'es', 'El contacto ha sido eliminado.'), +('Server.Voip.RemovedRegisteredContact', 'fr', 'Le contact enregistré a été supprimé.'), +('Server.Voip.AddedRegisteredContact', 'de', 'Permanenter Registrierungseintrag wurde hinzugefügt.'), +('Server.Voip.AddedRegisteredContact', 'en', 'Permanent registration contact has been added.'), +('Server.Voip.AddedRegisteredContact', 'es', 'Contacto permanente guardado correctamente.'), +('Server.Voip.AddedRegisteredContact', 'fr', 'Le contact enregistré a été ajouté.'), +('Server.Voip.RemovedVoicemail', 'de', 'Die Sprachnachricht wurde gelöscht.'), +('Server.Voip.RemovedVoicemail', 'en', 'The voicemail has been deleted.'), +('Server.Voip.RemovedVoicemail', 'es', 'El buzón de voz ha sido eliminado.'), +('Server.Voip.RemovedVoicemail', 'fr', 'La boîte vocale a été supprimé.'), +('Server.Voip.SavedContact', 'de', 'Der Kontakteintrag wurde gespeichert.'), +('Server.Voip.SavedContact', 'en', 'The contact entry bas been saved.'), +('Server.Voip.SavedContact', 'es', 'Contacto guardado correctamente.'), +('Server.Voip.SavedContact', 'fr', 'Le contact saisi a été enregistré.'), +('Server.Voip.SavedPass', 'de', 'Ihr Passwort wurde erfolgreich geändert.'), +('Server.Voip.SavedPass', 'en', 'The password has been changed successfully.'), +('Server.Voip.SavedPass', 'es', 'Su contraseña ha sido modificada correctamente.'), +('Server.Voip.SavedPass', 'fr', 'Le mot de passe a été changé avec succès.'), +('Server.Voip.SavedSettings', 'de', 'Ihre Einstellungen wurden gespeichert.'), +('Server.Voip.SavedSettings', 'en', 'Your settings have been saved.'), +('Server.Voip.SavedSettings', 'es', 'Sus preferencias han sido guardadas.'), +('Server.Voip.SavedSettings', 'fr', 'Vos paramètres ont été enregistrés.'), +('Server.Voip.SubscriberCreated', 'de', 'Der Benutzer wurde gespeichert und kann jetzt konfiguriert werden.'), +('Server.Voip.SubscriberCreated', 'en', 'The user has been saved and may be configured.'), +('Server.Voip.SubscriberCreated', 'es', 'El usuario ha sido guardado y puede ser configurado.'), +('Server.Voip.SubscriberCreated', 'fr', 'L'utilisateur a été enregistré et peut être configuré.'), +('Server.Voip.SubscriberDeleted', 'de', 'Der Benutzer wurde gelöscht.'), +('Server.Voip.SubscriberDeleted', 'en', 'The user has been deleted.'), +('Server.Voip.SubscriberDeleted', 'es', 'El usuario ha sido eliminado.'), +('Server.Voip.SubscriberDeleted', 'fr', 'L'utilisateur a été supprimé.'), +('Server.System.RRDOpenError', 'en', 'Failed to open RRD file.'), +('Server.System.RRDOpenError', 'de', 'Fehler beim Öffnen der RRD-Datei.'), +('Server.System.RRDOpenError', 'es', 'No se ha podido abrir el ficherp RRD.'), +('Server.System.RRDOpenError', 'fr', 'Tentative d’ouverture du fichier RRD à échoué.'), +('Server.System.RRDBinmodeError', 'en', 'Failed to switch to BIN mode in RRD file.'), +('Server.System.RRDBinmodeError', 'de', 'Fehler beim Wechsel auf BIN mode in RRD-Datei.'), +('Server.System.RRDBinmodeError', 'es', 'No se ha podido pasar a modo BIN en el fichero RRD.'), +('Server.System.RRDBinmodeError', 'fr', 'Echec de switch en mode BIN dans le fichier RRD.'), +('Server.System.RRDReadError', 'en', 'Failed to read RRD file.'), +('Server.System.RRDReadError', 'de', 'Fehler beim Lesen der RRD-Datei.'), +('Server.System.RRDReadError', 'es', 'No se ha podido leer el fichero RRD.'), +('Server.System.RRDReadError', 'fr', 'Tentative de lecture du fichier RRD à échoué.'), +('Web.Addressbook.Fax', 'de', 'Fax'), +('Web.Addressbook.Fax', 'en', 'Fax'), +('Web.Addressbook.Fax', 'es', 'Fax'), +('Web.Addressbook.Fax', 'fr', 'Fax'), +('Web.Addressbook.Home', 'de', 'Privat'), +('Web.Addressbook.Home', 'en', 'Home'), +('Web.Addressbook.Home', 'es', 'Domicilio'), +('Web.Addressbook.Home', 'fr', 'Domicile'), +('Web.Addressbook.Mobile', 'de', 'Mobil'), +('Web.Addressbook.Mobile', 'en', 'Mobile'), +('Web.Addressbook.Mobile', 'es', 'Móvil'), +('Web.Addressbook.Mobile', 'fr', 'Portable'), +('Web.Addressbook.Office', 'de', 'Büro'), +('Web.Addressbook.Office', 'en', 'Office'), +('Web.Addressbook.Office', 'es', 'Trabajo'), +('Web.Addressbook.Office', 'fr', 'Travail'), +('Web.MissingRedInput', 'de', 'Bitte füllen Sie alle rot umrandeten Felder aus.'), +('Web.MissingRedInput', 'en', 'Please fill in at least all red bordered input fields.'), +('Web.MissingRedInput', 'es', 'Por favor, rellene al menos todos los campos con borde rojo.'), +('Web.MissingRedInput', 'fr', 'Remplissez au moins tous les champs de saisie de bordure rouges.'), +('Web.Months.01', 'de', 'Jänner'), +('Web.Months.01', 'en', 'January'), +('Web.Months.01', 'es', 'Enero'), +('Web.Months.01', 'fr', 'Janvier'), +('Web.Months.02', 'de', 'Februar'), +('Web.Months.02', 'en', 'February'), +('Web.Months.02', 'es', 'Febrero'), +('Web.Months.02', 'fr', 'Février'), +('Web.Months.03', 'de', 'März'), +('Web.Months.03', 'en', 'March'), +('Web.Months.03', 'es', 'Marzo'), +('Web.Months.03', 'fr', 'Mars'), +('Web.Months.04', 'de', 'April'), +('Web.Months.04', 'en', 'April'), +('Web.Months.04', 'es', 'Abril'), +('Web.Months.04', 'fr', 'Avril'), +('Web.Months.05', 'de', 'Mai'), +('Web.Months.05', 'en', 'May'), +('Web.Months.05', 'es', 'Mayo'), +('Web.Months.05', 'fr', 'Mai'), +('Web.Months.06', 'de', 'Juni'), +('Web.Months.06', 'en', 'June'), +('Web.Months.06', 'es', 'Junio'), +('Web.Months.06', 'fr', 'Juin'), +('Web.Months.07', 'de', 'Juli'), +('Web.Months.07', 'en', 'July'), +('Web.Months.07', 'es', 'Julio'), +('Web.Months.07', 'fr', 'Juillet'), +('Web.Months.08', 'de', 'August'), +('Web.Months.08', 'en', 'August'), +('Web.Months.08', 'es', 'Agosto'), +('Web.Months.08', 'fr', 'Août'), +('Web.Months.09', 'de', 'September'), +('Web.Months.09', 'en', 'September'), +('Web.Months.09', 'es', 'Septiembre'), +('Web.Months.09', 'fr', 'Septembre'), +('Web.Months.10', 'de', 'Oktober'), +('Web.Months.10', 'en', 'October'), +('Web.Months.10', 'es', 'Octubre'), +('Web.Months.10', 'fr', 'Octobre'), +('Web.Months.11', 'de', 'November'), +('Web.Months.11', 'en', 'November'), +('Web.Months.11', 'es', 'Noviembre'), +('Web.Months.11', 'fr', 'Novembre'), +('Web.Months.12', 'de', 'Dezember'), +('Web.Months.12', 'en', 'December'), +('Web.Months.12', 'es', 'Diciembre'), +('Web.Months.12', 'fr', 'Decembre'), +('Client.Syntax.AccountID', 'de', 'Ungültige ID, bitte verwenden Sie nur Ziffern.'), +('Client.Syntax.AccountID', 'en', 'Invalid ID, please use numbers only.'), +('Client.Syntax.AccountID', 'es', 'ID inválido. Por favor use dígitos exclusivamente.'), +('Client.Syntax.AccountID', 'fr', 'Identifiant invalide utilisé uniquement des numéros.'), +('Client.Syntax.CashValue', 'de', 'Ungültiger Betrag, bitte geben Sie nur Ziffern ein, mit Beistrich oder Punkt als Dezimaltrenner.'), +('Client.Syntax.CashValue', 'en', 'Invalid amount, please use numbers only, with comma or dot as decimal separator.'), +('Client.Syntax.CashValue', 'es', 'Cantidad inválida. Por favor, use dígitos exclusivamente, con coma o punto como separador decimal.'), +('Client.Syntax.CashValue', 'fr', 'La quantité (somme) est invalide, utilisez des numéros uniquement des nombres, avec la virgule ou le point comme le séparateur décimal.'), +('Client.Syntax.TimeValue', 'de', 'Ungültige Eingabe, bitte geben Sie eine ganze Zahl ein.'), +('Client.Syntax.TimeValue', 'en', 'Invalid input, please use numbers only.'), +('Client.Syntax.TimeValue', 'es', 'Entrada inválida. Por favor, use dígitos exclusivamente.'), +('Client.Syntax.TimeValue', 'fr', 'La saisie est invalide, utilisez uniquement des nombres.'), +('Client.Syntax.LoginMissingUsername', 'de', 'Bitte geben Sie Ihren Usernamen ein.'), +('Client.Syntax.LoginMissingUsername', 'en', 'Please enter your username.'), +('Client.Syntax.LoginMissingUsername', 'es', 'Por favor, introduzca su nombre de usuario.'), +('Client.Syntax.LoginMissingUsername', 'fr', 'Entrer votre nom d’utilisateur.'), +('Client.Syntax.LoginMissingPass', 'de', 'Bitte geben Sie Ihr Passwort ein.'), +('Client.Syntax.LoginMissingPass', 'en', 'Please enter your password.'), +('Client.Syntax.LoginMissingPass', 'es', 'Por favor, introduzca su contraseña.'), +('Client.Syntax.LoginMissingPass', 'fr', 'Entrer votre mot de passe.'), +('Client.Voip.NoSuchAccount', 'de', 'Der Account existiert nicht.'), +('Client.Voip.NoSuchAccount', 'en', 'This account does not exist.'), +('Client.Voip.NoSuchAccount', 'es', 'La cuenta no existe.'), +('Client.Voip.NoSuchAccount', 'fr', 'Ce compte n’existe pas.'), +('Client.Voip.ExistingDomain', 'de', 'Diese Domain existiert bereits.'), +('Client.Voip.ExistingDomain', 'en', 'This domain already exists.'), +('Client.Voip.ExistingDomain', 'es', 'El dominio ya existe.'), +('Client.Voip.ExistingDomain', 'fr', 'Ce domaine existe déjà.'), +('Web.Domain.Created', 'de', 'Die Domain wurde gespeichert.'), +('Web.Domain.Created', 'en', 'The domain has been saved.'), +('Web.Domain.Created', 'es', 'El dominio ha sido guardado.'), +('Web.Domain.Created', 'fr', 'Le domaine a été enregistré.'), +('Web.Domain.Deleted', 'de', 'Die Domain wurde gelöscht.'), +('Web.Domain.Deleted', 'en', 'The domain has been deleted.'), +('Web.Domain.Deleted', 'es', 'El dominio ha sido eliminado.'), +('Web.Domain.Deleted', 'fr', 'Le domaine a été supprimé.'), +('Client.Admin.ExistingAdmin', 'de', 'Dieser username ist bereits in Verwendung.'), +('Client.Admin.ExistingAdmin', 'en', 'This username is already in use.'), +('Client.Admin.ExistingAdmin', 'es', 'El nombre de usuario ya se encuentra en uso.'), +('Client.Admin.ExistingAdmin', 'fr', 'Ce nom d’utilisateur existe déjà.'), +('Client.Admin.NoSuchAdmin', 'de', 'Dieser Administrator existiert nicht.'), +('Client.Admin.NoSuchAdmin', 'en', 'This administrator does not exist.'), +('Client.Admin.NoSuchAdmin', 'es', 'El administrador no existe.'), +('Client.Admin.NoSuchAdmin', 'fr', 'Cet administrateur n’existe pas.'), +('Client.Syntax.MalformedLogin', 'de', 'Ungültig Zeichen im Loginnamen. Bitte verwenden Sie nur Buchstaben und Zahlen.'), +('Client.Syntax.MalformedLogin', 'en', 'Invalid characters in login name. Please use alphanumeric characters only.'), +('Client.Syntax.MalformedLogin', 'es', 'Caracteres inválidos en nombre de usuario. Por favor use únicamente caracteres alfanuméricos.'), +('Client.Syntax.MalformedLogin', 'fr', 'Caractères invalides de nom d'établissement de la connexion. Utilisez uniquement caractères alphanumériques.'), +('Web.Admin.Created', 'de', 'Der Administrator wurde gespeichert.'), +('Web.Admin.Created', 'en', 'The administrator has been saved.'), +('Web.Admin.Created', 'es', 'El administrador ha sido guardado.'), +('Web.Admin.Created', 'fr', 'L'administrateur a été enregistré.'), +('Web.Admin.Deleted', 'de', 'Der Administrator wurde gelöscht.'), +('Web.Admin.Deleted', 'en', 'The administrator has been deleted.'), +('Web.Admin.Deleted', 'es', 'El administrador ha sido eliminado.'), +('Web.Admin.Deleted', 'fr', 'L'administrateur a été supprimé.'), +('Web.Account.Created', 'de', 'Der Account wurde gespeichert.'), +('Web.Account.Created', 'en', 'The account has been saved.'), +('Web.Account.Created', 'es', 'La cuenta ha sido guardada.'), +('Web.Account.Created', 'fr', 'Le compte a été enregistré.'), +('Web.Payment.UnknownError', 'de', 'Bei der Initialisierung des Zahlvorgangs ist ein Fehler aufgetreten. Bitte versuchen Sie es etwas späeter nochmals und überprüfen Sie Ihre Eingaben.'), +('Web.Payment.UnknownError', 'en', 'Failed to initialize the transaction. Please try again later and verify your input.'), +('Web.Payment.UnknownError', 'es', 'Se ha detectado un error al inicial la transacción. Por favor, verifique los datos e inténtelo de nuevo más tarde.'), +('Web.Payment.UnknownError', 'fr', 'Echec d’initialisation de la transaction. Essayez de nouveau plus tard et vérifiez votre saisie.'), +('Web.Payment.HttpFailed', 'de', 'Der Payment Server konnte nicht erreicht werden. Bitte versuchen Sie es etwas später nochmals.'), +('Web.Payment.HttpFailed', 'en', 'The payment server could not be reached. Please try again later.'), +('Web.Payment.HttpFailed', 'es', 'Se ha detectado un error al intertar conectar con el servidor de pagos. Por favor, inténtelo de nuevo más tarde.'), +('Web.Payment.HttpFailed', 'fr', 'Le serveur de paiement ne pouvait pas être atteint. Essayez de nouveau plus tard.'), +('Web.Syntax.Numeric', 'de', 'Ungültige Zahlenangabe, bitte verwenden Sie nur Ziffern.'), +('Web.Syntax.Numeric', 'en', 'Invalid number, please use numerics only.'), +('Web.Syntax.Numeric', 'es', 'Número inválido. Por favor, use números exclusivamente.'), +('Web.Syntax.Numeric', 'fr', 'Numéro invalide, utilisez des données numériques uniquement.'), +('Web.MissingContactInfo', 'de', 'Bitte selektieren Sie das Kästchen "wie oben", oder füllen Sie alle anderen Eingabefelder aus.'), +('Web.MissingContactInfo', 'en', 'Please check the box "like above" or fill in all additional input fields.'), +('Web.MissingContactInfo', 'es', 'Por favor, compruebe la casilla "como arriba" o rellene todos los campos adicionales.'), +('Web.MissingContactInfo', 'fr', 'Vérifiez la boîte " like above " ou remplissez tous les champs de saisie supplémentaires.'), +('Web.MissingInput', 'de', 'Bitte füllen Sie alle Eingabefelder aus.'), +('Web.MissingInput', 'en', 'Please fill in all input fields.'), +('Web.MissingInput', 'es', 'Por favor, rellene todos los campos.'), +('Web.MissingInput', 'fr', 'Remplissez tous les champs de saisie.'), +('Web.Subscriber.Lockforeign', 'de', 'Der Subscriber ist für ausgehende Anrufe die das System verlassen gesperrt.'), +('Web.Subscriber.Lockforeign', 'en', 'The subscriber is locked for calls that leave the system.'), +('Web.Subscriber.Lockforeign', 'es', 'El suscriptor tiene restringidas las llamadas salientes hacia fuera del sistema.'), +('Web.Subscriber.Lockforeign', 'fr', 'L'abonné est locké pour les appels qui sort du système.'), +('Web.Subscriber.Lockoutgoing', 'de', 'Der Subscriber ist für ausgehende Anrufe gesperrt.'), +('Web.Subscriber.Lockoutgoing', 'en', 'The subscriber is locked for outgoing calls.'), +('Web.Subscriber.Lockoutgoing', 'es', 'El suscriptor tiene restringidas las llamadas salientes.'), +('Web.Subscriber.Lockoutgoing', 'fr', 'L’abonné est locké pour les appels sortant.'), +('Web.Subscriber.Lockincoming', 'de', 'Der Subscriber ist für eingehende und ausgehende Anrufe gesperrt.'), +('Web.Subscriber.Lockincoming', 'en', 'The subscriber is locked for incoming and outgoing calls.'), +('Web.Subscriber.Lockincoming', 'es', 'El suscriptor tiene restringidas las llamadas entrantes y salientes.'), +('Web.Subscriber.Lockincoming', 'fr', 'L'abonné est locké pour les appels entrants et sortants.'), +('Web.Subscriber.Lockglobal', 'de', 'Der Subscriber ist für alle Services gesperrt.'), +('Web.Subscriber.Lockglobal', 'en', 'The subscriber is locked for all services.'), +('Web.Subscriber.Lockglobal', 'es', 'El suscriptor tiene restringidos todos los servicios.'), +('Web.Subscriber.Lockglobal', 'fr', 'L'abonné est locké pour tous les services des appels sortants.'), +('Web.Payment.ExternalError', 'de', 'Der Zahlvorgang ist fehlgeschlagen. Bitte versuchen Sie es etwas späeter nochmals und befolgen Sie alle Anweisungen der externen Webseite.'), +('Web.Payment.ExternalError', 'en', 'The transaction failed. Please try again later and follow all instructions on the external website.'), +('Web.Payment.ExternalError', 'es', 'Se ha detectado un error externo al realizar la transacción. Por favor, inténtelo de nuevo más tarde y siga las instrucciones de la web externa.'), +('Web.Payment.ExternalError', 'fr', 'La transaction a échoué. Essayez de nouveau plus tard et suivez toutes les instructions sur le site Web externe.'), +('Client.Voip.NoGroupName', 'de', 'Bitte geben Sie einen Gruppennamen ein.'), +('Client.Voip.NoGroupName', 'en', 'Please provide a group name.'), +('Client.Voip.NoGroupName', 'es', 'Por favor, introduzca un nombre de grupo.'), +('Client.Voip.NoGroupName', 'fr', 'Fournissez un nom de groupe.'), +('Client.Voip.NoGroupExt', 'de', 'Bitte geben Sie eine numerische Gruppendurchwahl ein.'), +('Client.Voip.NoGroupExt', 'en', 'Please provide a numeric group extension.'), +('Client.Voip.NoGroupExt', 'es', 'Por favor, introduzca una extensión numérica de grupo.'), +('Client.Voip.NoGroupExt', 'fr', 'Fournissez une extension de groupe numérique.'), +('Client.Voip.MacInUse', 'en', 'MAC address is already in use.'), +('Client.Voip.MacInUse', 'de', 'MAC Adresse wird bereits verwendet.'), +('Client.Voip.MacInUse', 'es', 'La dirección MAC ya se encuentra en uso.'), +('Client.Voip.MacInUse', 'fr', 'L'adresse de MAC est déjà en cours d'utilisation.'), +('Web.MissingSystem', 'de', 'Bitte wählen Sie die Nebenstellenanlage die Sie verwenden möchten.'), +('Web.MissingSystem', 'en', 'Please choose the IP PBX you want to use.'), +('Web.MissingSystem', 'es', 'Por favor, escoja la IP PBX que desea utilizar.'), +('Web.MissingSystem', 'fr', 'Choisissez PBX IP que vous voulez utiliser.'), +('Web.MissingAGB', 'de', 'Sie müssen den Allgemeinen Geschäftsbedingungen zustimmen.'), +('Web.MissingAGB', 'en', 'Please agree to our general terms and conditions.'), +('Web.MissingAGB', 'es', 'Por favor, acepte los términos y condiciones generales.'), +('Web.MissingAGB', 'fr', 'Soyez en accord avec nos conditions générales.'), +('Web.Account.Activated', 'de', 'Der account wurde aktiviert.'), +('Web.Account.Activated', 'en', 'The account has been activated.'), +('Web.Account.Activated', 'es', 'La cuenta ha sido activada.'), +('Web.Account.Activated', 'fr', 'Le compte a été activé.'), +('Client.Billing.AuthFailed', 'de', 'Login fehlgeschlagen, bitte überprüfen Sie Ihren Usernamen und Ihr Passwort.'), +('Client.Billing.AuthFailed', 'en', 'Login failed, please verify your username and password.'), +('Client.Billing.AuthFailed', 'es', 'Acceso fallido. Por favor, compruebe su usuario y contraseña.'), +('Client.Billing.AuthFailed', 'fr', 'L'établissement de la connexion a échoué, vérifiez votre nom d’utilisateur et le mot de passe.'), +('Web.MissingSearchString', 'de', 'Bitte geben Sie einen Suchstring ein.'), +('Web.MissingSearchString', 'en', 'Please enter a search string.'), +('Web.MissingSearchString', 'es', 'Por favor, introduzca un término de búsqueda.'), +('Web.MissingSearchString', 'fr', 'Entrez s'il vous plaît dans une série de recherche.'), +('Client.Billing.ContactIncomplete', 'de', 'Bitte geben Sie zumindest einen Vornamen, Nachnamen oder Firmennamen ein.'), +('Client.Billing.ContactIncomplete', 'en', 'Please enter at least a firstname, lastname or company name.'), +('Client.Billing.ContactIncomplete', 'es', 'Por favor, introduzca el menos un nombre, un apellido o una compañía.'), +('Client.Billing.ContactIncomplete', 'fr', 'Entrez au moins dans un nom, prénom ou nom de l’entreprise.'), +('Client.Billing.ExistingShopuser', 'de', 'Dieser Benutzername ist bereits in Verwendung.'), +('Client.Billing.ExistingShopuser', 'en', 'This username is already in use.'), +('Client.Billing.ExistingShopuser', 'es', 'Este usuario ya se encuentra en uso.'), +('Client.Billing.ExistingShopuser', 'fr', 'Ce nom d’utilisateur est déjà utilisé.'), +('Client.Billing.ExistingProduct', 'de', 'Ein Produkt mit diesem Produkt-Identifikator existiert bereits.'), +('Client.Billing.ExistingProduct', 'en', 'A product with this product-handle already exists.'), +('Client.Billing.ExistingProduct', 'es', 'Ya existe un producto con este identificador.'), +('Client.Billing.ExistingProduct', 'fr', 'A produit avec cet identifiant "product-handle" exist dejà.'), +('Client.Billing.NoSuchProduct', 'de', 'Das Produkt mit dem angegebenen Produkt-Identifikator wurde nicht gefunden.'), +('Client.Billing.NoSuchProduct', 'en', 'No product with the specified product-handle found.'), +('Client.Billing.NoSuchProduct', 'es', 'No se han encontrado productos con el identificador especificado.'), +('Client.Billing.NoSuchProduct', 'fr', 'Aucun produit trouvé avec l'identifiant spécifié "product-handle".'), +('Client.Billing.ExistingProfile', 'de', 'Ein Billing Profil mit dem angegebenen Profil-Identifikator existiert bereits.'), +('Client.Billing.ExistingProfile', 'en', 'A billing profile with the specified profile-handle already exists.'), +('Client.Billing.ExistingProfile', 'es', 'Ya existe un perfil de facturación con este identificador.'), +('Client.Billing.ExistingProfile', 'fr', 'A profile de facturation avec l'identifiant spécifié "profile-handle" exist dejà.'), +('Client.Billing.NoSuchProfile', 'de', 'Das Billing Profil mit dem angegebenen Profil-Identifikator wurde nicht gefunden.'), +('Client.Billing.NoSuchProfile', 'en', 'No billing profile with the specified profile-handle found.'), +('Client.Billing.NoSuchProfile', 'es', 'No se han encontrado perfiles de facturación con el identificador especificado.'), +('Client.Billing.NoSuchProfile', 'fr', 'Aucun profile de facturation trouvé avec l'identifiant spécifié "profile-handle".'), +('Web.Product.Created', 'de', 'Der Produkt-Eintrag wurde erstellt.'), +('Web.Product.Created', 'en', 'The product entry has been created.'), +('Web.Product.Created', 'es', 'El producto ha sido creado.'), +('Web.Product.Created', 'fr', 'Le produit saisi a été créée.'), +('Web.Product.Updated', 'de', 'Der Produkt-Eintrag wurde geändert.'), +('Web.Product.Updated', 'en', 'The product entry has been changed.'), +('Web.Product.Updated', 'es', 'El producto ha sido modificado.'), +('Web.Product.Updated', 'fr', 'Le produit saisi a été changé.'), +('Web.Product.Deleted', 'de', 'Der Produkt-Eintrag wurde gelöscht.'), +('Web.Product.Deleted', 'en', 'The product entry has been deleted.'), +('Web.Product.Deleted', 'es', 'El producto ha sido eliminado.'), +('Web.Product.Deleted', 'fr', 'Le produit saisi a été supprimé.'), +('Web.Bilprof.Created', 'de', 'Das Billing Profil wurde erstellt.'), +('Web.Bilprof.Created', 'en', 'The billing profile has been created.'), +('Web.Bilprof.Created', 'es', 'El perfil de facturación ha sido creado.'), +('Web.Bilprof.Created', 'fr', 'Le profil de facturation a été créé.'), +('Web.Bilprof.Updated', 'de', 'Das Billing Profil wurde geändert.'), +('Web.Bilprof.Updated', 'en', 'The billing profile has been changed.'), +('Web.Bilprof.Updated', 'es', 'El perfil de facturación ha sido modificado.'), +('Web.Bilprof.Updated', 'fr', 'Le profil de facturation a été changé.'), +('Web.Bilprof.Deleted', 'de', 'Das Billing Profil wurde gelöscht.'), +('Web.Bilprof.Deleted', 'en', 'The billing profile has been deleted.'), +('Web.Bilprof.Deleted', 'es', 'El perfil de facturación ha sido eliminado.'), +('Web.Bilprof.Deleted', 'fr', 'Le profil de facturation a été supprimé.'), +('Web.Fees.MissingFilename', 'de', 'Bitte geben Sie einen Dateinamen an.'), +('Web.Fees.MissingFilename', 'en', 'Please enter a filename.'), +('Web.Fees.MissingFilename', 'es', 'Por favor, inserte un nombre de fichero.'), +('Web.Fees.MissingFilename', 'fr', 'Entrez un nom de fichier.'), +('Web.Fees.Fieldcount', 'de', 'Falsche Anzahl von Feldern'), +('Web.Fees.Fieldcount', 'en', 'Wrong number of elements'), +('Web.Fees.Fieldcount', 'es', 'Número incorrecto de elementos'), +('Web.Fees.Fieldcount', 'fr', 'Mauvais numéro d'éléments'), +('Web.Fees.FieldsFoundRequired', 'de', 'Felder gefunden/benötigt:'), +('Web.Fees.FieldsFoundRequired', 'en', 'Elements found/required:'), +('Web.Fees.FieldsFoundRequired', 'es', 'Elementos encontrados/requeridos:'), +('Web.Fees.FieldsFoundRequired', 'fr', 'Éléments trouvés/exigés: '), +('Web.Fees.InvalidDestination', 'de', 'Ungültiger Ziel-Präfix / -Suffix'), +('Web.Fees.InvalidDestination', 'en', 'Invalid destination prefix/suffix'), +('Web.Fees.InvalidDestination', 'es', 'Prefijo/sufijo de destino inválido.'), +('Web.Fees.InvalidDestination', 'fr', 'Préfixe/suffixe de destination invalide'), +('Client.Billing.NoSuchCustomer', 'de', 'Der angegebene Kunde existiert nicht.'), +('Client.Billing.NoSuchCustomer', 'en', 'The specified customer does not exist.'), +('Client.Billing.NoSuchCustomer', 'es', 'El cliente especificado no existe.'), +('Client.Billing.NoSuchCustomer', 'fr', 'Le client indiqué n'existe pas.'), +('Client.Syntax.MalformedDaytime', 'de', 'Ungültige Zeitangabe, bitte geben Sie Stunden, Minuten und Sekunden in der Form HH::MM::SS ein.'), +('Client.Syntax.MalformedDaytime', 'en', 'Invalid time specification, please enter hours, minutes and seconds in the form HH:MM:SS.'), +('Client.Syntax.MalformedDaytime', 'es', 'Formato horario inválido. Por favor, inserte horas, minutos y segundos en la forma HH:MM:SS.'), +('Client.Syntax.MalformedDaytime', 'fr', 'Temps spécifié invalide, entrez des heures, des minutes et des secondes sous forme HH:MM:SS.'), +('Web.Fees.SavedPeaktimes', 'de', 'Die Zeit-Einträge wurden aktualisiert.'), +('Web.Fees.SavedPeaktimes', 'en', 'The time-entries have been updated.'), +('Web.Fees.SavedPeaktimes', 'es', 'Las entradas de tiempos han sido actualizadas.'), +('Web.Fees.SavedPeaktimes', 'fr', 'Les entrées de temps ont été mises à jour.'), +('Client.Voip.DuplicatedNumber', 'de', 'Eine Rufnummer wurde mehr als einmal angegeben.'), +('Client.Voip.DuplicatedNumber', 'en', 'A phone number was specified more than once.'), +('Client.Voip.DuplicatedNumber', 'es', 'Un número de teléfono ha sido especificado más de una vez.'), +('Client.Voip.DuplicatedNumber', 'fr', 'Un numéro de téléphone a été spécifié plus d’une fois.'), +('Client.Voip.SlotAlreadyExists', 'de', 'Der Kurzwahl-Eintrag ist bereits in Verwendung.'), +('Client.Voip.SlotAlreadyExists', 'en', 'The speed dial slot is already in use.'), +('Client.Voip.SlotAlreadyExists', 'es', 'La posición de marcación rápida ya está en uso.'), +('Client.Voip.SlotAlreadyExists', 'fr', 'La numérotation abrégée est déjà utilisé.'), +('Client.Voip.SlotNotExistent', 'en', 'The speed dial slot does not exist.'), +('Client.Voip.SlotNotExistent', 'de', 'Der Kurzwahl-Eintrag ist nicht vorhanden.'), +('Client.Voip.SlotNotExistent', 'es', 'La posición de marcación rápida no existe.'), +('Client.Voip.SlotNotExistent', 'fr', 'La numérotation abrégée n'existe pas.'), +('Client.Syntax.MalformedSpeedDialDestination', 'en', 'The speed dial slot destination is invalid.'), +('Client.Syntax.MalformedSpeedDialDestination', 'de', 'Das Ziel des Kurzwahl-Eintrag ist ungültig.'), +('Client.Syntax.MalformedSpeedDialDestination', 'es', 'La posición de marcación rápida escogida es inválida.'), +('Client.Syntax.MalformedSpeedDialDestination', 'fr', 'Le slot de la numérotation abrégée est invalide.'), +('Client.Syntax.MalformedVSC', 'en', 'The vertical service code (VSC) is invalid.'), +('Client.Syntax.MalformedVSC', 'de', 'Der VSC (vertical service code) ist ungültig.'), +('Client.Syntax.MalformedVSC', 'es', 'El código de servicio vertical (VSC) es inválido.'), +('Client.Syntax.MalformedVSC', 'fr', 'Le code de service vertical (VSC) est invalide.'), +('Client.Syntax.MalformedIPNet', 'en', 'Malformed ipnet, please use dotted decimal notation and specify the mask as number of bits.'), +('Client.Syntax.MalformedIPNet', 'de', 'Ungültiges Netzwerk, bitte verwenden Sie die Dezimalschreibweise mit Punkt und geben Sie die Netzmaske als Anzahl von Bits an.'), +('Client.Syntax.MalformedIPNet', 'es', 'Sintaxis de red inválida. Por favor, use notación decimal y especifique la máscara como número de bits.'), +('Client.Syntax.MalformedIPNet', 'fr', 'Malformed ipnet, please use dotted decimal notation and specify the mask as number of bits.'), +('Client.Syntax.MalformedIP', 'en', 'Malformed ip, please use dotted decimal notation for IPv4 or address without square brackets for IPv6.'), +('Client.Syntax.MalformedIP', 'de', 'Ungültige IP, bitte verwenden Sie dotted decimal Notation für IPv4 bzw. Format ohne eckige Klammern für IPv6.'), +('Client.Syntax.MalformedIP', 'es', 'Sintaxis de IP inválida. Por favor, use notación decimal.'), +('Client.Syntax.MalformedIP', 'fr', 'IP mal construite, utilisez la notation décimale pointillée.'), +('Server.Voip.PeerGroupDeleted', 'en', 'The peering group has been deleted.'), +('Server.Voip.PeerGroupDeleted', 'de', 'Die Peering-Gruppe wurde gelöscht.'), +('Server.Voip.PeerGroupDeleted', 'es', 'El grupo de peering ha sido eliminado.'), +('Server.Voip.PeerGroupDeleted', 'fr', 'Le groupe peering a été supprimé.'), +('Client.Voip.NoSuchPeerGroup', 'en', 'The peering group does not exist.'), +('Client.Voip.NoSuchPeerGroup', 'de', 'Die Peering-Gruppe existiert nicht.'), +('Client.Voip.NoSuchPeerGroup', 'es', 'El grupo de peering no existe.'), +('Client.Voip.NoSuchPeerGroup', 'fr', 'Le groupe peering n’existe pas.'), +('Client.Voip.NoPeerContract', 'en', 'No peering contract selected.'), +('Client.Voip.NoPeerContract', 'de', 'Kein Peering Contract ausgewählt.'), +('Client.Voip.NoPeerContract', 'es', 'No se ha seleccionado un contrato de peering.'), +('Client.Voip.NoPeerContract', 'fr', 'Aucun peering contract n’est sélectionné.'), +('Client.Voip.ExistingPeerGroup', 'en', 'The peering group already exists.'), +('Client.Voip.ExistingPeerGroup', 'de', 'Die Peering-Gruppe existiert bereits.'), +('Client.Voip.ExistingPeerGroup', 'es', 'El grupo de peering ya existe.'), +('Client.Voip.ExistingPeerGroup', 'fr', 'Le peering group existe déjà.'), +('Client.Syntax.MalformedPeerGroupName', 'en', 'Invalid characters in peering group name.'), +('Client.Syntax.MalformedPeerGroupName', 'de', 'Ungültige Zeichen im Name der Peering-Gruppe.'), +('Client.Syntax.MalformedPeerGroupName', 'es', 'Encontrados caracteres inválidos en el nombre del grupo de peering.'), +('Client.Syntax.MalformedPeerGroupName', 'fr', 'Caractères invalides dans le peering group name.'), +('Client.Voip.NoSuchPeerRule', 'en', 'The peering rule does not exist.'), +('Client.Voip.NoSuchPeerRule', 'de', 'Die Peering-Regel existiert nicht.'), +('Client.Voip.NoSuchPeerRule', 'es', 'La regla de peering no existe.'), +('Client.Voip.NoSuchPeerRule', 'fr', 'Le peering rule n’existe pas.'), +('Client.Voip.NoSuchPeerHost', 'en', 'The peering host does not exist.'), +('Client.Voip.NoSuchPeerHost', 'de', 'Der Peering-Server existiert nicht.'), +('Client.Voip.NoSuchPeerHost', 'es', 'El servidor de peering no existe.'), +('Client.Voip.NoSuchPeerHost', 'fr', 'Le peering host n’existe pas.'), +('Client.Voip.ExistingPeerHost', 'en', 'A peering host with this name already exists in this group.'), +('Client.Voip.ExistingPeerHost', 'de', 'Es existiert bereits ein Peering-Host dieses Namens in dieser Gruppe.'), +('Client.Voip.ExistingPeerHost', 'es', 'Ya existe un servidor de peering con este nombre en el grupo.'), +('Client.Voip.ExistingPeerHost', 'fr', 'Un peering host avec ce nom existe déjà dans ce groupe.'), +('Client.Voip.ExistingPeerIp', 'en', 'A peering host with this IP address already exists.'), +('Client.Voip.ExistingPeerIp', 'de', 'Es existiert bereits ein Peering-Host mit dieser IP-Adresse.'), +('Client.Voip.ExistingPeerIp', 'es', 'Ya existe un servidor de peering con esta IP.'), +('Client.Voip.ExistingPeerIp', 'fr', 'Un peering host avec cette adresse IP existe déjà.'), +('Client.Voip.NoSuchPeerRewriteRule', 'en', 'The peering rewrite rule does not exist.'), +('Client.Voip.NoSuchPeerRewriteRule', 'de', 'Die Peering-Rewrite-Regel existiert nicht.'), +('Client.Voip.NoSuchPeerRewriteRule', 'es', 'La regla de reescritura de peering no existe.'), +('Client.Voip.NoSuchPeerRewriteRule', 'fr', 'Le peering rewrite rule n’existe pas.'), +('Client.Voip.NoSuchDomainRewriteRule', 'en', 'The domain rewrite rule does not exist.'), +('Client.Voip.NoSuchDomainRewriteRule', 'de', 'Die Domain-Rewrite-Regel existiert nicht.'), +('Client.Voip.NoSuchDomainRewriteRule', 'es', 'La regla de reescritura de dominio no existe.'), +('Client.Voip.NoSuchDomainRewriteRule', 'fr', 'Le domaine rewrite rule n’existe pas.'), +('Client.Voip.NoSuchCfDestSet', 'en', 'The call-forward destination set does not exist.'), +('Client.Voip.NoSuchCfDestSet', 'es', 'The call-forward destination set does not exist.'), +('Client.Voip.NoSuchCfDestSet', 'de', 'Die Rufumleitungs-Gruppe existiert nicht.'), +('Client.Voip.NoSuchCfDestSet', 'fr', 'The call-forward destination set does not exist.'), +('Client.Voip.ExistingCfDestSet', 'en', 'The call-forward destination set already exists.'), +('Client.Voip.ExistingCfDestSet', 'es', 'The call-forward destination set already exists.'), +('Client.Voip.ExistingCfDestSet', 'de', 'Die Rufumleitungs-Gruppe existiert bereits.'), +('Client.Voip.ExistingCfDestSet', 'fr', 'The call-forward destination set already exists.'), +('Client.Voip.NoSuchCfDest', 'en', 'The call-forward destination does not exist.'), +('Client.Voip.NoSuchCfDest', 'es', 'The call-forward destination does not exist.'), +('Client.Voip.NoSuchCfDest', 'de', 'Die Rufumleitung existiert nicht.'), +('Client.Voip.NoSuchCfDest', 'fr', 'The call-forward destination does not exist.'), +('Client.Voip.ExistingCfDest', 'en', 'The call-forward destination already exists.'), +('Client.Voip.ExistingCfDest', 'es', 'The call-forward destination already exists.'), +('Client.Voip.ExistingCfDest', 'de', 'Die Rufumleitung existiert bereits.'), +('Client.Voip.ExistingCfDest', 'fr', 'The call-forward destination already exists.'), +('Client.Voip.NoSuchCfTimeSet', 'en', 'The call-forward time set does not exist.'), +('Client.Voip.NoSuchCfTimeSet', 'es', 'The call-forward time set does not exist.'), +('Client.Voip.NoSuchCfTimeSet', 'de', 'Die Rufumleitungs-Zeit-Gruppe existiert nicht.'), +('Client.Voip.NoSuchCfTimeSet', 'fr', 'The call-forward time set does not exist.'), +('Client.Voip.ExistingCfTimeSet', 'en', 'The call-forward time set already exists.'), +('Client.Voip.ExistingCfTimeSet', 'es', 'The call-forward time set already exists.'), +('Client.Voip.ExistingCfTimeSet', 'de', 'Die Rufumleitungs-Zeit-Gruppe existiert bereits.'), +('Client.Voip.ExistingCfTimeSet', 'fr', 'The call-forward time set already exists.'), +('Client.Voip.NoSuchCfPeriod', 'en', 'The call-forward time period does not exist.'), +('Client.Voip.NoSuchCfPeriod', 'es', 'The call-forward time period does not exist.'), +('Client.Voip.NoSuchCfPeriod', 'de', 'Die Rufumleitungs-Zeitperiode existiert nicht.'), +('Client.Voip.NoSuchCfPeriod', 'fr', 'The call-forward time period does not exist.'), +('Client.Voip.MalformedFaxDestination', 'en', ''destination' must be an email address or phone number.'), +('Client.Voip.MalformedFaxDestination', 'de', ''destination' muss eine E-Mail Adresse oder Telefonnummer enthalten.'), +('Client.Voip.MalformedFaxDestination', 'es', ''destination' ha de ser una dirección de correo o un número de teléfono.'), +('Client.Voip.MalformedFaxDestination', 'fr', ''destination' doit être une adresse électronique ou un numéro de téléphone.'), +('Client.Syntax.FaxPassLength', 'en', 'The password is to short, please use ${faxpw_min_char} characters at least.'), +('Client.Syntax.FaxPassLength', 'de', 'Das Passwort ist zu kurz, bitte verwenden Sie mindestens ${faxpw_min_char} Zeichen.'), +('Client.Syntax.FaxPassLength', 'es', 'La contraseña es demasiado corta. Por favor use al menos ${faxpw_min_char} caracteres.'), +('Client.Syntax.FaxPassLength', 'fr', 'Le mot de passe est trop court, utilisez le caractères $ {faxpw_min_char} au moins.'), +('Web.Syntax.ID', 'en', 'Invalid ID, please enter a numeric value.'), +('Web.Syntax.ID', 'de', 'Ungültige ID, bitte geben Sie einen numerischen Wert ein.'), +('Web.Syntax.ID', 'es', 'ID inválido. Por favor, introduzca un valor numérico.'), +('Web.Syntax.ID', 'fr', 'ID invalide, entrez dans une valeur numérique.'), +('Web.Syntax.LNPProvName', 'en', 'Please enter a provider name in the text field.'), +('Web.Syntax.LNPProvName', 'de', 'Bitte geben Sie einen Provider-Namen in das Textfeld ein.'), +('Web.Syntax.LNPProvName', 'es', 'Por favor, introduzca el nombre de un proveedor en el campo de texto.'), +('Web.Syntax.LNPProvName', 'fr', 'Entrez un nom de fournisseur dans le champ texte.'), +('Web.LNPProvider.Created', 'en', 'The LNP provider has been created.'), +('Web.LNPProvider.Created', 'de', 'Der LNP Provider wurde erstellt.'), +('Web.LNPProvider.Created', 'es', 'El proveedor LNP ha sido creado.'), +('Web.LNPProvider.Created', 'fr', 'Le fournisseur LNP a été créé.'), +('Web.LNPProvider.Updated', 'en', 'The LNP provider has been changed.'), +('Web.LNPProvider.Updated', 'de', 'Der LNP Provider wurde geändert.'), +('Web.LNPProvider.Updated', 'es', 'El proveedor LNP ha sido modificado.'), +('Web.LNPProvider.Updated', 'fr', 'Le fournisseur LNP a été changé.'), +('Web.LNPProvider.Deleted', 'en', 'The LNP provider has been deleted.'), +('Web.LNPProvider.Deleted', 'de', 'Der LNP Provider wurde gelöscht.'), +('Web.LNPProvider.Deleted', 'es', 'El proveedor LNP ha sido eliminado.'), +('Web.LNPProvider.Deleted', 'fr', 'Le fournisseur LNP a été supprimé.'), +('Web.LNPNumber.Created', 'en', 'The LNP number has been stored.'), +('Web.LNPNumber.Created', 'de', 'Die LNP Nummer wurde gespeichert.'), +('Web.LNPNumber.Created', 'es', 'El número LNP ha sido guardado.'), +('Web.LNPNumber.Created', 'fr', 'Le numéro LNP a été stocké.'), +('Web.LNPNumber.Updated', 'en', 'The LNP number has been changed.'), +('Web.LNPNumber.Updated', 'de', 'Die LNP Nummer wurde geändert.'), +('Web.LNPNumber.Updated', 'es', 'El número LNP ha sido modificado.'), +('Web.LNPNumber.Updated', 'fr', 'Le numéro LNP a été changé.'), +('Web.LNPNumber.Deleted', 'en', 'The LNP number has been deleted.'), +('Web.LNPNumber.Deleted', 'de', 'Die LNP Nummer wurde gelöscht.'), +('Web.LNPNumber.Deleted', 'es', 'El número LNP ha sido eliminado.'), +('Web.LNPNumber.Deleted', 'fr', 'Le numéro LNP a été supprimé.'), +('Client.Syntax.MalformedE164Number', 'en', 'Invalid E.164 number. Please use numbers only and include the international prefix.'), +('Client.Syntax.MalformedE164Number', 'de', 'Ungültige E.164 Nummer. Bitte verwenden Sie nur Zahlen und geben sie den internationalen Prefix mit an.'), +('Client.Syntax.MalformedE164Number', 'es', 'Número E.164 inválido. Por favor, use dígitos exclusivamente e incluya el prefijo internacional.'), +('Client.Syntax.MalformedE164Number', 'fr', 'Numéro E.164.est invalide Utilisez des nombres uniquement en incluant le préfixe international.'), +('Client.Syntax.MalformedDate', 'en', 'Invalid date, please check your syntax.'), +('Client.Syntax.MalformedDate', 'de', 'Ungültiges Datum, bitte überprüfen Sie die Syntax.'), +('Client.Syntax.MalformedDate', 'es', 'Fecha inválida. Por favor, revise la sintaxis.'), +('Client.Syntax.MalformedDate', 'fr', 'La date est invalide, vérifiez votre syntaxe.'), +('Client.Syntax.MissingNCOSLevel', 'en', 'Please specify an NCOS level identifier string.'), +('Client.Syntax.MissingNCOSLevel', 'de', 'Bitte geben Sie eine Bezeichnung für den NCOS Level an.'), +('Client.Syntax.MissingNCOSLevel', 'es', 'Por favor, especifique una cadena identificadora para el nivel NCOS.'), +('Client.Syntax.MissingNCOSLevel', 'fr', 'Spécifiez une série d'identificateur de niveau de NCOS.'), +('Client.NCOS.ExistingLevel', 'en', 'The NCOS level already exists.'), +('Client.NCOS.ExistingLevel', 'de', 'Die NCOS Level Bezeichnung existiert bereits.'), +('Client.NCOS.ExistingLevel', 'es', 'El nivel NCOS ya existe.'), +('Client.NCOS.ExistingLevel', 'fr', 'Le niveau de NCOS existe déjà.'), +('Client.NCOS.NoSuchLevel', 'en', 'The NCOS level does not exist.'), +('Client.NCOS.NoSuchLevel', 'de', 'Die NCOS Level Bezeichnung existiert nicht.'), +('Client.NCOS.NoSuchLevel', 'es', 'El nivel NCOS no existe.'), +('Client.NCOS.NoSuchLevel', 'fr', 'The NCOS level does not exist.'), +('Web.NCOSLevel.Created', 'en', 'The NCOS level has been created.'), +('Web.NCOSLevel.Created', 'de', 'Der NCOS Level wurde erstellt.'), +('Web.NCOSLevel.Created', 'es', 'El nivel NCOS ha sido creado.'), +('Web.NCOSLevel.Created', 'fr', 'Le niveau de NCOS a été créé.'), +('Web.NCOSLevel.Updated', 'en', 'The NCOS level has been changed.'), +('Web.NCOSLevel.Updated', 'de', 'Der NCOS Level wurde geändert.'), +('Web.NCOSLevel.Updated', 'es', 'El nivel NCOS ha sido modificado.'), +('Web.NCOSLevel.Updated', 'fr', 'Le niveau de NCOS a été changé.'), +('Web.NCOSLevel.Deleted', 'en', 'The NCOS level has been deleted.'), +('Web.NCOSLevel.Deleted', 'de', 'Der NCOS Level wurde gelöscht.'), +('Web.NCOSLevel.Deleted', 'es', 'El nivel NCOS ha sido eliminado.'), +('Web.NCOSLevel.Deleted', 'fr', 'Le niveau de NCOS a été supprimé.'), +('Web.NCOSPattern.Created', 'en', 'The pattern has been stored.'), +('Web.NCOSPattern.Created', 'de', 'Der Filter wurde gespeichert.'), +('Web.NCOSPattern.Created', 'es', 'El patrón ha sido guardado.'), +('Web.NCOSPattern.Created', 'fr', 'Le modèle a été stocké.'), +('Web.NCOSPattern.Updated', 'en', 'The pattern has been replaced.'), +('Web.NCOSPattern.Updated', 'de', 'Der Filter wurde ersetzt.'), +('Web.NCOSPattern.Updated', 'es', 'El patrón ha sido modificado.'), +('Web.NCOSPattern.Updated', 'fr', 'Le modèle a été remplacé.'), +('Web.NCOSPattern.Deleted', 'en', 'The pattern has been deleted.'), +('Web.NCOSPattern.Deleted', 'de', 'Der Filter wurde entfernt.'), +('Web.NCOSPattern.Deleted', 'es', 'El patrón ha sido eliminado.'), +('Web.NCOSPattern.Deleted', 'fr', 'Le modèle a été supprimé.'), +('Web.NCOSLNP.Created', 'en', 'The provider has been added to the list.'), +('Web.NCOSLNP.Created', 'de', 'Der LNP Provider wurde der Liste hinzugefügt.'), +('Web.NCOSLNP.Created', 'es', 'El proveedor ha sido añadido a la lista.'), +('Web.NCOSLNP.Created', 'fr', 'Le fournisseur a été ajouté à la liste.'), +('Web.NCOSLNP.Updated', 'en', 'The provider has been updated.'), +('Web.NCOSLNP.Updated', 'de', 'Der LNP Provider wurde geändert.'), +('Web.NCOSLNP.Updated', 'es', 'El proveedor ha sido modificado.'), +('Web.NCOSLNP.Updated', 'fr', 'Le fournisseur a été mis à jour.'), +('Web.NCOSLNP.Deleted', 'en', 'The provider has been removed from the list.'), +('Web.NCOSLNP.Deleted', 'de', 'Der LNP Provider wurde von der Liste entfernt.'), +('Web.NCOSLNP.Deleted', 'es', 'El proveedor ha sido eliminado de la lista.'), +('Web.NCOSLNP.Deleted', 'fr', 'Le fournisseur a été enlevé de la liste.'), +('Client.Syntax.MalformedNCOSPattern', 'en', 'The pattern may not be empty, please specify a regular expression.'), +('Client.Syntax.MalformedNCOSPattern', 'de', 'Der Filter darf nicht leer sein, bitte geben Sie einen regulären Ausdruck an.'), +('Client.Syntax.MalformedNCOSPattern', 'es', 'El patrón podría no estar vacío. Por favor, introduzca una expresión regular.'), +('Client.Syntax.MalformedNCOSPattern', 'fr', 'Le modèle ne peut pas être vide, spécifiez une expression régulière.'), +('Client.Syntax.MalformedAudioData', 'en', 'Invalid audio data, please provide an audio stream in wave format.'), +('Client.Syntax.MalformedAudioData', 'de', 'Ungültige Audio-Daten, bitte geben Sie einen Stream im Wave-Format an.'), +('Client.Syntax.MalformedAudioData', 'es', 'Audio incorrecto. Por favor proporcione un flujo de audio en formato wav.'), +('Client.Syntax.MalformedAudioData', 'fr', 'Données audio invalides, fournissez un format audio courant.'), +('Client.Voip.ExistingAudioFile', 'en', 'The audio file handle is already in use.'), +('Client.Voip.ExistingAudioFile', 'de', 'Der Audio-Datei-Identifikator wird bereits verwendet.'), +('Client.Voip.ExistingAudioFile', 'es', 'El fichero de audio ya está en uso.'), +('Client.Voip.ExistingAudioFile', 'fr', 'Le fichier audio traité est déjà dans.'), +('Client.Voip.NoSuchAudioFile', 'en', 'The audio file handle does not exist.'), +('Client.Voip.NoSuchAudioFile', 'de', 'Der Audio-Datei-Identifikator existiert noch nicht.'), +('Client.Voip.NoSuchAudioFile', 'es', 'El fichero de audio no existe.'), +('Client.Voip.NoSuchAudioFile', 'fr', 'Le fichier audio traité n'existe pas.'), +('Web.AudioFile.Created', 'en', 'The audio file has been created.'), +('Web.AudioFile.Created', 'de', 'Die Audio-Datei wurde gespeichert.'), +('Web.AudioFile.Created', 'es', 'El fichero de audio ha sido creado.'), +('Web.AudioFile.Created', 'fr', 'Le fichier audio a été créé.'), +('Web.AudioFile.Updated', 'en', 'The audio file has been changed.'), +('Web.AudioFile.Updated', 'de', 'Die Audio-Datei wurde geändert.'), +('Web.AudioFile.Updated', 'es', 'El fichero de audio ha sido modificado.'), +('Web.AudioFile.Updated', 'fr', 'Le fichier audio a été changé.'), +('Web.AudioFile.Deleted', 'en', 'The audio file has been deleted.'), +('Web.AudioFile.Deleted', 'de', 'Die Audio-Datei wurde gelöscht.'), +('Web.AudioFile.Deleted', 'es', 'El fichero de audio ha sido eliminado.'), +('Web.AudioFile.Deleted', 'fr', 'Le fichier audio a été supprimé.'), +('Client.Syntax.MalformedHandle', 'en', 'Invalid handle, please specify an alpha-numeric string.'), +('Client.Syntax.MalformedHandle', 'de', 'Ungültiger Identifikator, bitte geben Sie eine alphanumerische Zeichenkette ein.'), +('Client.Syntax.MalformedHandle', 'es', 'Nombre incorrecto. Por favor use caracteres alfanuméricos exclusivamente.'), +('Client.Syntax.MalformedHandle', 'fr', 'Traitement invalide, spécifiez une série alphanumérique.'), +('Client.VSC.NoSuchAction', 'en', 'The VSC action does not exist.'), +('Client.VSC.NoSuchAction', 'de', 'Die VSC Aktion existiert nicht.'), +('Client.VSC.NoSuchAction', 'es', 'La acción VSC no existe.'), +('Client.VSC.NoSuchAction', 'fr', 'L'action VSC n'existe pas.'), +('Client.VSC.ExistingAction', 'en', 'The VSC action has already been defined.'), +('Client.VSC.ExistingAction', 'de', 'Die VSC Aktion wurde bereits definiert.'), +('Client.VSC.ExistingAction', 'es', 'La acción VSC ya ha sido definida.'), +('Client.VSC.ExistingAction', 'fr', 'L'action VSC a déjà été définie.'), +('Client.VSC.ExistingDigits', 'en', 'The digits are already in use for another VSC action.'), +('Client.VSC.ExistingDigits', 'de', 'Die Zahlenkombination wird bereits für eine andere VSC Aktion verwendet.'), +('Client.VSC.ExistingDigits', 'es', 'Los dígitos ya se encuentran definidos para otra acción VSC.'), +('Client.VSC.ExistingDigits', 'fr', 'Les chiffres sont déjà en cours d’utilisation pour une autre action de VSC.'), +('Client.Syntax.MalformedVSCDigits', 'en', 'Invalid VSC digits setting, please specify exactly two digits.'), +('Client.Syntax.MalformedVSCDigits', 'de', 'Ungültige Zahlenkombination, bitte geben Sie genau zwei Ziffern an.'), +('Client.Syntax.MalformedVSCDigits', 'es', 'Especificación de dígitos inválida. Por favor, especifica exactamente dos dígitos.'), +('Client.Syntax.MalformedVSCDigits', 'fr', 'La configuration de chiffres VSC est invalide, spécifiez exactement deux chiffres.'), +('Web.VSC.Created', 'en', 'The VSC entry has been created.'), +('Web.VSC.Created', 'de', 'Der VSC Eintrag wurde gespeichert.'), +('Web.VSC.Created', 'es', 'La entrada VSC ha sido creada.'), +('Web.VSC.Created', 'fr', 'L'entrée VSC a été créée.'), +('Web.VSC.Updated', 'en', 'The VSC entry has been changed.'), +('Web.VSC.Updated', 'de', 'Der VSC Eintrag wurde geändert.'), +('Web.VSC.Updated', 'es', 'La entrada VSC ha sido modificada.'), +('Web.VSC.Updated', 'fr', 'L'entrée VSC a été changée.'), +('Web.VSC.Deleted', 'en', 'The VSC entry has been deleted.'), +('Web.VSC.Deleted', 'de', 'Der VSC Eintrag wurde gelöscht.'), +('Web.VSC.Deleted', 'es', 'La entrada VSC ha sido eliminada.'), +('Web.VSC.Deleted', 'fr', 'L'entrée VSC a été supprimée.'), +('Client.Voip.AudioFileInUse', 'en', 'The audio file is in use and can't be deleted.'), +('Client.Voip.AudioFileInUse', 'de', 'Die Audio-Datei wird verwendet und kann nicht gelöscht werden.'), +('Client.Voip.AudioFileInUse', 'es', 'El fichero de audio se encuentra actualmente en uso y no puede ser eliminado.'), +('Client.Voip.AudioFileInUse', 'fr', 'Le fichier audio est en cours d'utilisation et ne peut pas être supprimé.'), +('Web.Contract.Created', 'en', 'The contract has been created.'), +('Web.Contract.Created', 'de', 'Der Vertrag wurde gespeichert.'), +('Web.Contract.Created', 'es', 'El contrato ha sido creado.'), +('Web.Contract.Created', 'fr', 'Le contrat a été créé.'), +('Web.Contract.Updated', 'en', 'The contract has been changed.'), +('Web.Contract.Updated', 'de', 'Der Vertrag wurde geändert.'), +('Web.Contract.Updated', 'es', 'El contrato ha sido modificado.'), +('Web.Contract.Updated', 'fr', 'Le contrat a été changé.'), +('Web.Contract.Deleted', 'en', 'The contract has been deleted.'), +('Web.Contract.Deleted', 'de', 'Der Vertrag wurde gelöscht.'), +('Web.Contract.Deleted', 'es', 'El contrato ha sido eliminado.'), +('Web.Contract.Deleted', 'fr', 'Le contrat a été supprimé.'), +('Web.NCOSLevel.LACSet', 'en', 'The caller's area code has been added to the list.'), +('Web.NCOSLevel.LACSet', 'de', 'Die Vorwahl des Anrufers wurde zur Liste hinzugefügt.'), +('Web.NCOSLevel.LACSet', 'es', 'El código de área de llamante ha sido añadido a la lista.'), +('Web.NCOSLevel.LACSet', 'fr', 'L'indicatif de l'interlocuteur a été ajouté à la liste.'), +('Web.NCOSLevel.LACUnset', 'en', 'The caller's area code has been removed from the list.'), +('Web.NCOSLevel.LACUnset', 'de', 'Die Vorwahl des Anrufers wurde von der Liste entfernt.'), +('Web.NCOSLevel.LACUnset', 'es', 'El código de área de llamante ha sido eliminado de la lista.'), +('Web.NCOSLevel.LACUnset', 'fr', 'L'indicatif de l'interlocuteur a été enlevé de la liste.'), +('Web.NumberBlock.Created', 'en', 'The number block has been created.'), +('Web.NumberBlock.Created', 'de', 'Der Nummernblock wurde gespeichert.'), +('Web.NumberBlock.Created', 'es', 'El bloque de numeración ha sido creado.'), +('Web.NumberBlock.Created', 'fr', 'Le bloc de numéro a été créé.'), +('Web.NumberBlock.Updated', 'en', 'The number block has been changed.'), +('Web.NumberBlock.Updated', 'de', 'Der Nummernblock wurde geändert.'), +('Web.NumberBlock.Updated', 'es', 'El bloque de numeración ha sido modificado.'), +('Web.NumberBlock.Updated', 'fr', 'Le bloc de numéro a été changé.'), +('Web.NumberBlock.Deleted', 'en', 'The number block has been deleted.'), +('Web.NumberBlock.Deleted', 'de', 'Der Nummernblock wurde gelöscht.'), +('Web.NumberBlock.Deleted', 'es', 'El bloque de numeración ha sido eliminado.'), +('Web.NumberBlock.Deleted', 'fr', 'Le bloc de numéro a été supprimé.'), +('Client.Syntax.MalformedReminderTime', 'en', 'Invalid time string, please use 'hh:mm' format.'), +('Client.Syntax.MalformedReminderTime', 'de', 'Ungültige Zeitangabe, bitte verwenden Sie das 'hh:mm' Format.'), +('Client.Syntax.MalformedReminderTime', 'es', 'Formato de tiempo inválido. Por favor, utilice el formato 'hh:mm'.'), +('Client.Syntax.MalformedReminderTime', 'fr', 'Série de temps invalide, utiliser le format de 'hh:mm'.'), +('Web.Fax.ExistingFaxDestination', 'en', 'This destination is already on the list.'), +('Web.Fax.ExistingFaxDestination', 'de', 'Dieses Destination steht bereits auf der Liste.'), +('Web.Fax.ExistingFaxDestination', 'es', 'Este destino ya se encuentra en la lista.'), +('Web.Fax.ExistingFaxDestination', 'fr', 'Cette destination est déjà dans la liste.'), +('Client.Voip.ReservedSubscriber', 'en', 'This username is reserved for internal use.'), +('Client.Voip.ReservedSubscriber', 'de', 'Dieser Username ist für interne Verwendung reserviert.'), +('Client.Voip.ReservedSubscriber', 'es', 'El nombre de usuario está reservado para uso interno.'), +('Client.Voip.ReservedSubscriber', 'fr', 'Ce non d’utilisateur est réservé pour l’utilisation interne.'), +('Server.Voip.NoProxy', 'de', 'Es wurde kein SIP Proxy für Click-To-Dial konfiguriert.'), +('Server.Voip.NoProxy', 'en', 'No SIP Proxy has been configured for click-to-dial.'), +('Server.Voip.NoProxy', 'es', 'No se ha configurado ningún proxy SIP para click-to-dial.'), +('Server.Voip.NoProxy', 'fr', 'Aucun SIP Proxy n'a été configuré pour Cliquer et composer le numéro.'), +('Client.Fees.DuplicateDestination', 'de', 'Ein Ziel-Präfix / -Suffix wurde mehrfach angegeben.'), +('Client.Fees.DuplicateDestination', 'en', 'A destination prefix/suffix has been specified twice.'), +('Client.Fees.DuplicateDestination', 'es', 'Prefijo/sufijo de destino duplicado.'), +('Client.Fees.DuplicateDestination', 'fr', 'Un préfixe/suffixe de destination a été spécifié deux fois.'), +('Client.Billing.ExistingExternalCID', 'en', 'This external ID is already in use for another customer.'), +('Client.Billing.ExistingExternalCID', 'de', 'Diese externe ID ist bereits bei einem anderen Kunden in Verwendung.'), +('Client.Billing.ExistingExternalCID', 'es', 'Este ID externo ya está siendo usado por otro cliente.'), +('Client.Billing.ExistingExternalCID', 'fr', 'Cet ID externe est déjà utilisé pour un autre client.'), +('Client.Billing.ExistingExternalAID', 'en', 'This external ID is already in use for another account.'), +('Client.Billing.ExistingExternalAID', 'de', 'Diese externe ID ist bereits bei einem anderen Vertrag in Verwendung.'), +('Client.Billing.ExistingExternalAID', 'es', 'Este ID externo ya está siendo usado por otra cuenta.'), +('Client.Billing.ExistingExternalAID', 'fr', 'Cet ID externe est déjà utilisé pour un autre compte.'), +('Client.Billing.ExistingExternalSID', 'en', 'This external ID is already in use for another subscriber.'), +('Client.Billing.ExistingExternalSID', 'de', 'Diese externe ID ist bereits bei einem anderen Subscriber in Verwendung.'), +('Client.Billing.ExistingExternalSID', 'es', 'Este ID externo ya está siendo usado por otro subscriptor.'), +('Client.Billing.ExistingExternalSID', 'fr', 'Cet ID externe est déjà utilisé pour un autre abonné.'), +('Web.Syntax.MissingExternalID', 'en', 'Please enter an external ID in the search box.'), +('Web.Syntax.MissingExternalID', 'de', 'Bitte geben Sie eine externe ID in das Suchfeld ein.'), +('Web.Syntax.MissingExternalID', 'es', 'Por favor, introduzca un ID externo en el campo de búsqueda.'), +('Web.Syntax.MissingExternalID', 'fr', 'Entrez ID externe dans la boîte de recherche.'), +('Client.Voip.ExistingRewriteRuleSet', 'en', 'The rewrite rule set name is already in use.'), +('Client.Voip.ExistingRewriteRuleSet', 'de', 'Der Name ist bereits für ein anderes Regelset in Verwendung.'), +('Client.Voip.ExistingRewriteRuleSet', 'es', 'El nombre de grupo de reglas de reescritura ya está en uso.'), +('Client.Voip.ExistingRewriteRuleSet', 'fr', 'Le groupe rewrite rule est déja utilisé.'), +('Client.Voip.NoSuchRewriteRuleSet', 'en', 'The rewrite rule set does not exist.'), +('Client.Voip.NoSuchRewriteRuleSet', 'de', 'Das angegebene Regelset existiert nicht.'), +('Client.Voip.NoSuchRewriteRuleSet', 'es', 'El grupo de reglas de reescritura no existe.'), +('Client.Voip.NoSuchRewriteRuleSet', 'fr', 'Le groupe rewrite rule n’existe pas.'), +('Client.Voip.NoSuchRewriteRule', 'en', 'The rewrite rule does not exist.'), +('Client.Voip.NoSuchRewriteRule', 'de', 'Die angegebene Regel existiert nicht.'), +('Client.Voip.NoSuchRewriteRule', 'es', 'La regla de reescritura no existe.'), +('Client.Voip.NoSuchRewriteRule', 'fr', 'Le rewrite rule n’existe pas'), +('Web.Rewrite.RuleSetDeleted', 'en', 'The rewrite rule set has been deleted.'), +('Web.Rewrite.RuleSetDeleted', 'de', 'Das Regelset wurde gelöscht.'), +('Web.Rewrite.RuleSetDeleted', 'es', 'La regla de reescritura ha sido borrada.'), +('Web.Rewrite.RuleSetDeleted', 'fr', 'Le groupe rewrite rule a été supprimé.'), +('Web.Fees.InvalidCharset', 'en', 'Invalid character set detected, please provide all data in UTF-8 encoding.'), +('Web.Fees.InvalidCharset', 'de', 'Ungültiger Zeichensatz, bitte verwenden Sie für alle Daten die UTF-8 Kodierung.'), +('Web.Fees.InvalidCharset', 'es', 'Detectada codificación de caracter inválida. Por favor, use codificación UTF-8.'), +('Web.Fees.InvalidCharset', 'fr', 'Jeu de caractères non valide détecté, s'il vous plaît fournir toutes les données en UTF-8.'), +('Web.Fees.InvalidZone', 'en', 'Invalid zone specification, should be a non-empty string'), +('Web.Fees.InvalidZone', 'de', 'Ungültige Zonenbeschreibung, bitte geben Sie einen Text ein'), +('Web.Fees.InvalidZone', 'es', 'Zona especificada no válida. Debe ser una cadena de caracteres no vacía.'), +('Web.Fees.InvalidZone', 'fr', 'Zone de la spécification non valide détecté. Doit être une chaîne non vide.'), +('Web.Fees.InvalidZoneDetail', 'en', 'Invalid zone detail specification, should be a non-empty string'), +('Web.Fees.InvalidZoneDetail', 'de', 'Ungültige Zonendetailbeschreibung, bitte geben Sie einen Text ein'), +('Web.Fees.InvalidZoneDetail', 'es', 'Detalle de zona especificada no válida. Debe ser una cadena de caracteres no vacía.'), +('Web.Fees.InvalidZoneDetail', 'fr', 'Invalid Spécification de zone, doit être une chaîne non vide.'), +('Web.Fees.InvalidRate', 'en', 'Invalid rate specification, should be a floating point number'), +('Web.Fees.InvalidRate', 'de', 'Ungültige Gebührenangabe, bitte geben Sie eine Gleitpunktzahl ein'), +('Web.Fees.InvalidRate', 'es', 'Campo rate inválido. Debe ser un número flotante.'), +('Web.Fees.InvalidRate', 'fr', 'Invalid spécification du taux, devrait être un nombre à virgule flottante'), +('Web.Fees.InvalidInterval', 'en', 'Invalid interval specification, should be an integer'), +('Web.Fees.InvalidInterval', 'de', 'Ungültige Intervallangabe, bitte geben Sie eine Ganzzahl ein'), +('Web.Fees.InvalidInterval', 'es', 'Intervalo especificado inválido. Debe ser un número entero.'), +('Web.Fees.InvalidInterval', 'fr', 'Invalide la spécification d'intervalle, doit être un entier'), +('Client.Syntax.InvalidYear', 'en', 'Invalid year.'), +('Client.Syntax.InvalidYear', 'de', 'Ungültiges Jahr. '), +('Client.Syntax.InvalidYear', 'es', 'Invalid year.'), +('Client.Syntax.InvalidYear', 'fr', 'Invalid year.'), +('Client.Syntax.InvalidMonth', 'en', 'Invalid month.'), +('Client.Syntax.InvalidMonth', 'de', 'Ungültiges Monat.'), +('Client.Syntax.InvalidMonth', 'es', 'Invalid month.'), +('Client.Syntax.InvalidMonth', 'fr', 'Invalid month.'), +('Client.Syntax.InvalidMDay', 'en', 'Invalid day of month.'), +('Client.Syntax.InvalidMDay', 'de', 'Ungültiger Tag. '), +('Client.Syntax.InvalidMDay', 'es', 'Invalid day of month.'), +('Client.Syntax.InvalidMDay', 'fr', 'Invalid day of month.'), +('Client.Syntax.InvalidWDay', 'en', 'Invalid day of week.'), +('Client.Syntax.InvalidWDay', 'de', 'Ungültiger Wochentagl'), +('Client.Syntax.InvalidWDay', 'es', 'Invalid day of week.'), +('Client.Syntax.InvalidWDay', 'fr', 'Invalid day of week.'), +('Client.Syntax.InvalidHour', 'en', 'Invalid hour.'), +('Client.Syntax.InvalidHour', 'de', 'Ungültige Stunde.'), +('Client.Syntax.InvalidHour', 'es', 'Invalid hour.'), +('Client.Syntax.InvalidHour', 'fr', 'Invalid hour.'), +('Client.Syntax.InvalidMinute', 'en', 'Invalid minute.'), +('Client.Syntax.InvalidMinute', 'de', 'Ungültige Minute.'), +('Client.Syntax.InvalidMinute', 'es', 'Invalid minute.'), +('Client.Syntax.InvalidMinute', 'fr', 'Invalid minute.'), +('Client.Syntax.FromMissing', 'en', 'Beginning missing.'), +('Client.Syntax.FromMissing', 'de', 'Beginn fehlt.'), +('Client.Syntax.FromMissing', 'es', 'Beginning missing.'), +('Client.Syntax.FromMissing', 'fr', 'Beginning missing.'), +('Client.Syntax.FromAfterTo', 'en', 'Beginning after End.'), +('Client.Syntax.FromAfterTo', 'de', 'Beginn nach Ende.'), +('Client.Syntax.FromAfterTo', 'es', 'Beginning after End.'), +('Client.Syntax.FromAfterTo', 'fr', 'Beginning after End.'), +('Client.Syntax.EmptySetName', 'en', 'Setname can not be empty.'), +('Client.Syntax.EmptySetName', 'de', 'Setname darf nicht leer sein.'), +('Client.Syntax.EmptySetName', 'es', 'Setname can not be empty.'), +('Client.Syntax.EmptySetName', 'fr', 'Setname can not be empty.'), +('Client.Syntax.MissingDestinationSet', 'en', 'Please choose a destination set.'), +('Client.Syntax.MissingDestinationSet', 'de', 'Bitte wälhlen Sie eine Zielmenge.'), +('Client.Syntax.MissingDestinationSet', 'es', 'Please choose a destination set.'), +('Client.Syntax.MissingDestinationSet', 'fr', 'Please choose a destination set.'); diff --git a/db_scripts/diff/8000_adjust_billing_db.up b/db_scripts/diff/8000_adjust_billing_db.up new file mode 100644 index 00000000..be97efb8 --- /dev/null +++ b/db_scripts/diff/8000_adjust_billing_db.up @@ -0,0 +1,14 @@ +USE billing; + +ALTER TABLE billing_fees_history ADD KEY `zonehid_idx` (`billing_zones_history_id`); +ALTER TABLE billing_fees_history ADD CONSTRAINT `b_f_h_bzhid_ref` FOREIGN KEY (`billing_zones_history_id`) + REFERENCES `billing_zones_history` (`id`) + ON DELETE RESTRICT ON UPDATE CASCADE; + +ALTER TABLE voip_subscribers DROP FOREIGN KEY `v_s_pnumid_ref`; +ALTER TABLE voip_subscribers ADD CONSTRAINT `v_s_pnumid_ref` FOREIGN KEY (`primary_number_id`) REFERENCES `voip_numbers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +ALTER TABLE billing_fees AUTO_INCREMENT=1000; +ALTER TABLE billing_fees_history AUTO_INCREMENT=1000; +ALTER TABLE billing_zones AUTO_INCREMENT=1000; +ALTER TABLE billing_zones_history AUTO_INCREMENT=1000; diff --git a/db_scripts/init/0005_create_ngcp.down b/db_scripts/init/0005_create_ngcp.down new file mode 100644 index 00000000..185eca3d --- /dev/null +++ b/db_scripts/init/0005_create_ngcp.down @@ -0,0 +1,2 @@ +USE mysql; +DROP DATABASE IF EXISTS ngcp; diff --git a/db_scripts/init/0005_create_ngcp.up b/db_scripts/init/0005_create_ngcp.up new file mode 100644 index 00000000..f7d9f940 --- /dev/null +++ b/db_scripts/init/0005_create_ngcp.up @@ -0,0 +1,26 @@ +USE mysql; +DROP DATABASE IF EXISTS ngcp; + +CREATE DATABASE IF NOT EXISTS ngcp CHARACTER SET 'utf8'; + +USE ngcp; + +-- create schema tables + +CREATE TABLE `db_schema` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `revision` int(11) unsigned NOT NULL, + `node` varchar(64) NOT NULL, + `applied_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `rev_idx` (`revision`,`node`) +) ENGINE=InnoDB; + +CREATE TABLE `cfg_schema` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `revision` int(11) unsigned NOT NULL, + `node` varchar(64) NOT NULL, + `applied_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `rev_idx` (`revision`,`node`) +) ENGINE=InnoDB; diff --git a/db_scripts/language_strings/language_strings.txt b/db_scripts/language_strings/language_strings.txt new file mode 100644 index 00000000..5030e09f --- /dev/null +++ b/db_scripts/language_strings/language_strings.txt @@ -0,0 +1,570 @@ +101 Client.Billing.MalformedAmount de Bitte geben Sie einen ganzzahligen Betrag ein. +102 Client.Billing.MalformedAmount en Please specify the amount as an integral number. +103 Client.Billing.MalformedAmount es Por favor, especifique la cantidad como un número entero. +201 Client.Billing.NoPayType de Bitte wählen Sie eine Zahlungsweise aus. +202 Client.Billing.NoPayType en Please choose a payment type. +203 Client.Billing.NoPayType es Por favor, elija un método de pago. +301 Client.Syntax.Date de Bitte geben Sie ein gültiges Datum ein. +302 Client.Syntax.Date en Invalid date format. +303 Client.Syntax.Date es Formato de fecha inválido. +401 Client.Syntax.Email de Ungültige E-Mail Adresse. +402 Client.Syntax.Email en Invalid e-mail address. +403 Client.Syntax.Email es Dirección de correo inválida. +501 Client.Syntax.MalformedDomain de Ungültige Zeichen in der Domain. +502 Client.Syntax.MalformedDomain en Invalid characters in domain. +503 Client.Syntax.MalformedDomain es Caracteres inválidos en dominio. +601 Client.Syntax.MalformedTimezone de Ungültige Zeitzone, bitte verwenden Sie das "Kontinent/Hauptstadt" Format. +602 Client.Syntax.MalformedTimezone en Invalid timezone, please use "continent/capital" format. +603 Client.Syntax.MalformedTimezone es Zona horario inválida. Por favor, use la forma "continente/capital". +701 Client.Syntax.MalformedUsername de Ungültige Zeichen im Usernamen. +702 Client.Syntax.MalformedUsername en Invalid characters in username. +703 Client.Syntax.MalformedUsername es Caracteres inválidos en el nombre de usuario. +801 Client.Syntax.MissingDomain de Bitte geben Sie Ihren Usernamen inklusive Domain ein. +802 Client.Syntax.MissingDomain en Please enter username including domain. +803 Client.Syntax.MissingDomain es Por favor, introduzca el nombre de usuario incluyendo el dominio. +901 Client.Syntax.MissingTimezone de Bitte geben Sie eine Zeitzone ein. +902 Client.Syntax.MissingTimezone en Please enter a timezone. +903 Client.Syntax.MissingTimezone es Por favor, introduzca una zona horaria. +1001 Client.Syntax.MissingUsername de Bitte geben Sie einen Usernamen ein. +1002 Client.Syntax.MissingUsername en Please enter a username. +1003 Client.Syntax.MissingUsername es Por favor,introduzca un nombre de usuario. +1101 Client.Syntax.VoiceBoxPin de Bitte geben Sie 4 Ziffern ein oder lassen Sie das Feld leer. +1102 Client.Syntax.VoiceBoxPin en Please enter 4 digits, or leave the textfield empty. +1103 Client.Syntax.VoiceBoxPin es Por favor, introduzca 4 dígitos o deje el campo en blanco. +1201 Client.Voip.AssignedExtension de Die gewählte Durchwahl ist bereits vergeben. +1202 Client.Voip.AssignedExtension en This extension is already in use. +1203 Client.Voip.AssignedExtension es Esta extensión ya se encuentra en uso. +1301 Client.Voip.AssignedNumber de Die Telefonnummer ist nicht mehr verfügbar. +1302 Client.Voip.AssignedNumber en The specified telephonenumber is not available any more. +1303 Client.Voip.AssignedNumber es Este número ya no es válido. +1401 Client.Voip.AuthFailed de Login fehlgeschlagen, bitte überprüfen Sie Ihren Usernamen und Ihr Passwort. +1402 Client.Voip.AuthFailed en Login failed, please verify username and password. +1403 Client.Voip.AuthFailed es Acceso denegado. Por favor, compruebe el nombre de usuario y la contraseña. +1501 Client.Voip.ChooseNumber de Bitte wählen Sie eine Nummer aus der Liste. +1502 Client.Voip.ChooseNumber en Please select a number from the list. +1503 Client.Voip.ChooseNumber es Por favor, seleccione un número de la lista. +1601 Client.Voip.DeniedNumber de Die Telefonnummer ist nicht mehr verfügbar. +1602 Client.Voip.DeniedNumber en The specified telephonenumber is not available. +1603 Client.Voip.DeniedNumber es Este número no se encuentra disponible. +1701 Client.Voip.ExistingSubscriber de Dieser Username ist nicht mehr verfügbar. +1702 Client.Voip.ExistingSubscriber en This username is already in use. +1703 Client.Voip.ExistingSubscriber es El nombre de usuario ya se encuentra en uso. +1801 Client.Voip.ForwardSelect de Bitte wählen Sie unter welchen Umständen ein Anruf weitergeleitet werden soll. +1802 Client.Voip.ForwardSelect en Please select when to forward a call. +1803 Client.Voip.ForwardSelect es Por favor, seleccione cuándo desea reenviar llamadas. +1901 Client.Voip.IncorrectPass de Das Passwort ist nicht korrekt, bitte überprüfen Sie die Eingabe. +1902 Client.Voip.IncorrectPass en Wrong password, please verify your input. +1903 Client.Voip.IncorrectPass es Contraseña incorrecta. Por favor, verifique que la ha escrito correctamente. +2001 Client.Voip.InputErrorFound de Fehlende oder fehlerhafte Eingabedaten gefunden. +2002 Client.Voip.InputErrorFound en Missing or invalid input found. +2003 Client.Voip.InputErrorFound es Entrada inválida o ausente. +2101 Client.Voip.MalformedAc de Ungültige Ortsvorwahl, bitte geben Sie nur Ziffern, ohne führende Null ein. +2102 Client.Voip.MalformedAc en Invalid area code, please use digits only and don't enter a leading zero. +2103 Client.Voip.MalformedAc es Código de área erroneo. Por favor, use dígitos únicamente y no introduzca un cero inicial. +2201 Client.Voip.MalformedCc de Ungültige Ländervorwahl, bitte geben Sie nur Ziffern, ohne führende Nullen ein. +2202 Client.Voip.MalformedCc en Invalid country code, please use digits only, without leading zeros. +2203 Client.Voip.MalformedCc es Código de país erroneo. Por favor, use dígitos únicamente y no introduzca un cero inicial. +2301 Client.Voip.MalformedSn de Ungültige Rufnummer, bitte geben Sie nur Ziffern ein. (Die Nummer darf nicht mit Null beginnen.) +2302 Client.Voip.MalformedSn en Invalid subscriber number, please use digits only. (The number can not start with a zero.) +2303 Client.Voip.MalformedSn es Número de suscriptor inválido. Por favor, use dígitos unicamente. (El número no puede empezar por cero). +2401 Client.Voip.MalformedNumber de Ungültige Eingabe, bitte geben Sie Rufnummern numerisch und inklusive Vorwahl an. +2402 Client.Voip.MalformedNumber en Invalid number, please use digits only and include the area code. +2403 Client.Voip.MalformedNumber es Número inválido. Por favor, use dígitos únicamente e incluya el código de área. +2501 Client.Voip.MalformedNumberPattern de Ungültiger Eintrag, bitte verwenden Sie nur Ziffern und "?" bzw. "*" als Platzhalter für ein, bzw. beliebig viele Zeichen. +2502 Client.Voip.MalformedNumberPattern en Invalid entry, please use numbers only and "?" or "*" as placeholder for one or an arbitrary number of digits. +2503 Client.Voip.MalformedNumberPattern es Entrada inválida. Por favor, use dígitos únicamente y "?" o "*" como comodines para uno o un número arbitrario de dígitos. +2601 Client.Voip.MalformedTargetClass de Bitte wählen Sie ein Ziel. +2602 Client.Voip.MalformedTargetClass en Please choose a target. +2603 Client.Voip.MalformedTargetClass es Por favor, escoja un objetivo. +2701 Client.Voip.MalformedTarget de Ungültige Zielangabe, bitte verwenden Sie entweder nur Ziffern, oder geben Sie einen gültigen SIP User ein. +2702 Client.Voip.MalformedTarget en Invalid destination, please use digits only or enter a valid SIP URI. +2703 Client.Voip.MalformedTarget es Destino inválido. Por favor, use dígitos exclusivamente o introduzca una SIP URI válida. +2801 Client.Voip.MissingName de Bitte geben Sie zumindest Vor- oder Nachnamen ein. +2802 Client.Voip.MissingName en Please enter at least a first or last name. +2803 Client.Voip.MissingName es Por favor, introduzca al menos un nombre o un apellido. +2901 Client.Voip.MissingOldPass de Bitte geben Sie Ihr aktuelles Passwort ein. +2902 Client.Voip.MissingOldPass en Please enter your current password. +2903 Client.Voip.MissingOldPass es Por favor, introduzca su contraseña actual. +3001 Client.Voip.MissingPass2 de Bitte geben Sie das Passwort in beide Felder ein. +3002 Client.Voip.MissingPass2 en Please enter the password in both fields. +3003 Client.Voip.MissingPass2 es Por favor, introduzca la contraseña en ambos campos. +3101 Client.Voip.MissingPass de Bitte geben Sie ein Passwort ein. +3102 Client.Voip.MissingPass en Please enter a password. +3103 Client.Voip.MissingPass es Por favor, introduzca una contraseña. +3201 Client.Voip.MissingRingtimeout de Bitte wählen Sie die Zeitdauer nach der Anrufe weitergeleitet werden sollen. (In Sekunden, von 5 bis 300) +3202 Client.Voip.MissingRingtimeout en Please specify a timeout for incoming calls. (In seconds from 5 to 300.) +3203 Client.Voip.MissingRingtimeout es Por favor, especifique un tiempo límite para llamadas entrantes. (En segundos, en el rango de 5 a 300). +3301 Client.Voip.NoSuchDomain de Die angegebene Domain existiert nicht in der Datenbank. +3302 Client.Voip.NoSuchDomain en The specified domain does not exist. +3303 Client.Voip.NoSuchDomain es El dominio especificado no existe. +3401 Client.Voip.NoSuchNumber de Die Telefonnummer ist nicht verfügbar. +3402 Client.Voip.NoSuchNumber en The specified telephonenumber is not available. +3403 Client.Voip.NoSuchNumber es El número especificado no se encuentra disponible. +3501 Client.Voip.PassLength de Das Passwort ist zu kurz, bitte verwenden Sie mindestens 6 Zeichen. +3502 Client.Voip.PassLength en The passwod is too short, please use 6 characters at least. +3503 Client.Voip.PassLength es La contraseña es demasiado corta. Por favor use una de al menos 6 caracteres. +3601 Client.Voip.PassNoMatch de Die Passwörter stimmen nicht überein, bitte überprüfen Sie die Eingabe. +3602 Client.Voip.PassNoMatch en Passwords do not match, please try again. +3603 Client.Voip.PassNoMatch es Las contraseñas no coinciden. Por favor, inténtelo de nuevo. +3701 Client.Voip.ToManyPreference de Maximale Anzahl von Einträgen erreicht. +3702 Client.Voip.ToManyPreference en Maximum number of entries reached. +3703 Client.Voip.ToManyPreference es Alcanzado el número máximo de entradas. +3801 Server.Billing.Success de Ihr Konto wurde erfolgreich aufgeladen. +3802 Server.Billing.Success en Your account has been topped up successfully. +3803 Server.Billing.Success es Su cobro se ha realizado correctamente. +3901 Server.Internal de Ein interner Systemfehler ist aufgetreten, bitte versuchen Sie es später wieder. +3902 Server.Internal en Internal error, please try again later. +3903 Server.Internal es Se ha detectado un error interno. Por favor, inténtelo de nuevo más tarde. +4001 Server.Paypal.Error de Bitte folgen Sie den Anweisungen auf der PayPal Webseite um die Überweisung durchzuführen. +4002 Server.Paypal.Error en Please follow the instrutions on the PayPal website to transfer the credit. +4003 Server.Paypal.Error es Por favor, siga las instrucciones en la web de PayPal para realizar la transferencia. +4101 Server.Paypal.Fault de Fehler in der Kommunikation mit PayPal, bitte versuchen Sie es etwas später noch einmal. +4102 Server.Paypal.Fault en Communication error with PayPal server, please try again later. +4103 Server.Paypal.Fault es No se puede comunicar con el servidor de PayPal. Por favor, inténtelo de nuevo más tarde. +4201 Server.Paypal.Invalid de Fehler in der Kommunikation mit PayPal, bitte versuchen Sie es etwas später noch einmal. +4202 Server.Paypal.Invalid en Communication error with PayPal server, please try again later. +4203 Server.Paypal.Invalid es Ha ocurrido un error de comunicación con el servidor de PayPal. Por favor, inténtelo de nuevo más tarde. +4301 Server.Voip.RemovedContact de Der Kontakteintrag wurde gelöscht. +4302 Server.Voip.RemovedContact en The contact entry has been deleted. +4303 Server.Voip.RemovedContact es El contacto ha sido eliminado. +4401 Server.Voip.RemovedRegisteredContact de Die Registrierung wurde gelöscht. +4402 Server.Voip.RemovedRegisteredContact en The registered contact has been deleted. +4403 Server.Voip.RemovedRegisteredContact es El contacto ha sido eliminado. +4501 Server.Voip.RemovedVoicemail de Die Sprachnachricht wurde gelöscht. +4502 Server.Voip.RemovedVoicemail en The voicemail has been deleted. +4503 Server.Voip.RemovedVoicemail es El buzón de voz ha sido eliminado. +4601 Server.Voip.SavedContact de Der Kontakteintrag wurde gespeichert. +4602 Server.Voip.SavedContact en The contact entry bas been saved. +4603 Server.Voip.SavedContact es Contacto guardado correctamente. +4701 Server.Voip.SavedPass de Ihr Passwort wurde erfolgreich geändert. +4702 Server.Voip.SavedPass en The password has been changed successfully. +4703 Server.Voip.SavedPass es Su contraseña ha sido modificada correctamente. +4801 Server.Voip.SavedSettings de Ihre Einstellungen wurden gespeichert. +4802 Server.Voip.SavedSettings en Your settings have been saved. +4803 Server.Voip.SavedSettings es Sus preferencias han sido guardadas. +4901 Server.Voip.SubscriberCreated de Der Benutzer wurde gespeichert und kann jetzt konfiguriert werden. +4902 Server.Voip.SubscriberCreated en The user has been saved and may be configured. +4903 Server.Voip.SubscriberCreated es El usuario ha sido guardado y puede ser configurado. +5001 Server.Voip.SubscriberDeleted de Der Benutzer wurde gelöscht. +5002 Server.Voip.SubscriberDeleted en The user has been deleted. +5003 Server.Voip.SubscriberDeleted es El usuario ha sido eliminado. +5051 Server.System.RRDOpenError en Failed to open RRD file. +5052 Server.System.RRDOpenError de Fehler beim Öffnen der RRD-Datei. +5053 Server.System.RRDOpenError es No se ha podido abrir el ficherp RRD. +5061 Server.System.RRDBinmodeError en Failed to switch to BIN mode in RRD file. +5062 Server.System.RRDBinmodeError de Fehler beim Wechsel auf BIN mode in RRD-Datei. +5063 Server.System.RRDBinmodeError es No se ha podido pasar a modo BIN en el fichero RRD. +5071 Server.System.RRDReadError en Failed to read RRD file. +5072 Server.System.RRDReadError de Fehler beim Lesen der RRD-Datei. +5073 Server.System.RRDReadError es No se ha podido leer el fichero RRD. +5101 Web.Addressbook.Fax de Fax +5102 Web.Addressbook.Fax en Fax +5103 Web.Addressbook.Fax es Fax +5201 Web.Addressbook.Home de Privat +5202 Web.Addressbook.Home en Home +5203 Web.Addressbook.Home es Domicilio +5301 Web.Addressbook.Mobile de Mobil +5302 Web.Addressbook.Mobile en Mobile +5303 Web.Addressbook.Mobile es Móvil +5401 Web.Addressbook.Office de Büro +5402 Web.Addressbook.Office en Office +5403 Web.Addressbook.Office es Trabajo +5501 Web.MissingRedInput de Bitte füllen Sie alle rot umrandeten Felder aus. +5502 Web.MissingRedInput en Please fill in at least all red bordered input fields. +5503 Web.MissingRedInput es Por favor, rellene al menos todos los campos con borde rojo. +5601 Web.Months.01 de Jänner +5602 Web.Months.01 en January +5603 Web.Months.01 es Enero +5701 Web.Months.02 de Februar +5702 Web.Months.02 en February +5703 Web.Months.02 es Febrero +5801 Web.Months.03 de März +5802 Web.Months.03 en March +5803 Web.Months.03 es Marzo +5901 Web.Months.04 de April +5902 Web.Months.04 en April +5903 Web.Months.04 es Abril +6001 Web.Months.05 de Mai +6002 Web.Months.05 en May +6003 Web.Months.05 es Mayo +6101 Web.Months.06 de Juni +6102 Web.Months.06 en June +6103 Web.Months.06 es Junio +6201 Web.Months.07 de Juli +6202 Web.Months.07 en July +6203 Web.Months.07 es Julio +6301 Web.Months.08 de August +6302 Web.Months.08 en August +6303 Web.Months.08 es Agosto +6401 Web.Months.09 de September +6402 Web.Months.09 en September +6403 Web.Months.09 es Septiembre +6501 Web.Months.10 de Oktober +6502 Web.Months.10 en October +6503 Web.Months.10 es Octubre +6601 Web.Months.11 de November +6602 Web.Months.11 en November +6603 Web.Months.11 es Noviembre +6701 Web.Months.12 de Dezember +6702 Web.Months.12 en December +6703 Web.Months.12 es Diciembre +6801 Client.Syntax.AccountID de Ungültige ID, bitte verwenden Sie nur Ziffern. +6802 Client.Syntax.AccountID en Invalid ID, please use numbers only. +6803 Client.Syntax.AccountID es ID inválido. Por favor use dígitos exclusivamente. +6901 Client.Syntax.CashValue de Ungültiger Betrag, bitte geben Sie nur Ziffern ein, mit Beistrich oder Punkt als Dezimaltrenner. +6902 Client.Syntax.CashValue en Invalid amount, please use numbers only, with comma or dot as decimal separator. +6903 Client.Syntax.CashValue es Cantidad inválida. Por favor, use dígitos exclusivamente, con coma o punto como separador decimal. +7001 Client.Syntax.TimeValue de Ungültige Eingabe, bitte geben Sie eine ganze Zahl ein. +7002 Client.Syntax.TimeValue en Invalid input, please use numbers only. +7003 Client.Syntax.TimeValue es Entrada inválida. Por favor, use dígitos exclusivamente. +7101 Client.Syntax.LoginMissingUsername de Bitte geben Sie Ihren Usernamen ein. +7102 Client.Syntax.LoginMissingUsername en Please enter your username. +7103 Client.Syntax.LoginMissingUsername es Por favor, introduzca su nombre de usuario. +7201 Client.Syntax.LoginMissingPass de Bitte geben Sie Ihr Passwort ein. +7202 Client.Syntax.LoginMissingPass en Please enter your password. +7203 Client.Syntax.LoginMissingPass es Por favor, introduzca su contraseña. +7301 Client.Voip.NoSuchAccount de Der Account existiert nicht. +7302 Client.Voip.NoSuchAccount en This account does not exist. +7303 Client.Voip.NoSuchAccount es La cuenta no existe. +7401 Client.Voip.ExistingDomain de Diese Domain existiert bereits. +7402 Client.Voip.ExistingDomain en This domain already exists. +7403 Client.Voip.ExistingDomain es El dominio ya existe. +7501 Web.Domain.Created de Die Domain wurde gespeichert. +7502 Web.Domain.Created en The domain has been saved. +7503 Web.Domain.Created es El dominio ha sido guardado. +7601 Web.Domain.Deleted de Die Domain wurde gelöscht. +7602 Web.Domain.Deleted en The domain has been deleted. +7603 Web.Domain.Deleted es El dominio ha sido eliminado. +7701 Client.Admin.ExistingAdmin de Dieser username ist bereits in Verwendung. +7702 Client.Admin.ExistingAdmin en This username is already in use. +7703 Client.Admin.ExistingAdmin es El nombre de usuario ya se encuentra en uso. +7801 Client.Admin.NoSuchAdmin de Dieser Administrator existiert nicht. +7802 Client.Admin.NoSuchAdmin en This administrator does not exist. +7803 Client.Admin.NoSuchAdmin es El administrador no existe. +7901 Client.Syntax.MalformedLogin de Ungültig Zeichen im Loginnamen. Bitte verwenden Sie nur Buchstaben und Zahlen. +7902 Client.Syntax.MalformedLogin en Invalid characters in login name. Please use alphanumeric characters only. +7903 Client.Syntax.MalformedLogin es Caracteres inválidos en nombre de usuario. Por favor use únicamente caracteres alfanuméricos. +8001 Web.Admin.Created de Der Administrator wurde gespeichert. +8002 Web.Admin.Created en The administrator has been saved. +8003 Web.Admin.Created es El administrador ha sido guardado. +8101 Web.Admin.Deleted de Der Administrator wurde gelöscht. +8102 Web.Admin.Deleted en The administrator has been deleted. +8103 Web.Admin.Deleted es El administrador ha sido eliminado. +8201 Web.Account.Created de Der Account wurde gespeichert. +8202 Web.Account.Created en The account has been saved. +8203 Web.Account.Created es La cuenta ha sido guardada. +8301 Web.Payment.UnknownError de Bei der Initialisierung des Zahlvorgangs ist ein Fehler aufgetreten. Bitte versuchen Sie es etwas späeter nochmals und überprüfen Sie Ihre Eingaben. +8302 Web.Payment.UnknownError en Failed to initialize the transaction. Please try again later and verify your input. +8303 Web.Payment.UnknownError es Se ha detectado un error al inicial la transacción. Por favor, verifique los datos e inténtelo de nuevo más tarde. +8401 Web.Payment.HttpFailed de Der Payment Server konnte nicht erreicht werden. Bitte versuchen Sie es etwas später nochmals. +8402 Web.Payment.HttpFailed en The payment server could not be reached. Please try again later. +8403 Web.Payment.HttpFailed es Se ha detectado un error al intertar conectar con el servidor de pagos. Por favor, inténtelo de nuevo más tarde. +8501 Web.Syntax.Numeric de Ungültige Zahlenangabe, bitte verwenden Sie nur Ziffern. +8502 Web.Syntax.Numeric en Invalid number, please use numerics only. +8503 Web.Syntax.Numeric es Número inválido. Por favor, use números exclusivamente. +8601 Web.MissingContactInfo de Bitte selektieren Sie das Kästchen "wie oben", oder füllen Sie alle anderen Eingabefelder aus. +8602 Web.MissingContactInfo en Please check the box "like above" or fill in all additional input fields. +8603 Web.MissingContactInfo es Por favor, compruebe la casilla "como arriba" o rellene todos los campos adicionales. +8701 Web.MissingInput de Bitte füllen Sie alle Eingabefelder aus. +8702 Web.MissingInput en Please fill in all input fields. +8703 Web.MissingInput es Por favor, rellene todos los campos. +8801 Web.Subscriber.Lockforeign de Der Subscriber ist für ausgehende Anrufe die das System verlassen gesperrt. +8802 Web.Subscriber.Lockforeign en The subscriber is locked for calls that leave the system. +8803 Web.Subscriber.Lockforeign es El suscriptor tiene restringidas las llamadas salientes hacia fuera del sistema. +8901 Web.Subscriber.Lockoutgoing de Der Subscriber ist für ausgehende Anrufe gesperrt. +8902 Web.Subscriber.Lockoutgoing en The subscriber is locked for outgoing calls. +8903 Web.Subscriber.Lockoutgoing es El suscriptor tiene restringidas las llamadas salientes. +9001 Web.Subscriber.Lockincoming de Der Subscriber ist für eingehende und ausgehende Anrufe gesperrt. +9002 Web.Subscriber.Lockincoming en The subscriber is locked for incoming and outgoing calls. +9003 Web.Subscriber.Lockincoming es El suscriptor tiene restringidas las llamadas entrantes y salientes. +9101 Web.Subscriber.Lockglobal de Der Subscriber ist für alle Services gesperrt. +9102 Web.Subscriber.Lockglobal en The subscriber is locked for all services. +9103 Web.Subscriber.Lockglobal es El suscriptor tiene restringidos todos los servicios. +9201 Web.Payment.ExternalError de Der Zahlvorgang ist fehlgeschlagen. Bitte versuchen Sie es etwas späeter nochmals und befolgen Sie alle Anweisungen der externen Webseite. +9202 Web.Payment.ExternalError en The transaction failed. Please try again later and follow all instructions on the external website. +9203 Web.Payment.ExternalError es Se ha detectado un error externo al realizar la transacción. Por favor, inténtelo de nuevo más tarde y siga las instrucciones de la web externa. +9301 Client.Voip.NoGroupName de Bitte geben Sie einen Gruppennamen ein. +9302 Client.Voip.NoGroupName en Please provide a group name. +9303 Client.Voip.NoGroupName es Por favor, introduzca un nombre de grupo. +9401 Client.Voip.NoGroupExt de Bitte geben Sie eine numerische Gruppendurchwahl ein. +9402 Client.Voip.NoGroupExt en Please provide a numeric group extension. +9403 Client.Voip.NoGroupExt es Por favor, introduzca una extensión numérica de grupo. +9501 Client.Voip.MacInUse en MAC address is already in use. +9502 Client.Voip.MacInUse de MAC Adresse wird bereits verwendet. +9503 Client.Voip.MacInUse es La dirección MAC ya se encuentra en uso. +9601 Web.MissingSystem de Bitte wählen Sie die Nebenstellenanlage die Sie verwenden möchten. +9602 Web.MissingSystem en Please choose the IP PBX you want to use. +9603 Web.MissingSystem es Por favor, escoja la IP PBX que desea utilizar. +9701 Web.MissingAGB de Sie müssen den Allgemeinen Geschäftsbedingungen zustimmen. +9702 Web.MissingAGB en Please agree to our general terms and conditions. +9703 Web.MissingAGB es Por favor, acepte los términos y condiciones generales. +9801 Web.Account.Activated de Der account wurde aktiviert. +9802 Web.Account.Activated en The account has been activated. +9803 Web.Account.Activated es La cuenta ha sido activada. +9901 Client.Billing.AuthFailed de Login fehlgeschlagen, bitte überprüfen Sie Ihren Usernamen und Ihr Passwort. +9902 Client.Billing.AuthFailed en Login failed, please verify your username and password. +9903 Client.Billing.AuthFailed es Acceso fallido. Por favor, compruebe su usuario y contraseña. +10001 Web.MissingSearchString de Bitte geben Sie einen Suchstring ein. +10002 Web.MissingSearchString en Please enter a search string. +10003 Web.MissingSearchString es Por favor, introduzca un término de búsqueda. +10101 Client.Billing.ContactIncomplete de Bitte geben Sie zumindest einen Vornamen, Nachnamen oder Firmennamen ein. +10102 Client.Billing.ContactIncomplete en Please enter at least a firstname, lastname or company name. +10103 Client.Billing.ContactIncomplete es Por favor, introduzca el menos un nombre, un apellido o una compañía. +10201 Client.Billing.ExistingShopuser de Dieser Benutzername ist bereits in Verwendung. +10202 Client.Billing.ExistingShopuser en This username is already in use. +10203 Client.Billing.ExistingShopuser es Este usuario ya se encuentra en uso. +10301 Client.Billing.ExistingProduct de Ein Produkt mit diesem Produkt-Identifikator existiert bereits. +10302 Client.Billing.ExistingProduct en A product with this product-handle already exists. +10303 Client.Billing.ExistingProduct es Ya existe un producto con este identificador. +10401 Client.Billing.NoSuchProduct de Das Produkt mit dem angegebenen Produkt-Identifikator wurde nicht gefunden. +10402 Client.Billing.NoSuchProduct en No product with the specified product-handle found. +10403 Client.Billing.NoSuchProduct es No se han encontrado productos con el identificador especificado. +10501 Client.Billing.ExistingProfile de Ein Billing Profil mit dem angegebenen Profil-Identifikator existiert bereits. +10502 Client.Billing.ExistingProfile en A billing profile with the specified profile-handle already exists. +10503 Client.Billing.ExistingProfile es Ya existe un perfil de facturación con este identificador. +10601 Client.Billing.NoSuchProfile de Das Billing Profil mit dem angegebenen Profil-Identifikator wurde nicht gefunden. +10602 Client.Billing.NoSuchProfile en No billing profile with the specified profile-handle found. +10603 Client.Billing.NoSuchProfile es No se han encontrado perfiles de facturación con el identificador especificado. +10701 Web.Product.Created de Der Produkt-Eintrag wurde erstellt. +10702 Web.Product.Created en The product entry has been created. +10703 Web.Product.Created es El producto ha sido creado. +10801 Web.Product.Updated de Der Produkt-Eintrag wurde geändert. +10802 Web.Product.Updated en The product entry has been changed. +10803 Web.Product.Updated es El producto ha sido modificado. +10901 Web.Product.Deleted de Der Produkt-Eintrag wurde gelöscht. +10902 Web.Product.Deleted en The product entry has been deleted. +10903 Web.Product.Deleted es El producto ha sido eliminado. +11001 Web.Bilprof.Created de Das Billing Profil wurde erstellt. +11002 Web.Bilprof.Created en The billing profile has been created. +11003 Web.Bilprof.Created es El perfil de facturación ha sido creado. +11101 Web.Bilprof.Updated de Das Billing Profil wurde geändert. +11102 Web.Bilprof.Updated en The billing profile has been changed. +11103 Web.Bilprof.Updated es El perfil de facturación ha sido modificado. +11201 Web.Bilprof.Deleted de Das Billing Profil wurde gelöscht. +11202 Web.Bilprof.Deleted en The billing profile has been deleted. +11203 Web.Bilprof.Deleted es El perfil de facturación ha sido eliminado. +11301 Web.Fees.MissingFilename de Bitte geben Sie einen Dateinamen an. +11302 Web.Fees.MissingFilename en Please enter a filename. +11303 Web.Fees.MissingFilename es Por favor, inserte un nombre de fichero. +11401 Web.Fees.Fieldcount de Falsche Anzahl von Feldern +11402 Web.Fees.Fieldcount en Wrong number of elements +11403 Web.Fees.Fieldcount es Número incorrecto de elementos +11501 Web.Fees.FieldsFoundRequired de Felder gefunden/benötigt: +11502 Web.Fees.FieldsFoundRequired en Elements found/required: +11503 Web.Fees.FieldsFoundRequired es Elementos encontrados/requeridos: +11601 Web.Fees.InvalidDestination de Ungültiger Ziel-Präfix / -Suffix +11602 Web.Fees.InvalidDestination en Invalid destination prefix/suffix +11603 Web.Fees.InvalidDestination es Prefijo/sufijo de destino inválido. +11701 Client.Billing.NoSuchCustomer de Der angegebene Kunde existiert nicht. +11702 Client.Billing.NoSuchCustomer en The specified customer does not exist. +11703 Client.Billing.NoSuchCustomer es El cliente especificado no existe. +11801 Client.Syntax.MalformedDaytime de Ungültige Zeitangabe, bitte geben Sie Stunden, Minuten und Sekunden in der Form HH::MM::SS ein. +11802 Client.Syntax.MalformedDaytime en Invalid time specification, please enter hours, minutes and seconds in the form HH:MM:SS. +11803 Client.Syntax.MalformedDaytime es Formato horario inválido. Por favor, inserte horas, minutos y segundos en la forma HH:MM:SS. +11901 Web.Fees.SavedPeaktimes de Die Zeit-Einträge wurden aktualisiert. +11902 Web.Fees.SavedPeaktimes en The time-entries have been updated. +11903 Web.Fees.SavedPeaktimes es Las entradas de tiempos han sido actualizadas. +12001 Client.Voip.DuplicatedNumber de Eine Rufnummer wurde mehr als einmal angegeben. +12002 Client.Voip.DuplicatedNumber en A phone number was specified more than once. +12003 Client.Voip.DuplicatedNumber es Un número de teléfono ha sido especificado más de una vez. +12101 Client.Voip.SlotAlreadyExists de Der Kurzwahl-Eintrag ist bereits in Verwendung. +12102 Client.Voip.SlotAlreadyExists en The speed dial slot is already in use. +12103 Client.Voip.SlotAlreadyExists es La posición de marcación rápida ya está en uso. +12201 Client.Voip.SlotNotExistent en The speed dial slot does not exist. +12202 Client.Voip.SlotNotExistent de Der Kurzwahl-Eintrag ist nicht vorhanden. +12203 Client.Voip.SlotNotExistent es La posición de marcación rápida no existe. +12301 Client.Syntax.MalformedSpeedDialDestination en The speed dial slot destination is invalid. +12302 Client.Syntax.MalformedSpeedDialDestination de Das Ziel des Kurzwahl-Eintrag ist ungültig. +12303 Client.Syntax.MalformedSpeedDialDestination es La posición de marcación rápida escogida es inválida. +12401 Client.Syntax.MalformedVSC en The vertical service code (VSC) is invalid. +12402 Client.Syntax.MalformedVSC de Der VSC (vertical service code) ist ungültig. +12403 Client.Syntax.MalformedVSC es El código de servicio vertical (VSC) es inválido. +12501 Client.Syntax.MalformedIPNet en Malformed ipnet, please use dotted decimal notation and specify the mask as number of bits. +12502 Client.Syntax.MalformedIPNet de Ungültiges Netzwerk, bitte verwenden Sie die Dezimalschreibweise mit Punkt und geben Sie die Netzmaske als Anzahl von Bits an. +12503 Client.Syntax.MalformedIPNet es Sintáxis de red inválida. Por favor, use notación decimal y especifique la máscara como número de bits. +12601 Server.Voip.PeerGroupDeleted en The peering group has been deleted. +12602 Server.Voip.PeerGroupDeleted de Die Peering-Gruppe wurde gelöscht. +12603 Server.Voip.PeerGroupDeleted es El grupo de peering ha sido eliminado. +12701 Client.Voip.NoSuchPeerGroup en The peering group does not exist. +12702 Client.Voip.NoSuchPeerGroup de Die Peering-Gruppe existiert nicht. +12703 Client.Voip.NoSuchPeerGroup es El grupo de peering no existe. +12801 Client.Voip.ExistingPeerGroup en The peering group already exists. +12802 Client.Voip.ExistingPeerGroup de Die Peering-Gruppe existiert bereits. +12803 Client.Voip.ExistingPeerGroup es El grupo de peering ya existe. +12901 Client.Syntax.MalformedPeerGroupName en Invalid characters in peering group name. +12902 Client.Syntax.MalformedPeerGroupName de Ungültige Zeichen im Name der Peering-Gruppe. +12903 Client.Syntax.MalformedPeerGroupName es Encontrados caracteres inválidos en el nombre del grupo de peering. +13001 Client.Voip.NoSuchPeerRule en The peering rule does not exist. +13002 Client.Voip.NoSuchPeerRule de Die Peering-Regel existiert nicht. +13003 Client.Voip.NoSuchPeerRule es La regla de peering no existe. +13101 Client.Voip.NoSuchPeerHost en The peering host does not exist. +13102 Client.Voip.NoSuchPeerHost de Der Peering-Server existiert nicht. +13103 Client.Voip.NoSuchPeerHost es El servidor de peering no existe. +13201 Client.Voip.ExistingPeerHost en A peering host with this name already exists in this group. +13202 Client.Voip.ExistingPeerHost de Es existiert bereits ein Peering-Host dieses Namens in dieser Gruppe. +13203 Client.Voip.ExistingPeerHost es Ya existe un servidor de peering con este nombre. +13301 Client.Voip.NoSuchPeerRewriteRule en The peering rewrite rule does not exist. +13302 Client.Voip.NoSuchPeerRewriteRule de Die Peering-Rewrite-Regel existiert nicht. +13303 Client.Voip.NoSuchPeerRewriteRule es La regla de reescritura de peering no existe. +13401 Client.Voip.NoSuchDomainRewriteRule en The domain rewrite rule does not exist. +13402 Client.Voip.NoSuchDomainRewriteRule de Die Domain-Rewrite-Regel existiert nicht. +13403 Client.Voip.NoSuchDomainRewriteRule es La regla de reescritura de dominio no existe. +13501 Client.Voip.MalformedFaxDestination en 'destination' must be an email address or phone number. +13502 Client.Voip.MalformedFaxDestination de 'destination' muss eine E-Mail Adresse oder Telefonnummer enthalten. +13503 Client.Voip.MalformedFaxDestination es 'destino' ha de ser una dirección de correo o un número de teléfono. +13601 Client.Syntax.FaxPassLength en The password is to short, please use ${faxpw_min_char} characters at least. +13602 Client.Syntax.FaxPassLength de Das Passwort ist zu kurz, bitte verwenden Sie mindestens ${faxpw_min_char} Zeichen. +13603 Client.Syntax.FaxPassLength es La contraseña es demasiado corta. Por favor use al menos ${faxpw_min_char} caracteres. +13701 Web.Syntax.ID en Invalid ID, please enter a numeric value. +13702 Web.Syntax.ID de Ungültige ID, bitte geben Sie einen numerischen Wert ein. +13703 Web.Syntax.ID es ID inválido. Por favor, introduzca un valor numérico. +13801 Web.Syntax.LNPProvName en Please enter a provider name in the text field. +13802 Web.Syntax.LNPProvName de Bitte geben Sie einen Provider-Namen in das Textfeld ein. +13803 Web.Syntax.LNPProvName es Por favor, introduzca el nombre de un proveedor en el campo de texto. +13901 Web.LNPProvider.Created en The LNP provider has been created. +13902 Web.LNPProvider.Created de Der LNP Provider wurde erstellt. +13903 Web.LNPProvider.Created es El proveedor LNP ha sido creado. +14001 Web.LNPProvider.Updated en The LNP provider has been changed. +14002 Web.LNPProvider.Updated de Der LNP Provider wurde geändert. +14003 Web.LNPProvider.Updated es El proveedor LNP ha sido modificado. +14101 Web.LNPProvider.Deleted en The LNP provider has been deleted. +14102 Web.LNPProvider.Deleted de Der LNP Provider wurde gelöscht. +14103 Web.LNPProvider.Deleted es El proveedor LNP ha sido eliminado. +14201 Web.LNPNumber.Created en The LNP number has been stored. +14202 Web.LNPNumber.Created de Die LNP Nummer wurde gespeichert. +14203 Web.LNPNumber.Created es El número LNP ha sido guardado. +14301 Web.LNPNumber.Updated en The LNP number has been changed. +14302 Web.LNPNumber.Updated de Die LNP Nummer wurde geändert. +14303 Web.LNPNumber.Updated es El número LNP ha sido modificado. +14401 Web.LNPNumber.Deleted en The LNP number has been deleted. +14402 Web.LNPNumber.Deleted de Die LNP Nummer wurde gelöscht. +14403 Web.LNPNumber.Deleted es El número LNP ha sido eliminado. +14501 Client.Syntax.MalformedE164Number en Invalid E.164 number. Please use numbers only and include the international prefix. +14502 Client.Syntax.MalformedE164Number de Ungültige E.164 Nummer. Bitte verwenden Sie nur Zahlen und geben sie den internationalen Prefix mit an. +14503 Client.Syntax.MalformedE164Number es Número E.164 inválido. Por favor, use dígitos exclusivamente e incluya el prefijo internacional. +14601 Client.Syntax.MalformedDate en Invalid date, please check your syntax. +14602 Client.Syntax.MalformedDate de Ungültiges Datum, bitte überprüfen Sie die Syntax. +14603 Client.Syntax.MalformedDate es Fecha inválida. Por favor, revise la sintáxis. +14701 Client.Syntax.MissingNCOSLevel en Please specify an NCOS level identifier string. +14702 Client.Syntax.MissingNCOSLevel de Bitte geben Sie eine Bezeichnung für den NCOS Level an. +14703 Client.Syntax.MissingNCOSLevel es Por favor, especifique una cadena identificadora para el nivel NCOS. +14801 Client.NCOS.ExistingLevel en The NCOS level already exists. +14802 Client.NCOS.ExistingLevel de Die NCOS Level Bezeichnung existiert bereits. +14803 Client.NCOS.ExistingLevel es El nivel NCOS ya existe. +14901 Client.NCOS.NoSuchLevel en The NCOS level does not exist. +14902 Client.NCOS.NoSuchLevel de Die NCOS Level Bezeichnung existiert nicht. +14903 Client.NCOS.NoSuchLevel es El nivel NCOS no existe. +15001 Web.NCOSLevel.Created en The NCOS level has been created. +15002 Web.NCOSLevel.Created de Der NCOS Level wurde erstellt. +15003 Web.NCOSLevel.Created es El nivel NCOS ha sido creado. +15101 Web.NCOSLevel.Updated en The NCOS level has been changed. +15102 Web.NCOSLevel.Updated de Der NCOS Level wurde geändert. +15103 Web.NCOSLevel.Updated es El nivel NCOS ha sido modificado. +15201 Web.NCOSLevel.Deleted en The NCOS level has been deleted. +15202 Web.NCOSLevel.Deleted de Der NCOS Level wurde gelöscht. +15203 Web.NCOSLevel.Deleted es El nivel NCOS ha sido eliminado. +15301 Web.NCOSPattern.Created en The pattern has been stored. +15302 Web.NCOSPattern.Created de Der Filter wurde gespeichert. +15303 Web.NCOSPattern.Created es El patrón ha sido guardado. +15401 Web.NCOSPattern.Updated en The pattern has been replaced. +15402 Web.NCOSPattern.Updated de Der Filter wurde ersetzt. +15403 Web.NCOSPattern.Updated es El patrón ha sido modificado. +15501 Web.NCOSPattern.Deleted en The pattern has been deleted. +15502 Web.NCOSPattern.Deleted de Der Filter wurde entfernt. +15503 Web.NCOSPattern.Deleted es El patrón ha sido eliminado. +15601 Web.NCOSLNP.Created en The provider has been added to the list. +15602 Web.NCOSLNP.Created de Der LNP Provider wurde der Liste hinzugefügt. +15603 Web.NCOSLNP.Created es El proveedor ha sido añadido a la lista. +15701 Web.NCOSLNP.Updated en The provider has been updated. +15702 Web.NCOSLNP.Updated de Der LNP Provider wurde geändert. +15703 Web.NCOSLNP.Updated es El proveedor ha sido modificado. +15801 Web.NCOSLNP.Deleted en The provider has been removed from the list. +15802 Web.NCOSLNP.Deleted de Der LNP Provider wurde von der Liste entfernt. +15803 Web.NCOSLNP.Deleted es El proveedor ha sido eliminado de la lista. +15901 Client.Syntax.MalformedNCOSPattern en The pattern may not be empty, please specify a regular expression. +15902 Client.Syntax.MalformedNCOSPattern de Der Filter darf nicht leer sein, bitte geben Sie einen regulären Ausdruck an. +15903 Client.Syntax.MalformedNCOSPattern es El patrón podría no estar vacío. Por favor, introduzca una expresión regular. +16001 Client.Syntax.MalformedAudioData en Invalid audio data, please provide an audio stream in wave format. +16002 Client.Syntax.MalformedAudioData de Ungültige Audio-Daten, bitte geben Sie einen Stream im Wave-Format an. +16003 Client.Syntax.MalformedAudioData es Audio incorrecto. Por favor proporcione un flujo de audio en formato wav. +16101 Client.Voip.ExistingAudioFile en The audio file handle is already in use. +16102 Client.Voip.ExistingAudioFile de Der Audio-Datei-Identifikator wird bereits verwendet. +16103 Client.Voip.ExistingAudioFile es El fichero de audio ya está en uso. +16201 Client.Voip.NoSuchAudioFile en The audio file handle does not exist. +16202 Client.Voip.NoSuchAudioFile de Der Audio-Datei-Identifikator existiert noch nicht. +16203 Client.Voip.NoSuchAudioFile es El fichero de audio no existe. +16301 Web.AudioFile.Created en The audio file has been created. +16302 Web.AudioFile.Created de Die Audio-Datei wurde gespeichert. +16303 Web.AudioFile.Created es El fichero de audio ha sido creado. +16401 Web.AudioFile.Updated en The audio file has been changed. +16402 Web.AudioFile.Updated de Die Audio-Datei wurde geändert. +16403 Web.AudioFile.Updated es El fichero de audio ha sido modificado. +16501 Web.AudioFile.Deleted en The audio file has been deleted. +16502 Web.AudioFile.Deleted de Die Audio-Datei wurde gelöscht. +16503 Web.AudioFile.Deleted es El fichero de audio ha sido eliminado. +16601 Client.Syntax.MalformedHandle en Invalid handle, please specify an alpha-numeric string. +16602 Client.Syntax.MalformedHandle de Ungültiger Identifikator, bitte geben Sie eine alphanumerische Zeichenkette ein. +16603 Client.Syntax.MalformedHandle es Nombre incorrecto. Por favor use caracteres alfanuméricos exclusivamente. +16701 Client.VSC.NoSuchAction en The VSC action does not exist. +16702 Client.VSC.NoSuchAction de Die VSC Aktion existiert nicht. +16703 Client.VSC.NoSuchAction es La acción VSC no existe. +16801 Client.VSC.ExistingAction en The VSC action has already been defined. +16802 Client.VSC.ExistingAction de Die VSC Aktion wurde bereits definiert. +16803 Client.VSC.ExistingAction es La acción VSC ya ha sido definida. +16901 Client.VSC.ExistingDigits en The digits are already in use for another VSC action. +16902 Client.VSC.ExistingDigits de Die Zahlenkombination wird bereits für eine andere VSC Aktion verwendet. +16903 Client.VSC.ExistingDigits es Los dígitos ya se encuentran definidos para otra acción VSC. +17001 Client.Syntax.MalformedVSCDigits en Invalid VSC digits setting, please specify exactly two digits. +17002 Client.Syntax.MalformedVSCDigits de Ungültige Zahlenkombination, bitte geben Sie genau zwei Ziffern an. +17003 Client.Syntax.MalformedVSCDigits es Especificación de dígitos inválida. Por favor, especifica exactamente dos dígitos. +17101 Web.VSC.Created en The VSC entry has been created. +17102 Web.VSC.Created de Der VSC Eintrag wurde gespeichert. +17103 Web.VSC.Created es La entrada VSC ha sido creada. +17201 Web.VSC.Updated en The VSC entry has been changed. +17202 Web.VSC.Updated de Der VSC Eintrag wurde geändert. +17203 Web.VSC.Updated es La entrada VSC ha sido modificada. +17301 Web.VSC.Deleted en The VSC entry has been deleted. +17302 Web.VSC.Deleted de Der VSC Eintrag wurde gelöscht. +17303 Web.VSC.Deleted es La entrada VSC ha sido eliminada. +17401 Client.Voip.AudioFileInUse en The audio file is in use and can't be deleted. +17402 Client.Voip.AudioFileInUse de Die Audio-Datei wird verwendet und kann nicht gelöscht werden. +17403 Client.Voip.AudioFileInUse es El fichero de audio se encuentra actualmente en uso y no puede ser eliminado. +17501 Web.Contract.Created en The contract has been created. +17502 Web.Contract.Created de Der Vertrag wurde gespeichert. +17503 Web.Contract.Created es El contrato ha sido creado. +17601 Web.Contract.Updated en The contract has been changed. +17602 Web.Contract.Updated de Der Vertrag wurde geändert. +17603 Web.Contract.Updated es El contrato ha sido modificado. +17701 Web.Contract.Deleted en The contract has been deleted. +17702 Web.Contract.Deleted de Der Vertrag wurde gelöscht. +17703 Web.Contract.Deleted es El contrato ha sido eliminado. +17801 Web.NCOSLevel.LACSet en The caller's area code has been added to the list. +17802 Web.NCOSLevel.LACSet de Die Vorwahl des Anrufers wurde zur Liste hinzugefügt. +17803 Web.NCOSLevel.LACSet es El código de área de llamante ha sido añadido a la lista. +17901 Web.NCOSLevel.LACUnset en The caller's area code has been removed from the list. +17902 Web.NCOSLevel.LACUnset de Die Vorwahl des Anrufers wurde von der Liste entfernt. +17903 Web.NCOSLevel.LACUnset es El código de área de llamante ha sido eliminado de la lista. +18001 Web.NumberBlock.Created en The number block has been created. +18002 Web.NumberBlock.Created de Der Nummernblock wurde gespeichert. +18003 Web.NumberBlock.Created es El bloque de numeración ha sido creado. +18101 Web.NumberBlock.Updated en The number block has been changed. +18102 Web.NumberBlock.Updated de Der Nummernblock wurde geändert. +18103 Web.NumberBlock.Updated es El bloque de numeración ha sido modificado. +18201 Web.NumberBlock.Deleted en The number block has been deleted. +18202 Web.NumberBlock.Deleted de Der Nummernblock wurde gelöscht. +18203 Web.NumberBlock.Deleted es El bloque de numeración ha sido eliminado. +18301 Client.Syntax.MalformedReminderTime en Invalid time string, please use 'hh:mm' format. +18302 Client.Syntax.MalformedReminderTime de Ungültige Zeitangabe, bitte verwenden Sie das 'hh:mm' Format. +18303 Client.Syntax.MalformedReminderTime es Formato de tiempo inválido. Por favor, utilice el formato 'hh:mm'. +18401 Web.Fax.ExistingFaxDestination en This destination is already on the list. +18402 Web.Fax.ExistingFaxDestination de Dieses Destination steht bereits auf der Liste. +18403 Web.Fax.ExistingFaxDestination es Este destino ya se encuentra en la lista. +18501 Client.Voip.ReservedSubscriber en This username is reserved for internal use. +18502 Client.Voip.ReservedSubscriber de Dieser Username ist für interne Verwendung reserviert. +18503 Client.Voip.ReservedSubscriber es El nombre de usuario está reservado para uso interno. +18601 Server.Voip.NoProxy de Es wurde kein SIP Proxy für Click-To-Dial konfiguriert. +18602 Server.Voip.NoProxy en No SIP Proxy has been configured for click-to-dial. +18603 Server.Voip.NoProxy es No se ha configurado ningún proxy SIP para click-to-dial. +18701 Client.Fees.DuplicateDestination de Ein Ziel-Präfix / -Suffix wurde mehrfach angegeben. +18702 Client.Fees.DuplicateDestination en A destination prefix/suffix has been specified twice. +18703 Client.Fees.DuplicateDestination es Prefijo/sufijo de destino duplicado. diff --git a/db_scripts/language_strings/language_to_rev.pl b/db_scripts/language_strings/language_to_rev.pl new file mode 100755 index 00000000..b81929f8 --- /dev/null +++ b/db_scripts/language_strings/language_to_rev.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl -w +use strict; + +print "converting language_strings.txt to language_strings.rev\n"; + +open my $fr, "<", "language_strings.txt" or die "failed to open language_strings.txt: $!\n"; +open my $fw, ">", "language_strings.rev" or die "failed to open language_strings.rev: $!\n"; + +print $fw "USE provisioning;\n\n"; +print $fw "TRUNCATE TABLE language_strings;\n\n"; +print $fw "INSERT INTO language_strings (code, language, string) VALUES\n"; +my $first = 1; +while(<$fr>) { + chomp; + my ($id, $code, $lang, $str) = /^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/; + next unless (defined $id && defined $code && defined $lang && defined $str); + print $fw ",\n" unless $first; + print $fw "('$code', '$lang', '$str')"; + $first = 0; +} +print $fw ";\n"; + +close $fr; +close $fw; + +print "done\n"; diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..2e1f161f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +ngcp-db-schema (0.1) unstable; urgency=low + + * Initial release. + + -- Michael Prokop Thu, 26 Aug 2010 17:19:32 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..7ed6ff82 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..65363e25 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: ngcp-db-schema +Section: admin +Priority: extra +Maintainer: Sipwise Development Team +Build-Depends: debhelper (>= 5) +Standards-Version: 3.9.3 +Homepage: http://sipwise.com/ + +Package: ngcp-db-schema +Architecture: all +Depends: ${misc:Depends} +Description: TODO + TODO diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..6af14032 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,23 @@ +Upstream Author: The Sipwise Team - http://sipwise.com +Copyright: 2012, Sipwise GmbH, Austria +License: GPL-3+ + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more + details. + . + You should have received a copy of the GNU General Public + License along with this package; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301 USA + . + On Debian systems, the full text of the GNU General Public + License version 3 can be found in the file + `/usr/share/common-licenses/GPL-3'. diff --git a/debian/ngcp-db-schema.install b/debian/ngcp-db-schema.install new file mode 100644 index 00000000..f7be7ad1 --- /dev/null +++ b/debian/ngcp-db-schema.install @@ -0,0 +1,3 @@ +db_scripts usr/share/ngcp-db-schema/ +ngcp-check-rev-applied usr/sbin/ +ngcp-update-db-schema usr/sbin/ diff --git a/debian/ngcp-db-schema.manpages b/debian/ngcp-db-schema.manpages new file mode 100644 index 00000000..08fde833 --- /dev/null +++ b/debian/ngcp-db-schema.manpages @@ -0,0 +1 @@ +ngcp-check-rev-applied.1 diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 00000000..8f4b6cd4 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,25 @@ +#!/bin/sh +# postinst script for ngcp-db-schema + +set -e + +case "$1" in + configure) + echo TODO + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..2fe15a8a --- /dev/null +++ b/debian/rules @@ -0,0 +1,60 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +# export DH_VERBOSE=1 + +b=$(CURDIR)/debian/build + +build: build-stamp + +build-stamp: + dh_testdir + pod2man ./ngcp-check-rev-applied > ./ngcp-check-rev-applied.1 + touch $@ + +clean: + dh_testdir + dh_testroot + rm -rf build-stamp $(b) + dh_auto_clean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + +%: + @echo "--- Building: $@" + dh_installdirs -p$@ -P$(b)/$@ + dh_link -p$@ -P$(b)/$@ + dh_installdocs -p$@ -P$(b)/$@ + dh_installman -p$@ -P$(b)/$@ + dh_installchangelogs -p$@ -P$(b)/$@ + dh_install -p$@ -P$(b)/$@ + dh_link -p$@ -P$(b)/$@ + dh_strip -p$@ -P$(b)/$@ + dh_compress -p$@ -P$(b)/$@ + dh_fixperms -p$@ -P$(b)/$@ + dh_makeshlibs -p$@ -P$(b)/$@ -V + dh_installdeb -p$@ -P$(b)/$@ + dh_shlibdeps -p$@ -P$(b)/$@ + dh_installdebconf -p$@ -P$(b)/$@ + dh_gencontrol -p$@ -P$(b)/$@ + dh_md5sums -p$@ -P$(b)/$@ + dh_builddeb -p$@ -P$(b)/$@ + +binary-all: build install + +binary-indep: build install \ + ngcp-db-schema + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..d3827e75 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/ngcp-check-rev-applied b/ngcp-check-rev-applied new file mode 100755 index 00000000..0e6eecec --- /dev/null +++ b/ngcp-check-rev-applied @@ -0,0 +1,170 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; +use DBI; +use Getopt::Long; +use Pod::Usage; + +my $dbhost = 'localhost'; +my $dbname = 'ngcp'; +my $debug = 0; +my $help = 0; +my $man = 0; +my $node = undef; +my $revision = undef; +my $schema = undef; + +GetOptions( + 'dbhost=s' => \$dbhost, + 'dbname=s' => \$dbname, + 'debug|d' => \$debug, + 'help|?' => \$help, + 'man' => \$man, + 'node=s' => \$node, + 'revision=s' => \$revision, + 'schema=s' => \$schema, +) or pod2usage(2); + +pod2usage(-exitval => 2, -verbose => 0) if $help; +pod2usage(-exitval => 2, -verbose => 2) if $man; +pod2usage(2) if !defined $revision; +pod2usage(2) if !defined $schema; + +my $dbh = DBI->connect("dbi:mysql:dbname=$dbname;host=$dbhost") + or die "Couldn't connect to database: " . DBI->errstr; + +$schema = $dbh->quote_identifier($schema); + +my $sql_clause = ""; # if no node is specified then use empty SQL statement +if (defined $node) { + $sql_clause = "and node = ?"; +} + +my $sth = $dbh->prepare("SELECT * FROM $schema WHERE revision = ? $sql_clause") + or die "Couldn't prepare statement: " . $dbh->errstr; + +$sth->bind_param(1, $revision); +if (defined $node) { + $sth->bind_param(2, $node); +} +$sth->execute() + or die "Couldn't execute statement: " . $sth->errstr; + +if ($sth->rows == 0) { + if (defined $node) { + print STDERR "No match for revision $revision on host $node.\n" if $debug; + exit(1); + } else { + print STDERR "No match for revision $revision.\n" if $debug; + exit(1); + } +} else { + # DBI::dump_results($sth) if $debug; + my @data; + while (@data = $sth->fetchrow_array()) { + my $id = $data[1]; + my $hostname = $data[2]; + print "revision $id already executed on $hostname\n" if $debug; + } +} + +$sth->finish; +$dbh->disconnect; + +__END__ + +=head1 NAME + +ngcp-check-rev-applied - check which db/config revisions have been executed + +=head1 SYNOPSIS + +ngcp-check-rev-applied --schema --revision + [--node ] [--dbname ] [--dbhost ] + +=head1 DESCRIPTION + +This program queries the ngcp database to check for db/config revisions that +have been applied. If the specified ID is present the exit code is 0, otherwise +(the specified ID is not present) the exit code is 1. + +=head1 USAGE EXAMPLES + +=over 8 + +=item Check db_schema table for revision 23: + + ngcp-check-rev-applied --schema db_schema --revision 23 + +=item Check cfg_schema table for revision 42 and use output of `hostname` +to limit the specified ID to the current host: + + ngcp-check-rev-applied --schema cfg_schema --revision 42 --node $(hostname) + +=back + +=head1 EXIT_CODES + +=over 8 + +=item B<0> + +The requested ID is present. + +=item B<1> + +The requested ID is *NOT* present. + +=item B<2> + +Error or invalid usage of command line options. + +=item B<255> + +Error while running database query. + +=back + +=head1 OPTIONS + +=over 8 + +=item B<--dbhost> + +Query specified host instead of the default (being "localhost"). + +=item B<--dbname> + +Use specified database instead of the default (being "ngcp"). + +=item B<--debug> + +Be more verbose during execution. + +=item B<--help> + +Print help message and exit. + +=item B<--man> + +Display manpage using pod2man. + +=item B<--node> + +Restrict querying ID to specified node name. +This is relevant only in high availability environments +to check for (non-)replicated revisions. + +=item B<--revision> + +Query database for specified ID. + +=item B<--schema> + +Use specified schema as table name to look for specified ID. +Supported table names: cfg_schema, db_schema + +=back + +=cut diff --git a/ngcp-check-rev-applied.1 b/ngcp-check-rev-applied.1 new file mode 100644 index 00000000..d876121b --- /dev/null +++ b/ngcp-check-rev-applied.1 @@ -0,0 +1,197 @@ +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "NGCP-CHECK-REV-APPLIED 1" +.TH NGCP-CHECK-REV-APPLIED 1 "2012-03-16" "perl v5.14.2" "User Contributed Perl Documentation" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +ngcp\-check\-rev\-applied \- check which db/config revisions have been executed +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +ngcp-check-rev-applied \-\-schema \-\-revision + [\-\-node ] [\-\-dbname ] [\-\-dbhost ] +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This program queries the ngcp database to check for db/config revisions that +have been applied. If the specified \s-1ID\s0 is present the exit code is 0, otherwise +(the specified \s-1ID\s0 is not present) the exit code is 1. +.SH "USAGE EXAMPLES" +.IX Header "USAGE EXAMPLES" +.IP "Check db_schema table for revision 23:" 8 +.IX Item "Check db_schema table for revision 23:" +.Vb 1 +\& ngcp\-check\-rev\-applied \-\-schema db_schema \-\-revision 23 +.Ve +.IP "Check cfg_schema table for revision 42 and use output of `hostname` to limit the specified \s-1ID\s0 to the current host:" 8 +.IX Item "Check cfg_schema table for revision 42 and use output of `hostname` to limit the specified ID to the current host:" +.Vb 1 +\& ngcp\-check\-rev\-applied \-\-schema cfg_schema \-\-revision 42 \-\-node $(hostname) +.Ve +.SH "EXIT_CODES" +.IX Header "EXIT_CODES" +.IP "\fB0\fR" 8 +.IX Item "0" +The requested \s-1ID\s0 is present. +.IP "\fB1\fR" 8 +.IX Item "1" +The requested \s-1ID\s0 is *NOT* present. +.IP "\fB2\fR" 8 +.IX Item "2" +Error or invalid usage of command line options. +.IP "\fB255\fR" 8 +.IX Item "255" +Error while running database query. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-\-dbhost\fR " 8 +.IX Item "--dbhost " +Query specified host instead of the default (being \*(L"localhost\*(R"). +.IP "\fB\-\-dbname\fR " 8 +.IX Item "--dbname " +Use specified database instead of the default (being \*(L"ngcp\*(R"). +.IP "\fB\-\-debug\fR" 8 +.IX Item "--debug" +Be more verbose during execution. +.IP "\fB\-\-help\fR" 8 +.IX Item "--help" +Print help message and exit. +.IP "\fB\-\-man\fR" 8 +.IX Item "--man" +Display manpage using pod2man. +.IP "\fB\-\-node\fR " 8 +.IX Item "--node " +Restrict querying \s-1ID\s0 to specified node name. +This is relevant only in high availability environments +to check for (non\-)replicated revisions. +.IP "\fB\-\-revision\fR " 8 +.IX Item "--revision " +Query database for specified \s-1ID\s0. +.IP "\fB\-\-schema\fR " 8 +.IX Item "--schema " +Use specified schema as table name to look for specified \s-1ID\s0. +Supported table names: cfg_schema, db_schema diff --git a/ngcp-update-db-schema b/ngcp-update-db-schema new file mode 100755 index 00000000..145695b0 --- /dev/null +++ b/ngcp-update-db-schema @@ -0,0 +1,64 @@ +#!/bin/bash + +hostname="$(hostname)" + +/etc/init.d/mysql start || true +. /etc/mysql/sipwise.cnf + +if ! mysql -usipwise -p${SIPWISE_DB_PASSWORD} -e 'use ngcp;' 2>/dev/null ; then + mysql -usipwise -p${SIPWISE_DB_PASSWORD} < /usr/share/ngcp-db-schema/init/0005_create_ngcp.up +fi + +if ! mysql -usipwise -p${SIPWISE_DB_PASSWORD} -e 'use ngcp;' 2>/dev/null ; then + echo 'Error: ngcp database does not exist.' >&2 + exit 1 +fi + +if ! mysql -usipwise -p${SIPWISE_DB_PASSWORD} ngcp -e 'describe db_schema' >/dev/null; then + echo 'Error: db_schema table does not exit.' >&2 + exit 1 +fi + +if [ -x /usr/sbin/ngcp-check_active ] ; then + if /usr/sbin/ngcp-check_active -q ; then + echo "This seems to be the active node, registering revisions." + else + # TODO - is this really true? what about /usr/share/ngcp-upgrade-2.4/db/5670.up? + echo "This does not seem to be the active node, nothing to do." + exit 0 + fi +fi + +revision_wrapper() { + [ -n "$1" ] || return 1 + + for rev in $* ; do + revname="$(basename $rev)" + + if ngcp-check-rev-applied --schema db_schema --revision "$revname" ; then + echo "Revision $revname has been applied already, nothing to do." + continue + fi + + printf "Applying revision script %s: " "$rev" + if mysql -usipwise -p${SIPWISE_DB_PASSWORD} < "$rev" ; then + echo done + else + echo "failed. :(" + exit 1 + fi + + if mysql -usipwise -p${SIPWISE_DB_PASSWORD} ngcp -e "insert into db_schema values (0, '${revname}', \""${hostname}"\", CURRENT_TIMESTAMP);" ; then + echo "Marked revision $rev for being applied." + else + echo "Error while executing DB commands using revision $rev for host $hostname" >&2 + exit 1 + fi + done +} + +revision_wrapper /usr/share/ngcp-db-schema/db_scripts/base/*.up +revision_wrapper /usr/share/ngcp-db-schema/db_scripts/diff/*.up +# TODO language_wrapper + +## END OF FILE #################################################################