diff --git a/schema/dump.db b/schema/dump.db new file mode 100644 index 00000000..efc323cf --- /dev/null +++ b/schema/dump.db @@ -0,0 +1,5361 @@ +-- MySQL dump 10.13 Distrib 5.1.57, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: Syslog +-- ------------------------------------------------------ +-- Server version 5.1.57-rel12.8-log + +/*!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 */; + +-- +-- Current Database: `Syslog` +-- + +/*!40000 DROP DATABASE IF EXISTS `Syslog`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `Syslog` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `Syslog`; + +-- +-- Table structure for table `SystemEvents` +-- + +DROP TABLE IF EXISTS `SystemEvents`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `SystemEvents` ( + `ID` int(10) 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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `SystemEventsProperties` +-- + +DROP TABLE IF EXISTS `SystemEventsProperties`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `SystemEventsProperties` ( + `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, + `SystemEventID` int(11) DEFAULT NULL, + `ParamName` varchar(255) DEFAULT NULL, + `ParamValue` text, + PRIMARY KEY (`ID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `accounting` +-- + +/*!40000 DROP DATABASE IF EXISTS `accounting`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `accounting` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `accounting`; + +-- +-- Table structure for table `acc` +-- + +DROP TABLE IF EXISTS `acc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `acc_backup` +-- + +DROP TABLE IF EXISTS `acc_backup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `acc_backup` ( + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `acc_trash` +-- + +DROP TABLE IF EXISTS `acc_trash`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `acc_trash` ( + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cdr` +-- + +DROP TABLE IF EXISTS `cdr`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mark` +-- + +DROP TABLE IF EXISTS `mark`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `prepaid_costs` +-- + +DROP TABLE IF EXISTS `prepaid_costs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `billing` +-- + +/*!40000 DROP DATABASE IF EXISTS `billing`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `billing` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `billing`; + +-- +-- Table structure for table `admins` +-- + +DROP TABLE IF EXISTS `admins`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `admins` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned DEFAULT NULL, + `login` varchar(31) NOT NULL, + `md5pass` char(32) DEFAULT NULL, + `is_master` tinyint(1) NOT NULL DEFAULT '0', + `is_superuser` tinyint(1) NOT NULL DEFAULT '0', + `is_active` tinyint(1) NOT NULL DEFAULT '1', + `read_only` tinyint(1) NOT NULL DEFAULT '0', + `show_passwords` tinyint(1) NOT NULL DEFAULT '1', + `call_data` tinyint(1) NOT NULL DEFAULT '0', + `lawful_intercept` tinyint(1) NOT NULL DEFAULT '0', + 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 AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `billing_fees` +-- + +DROP TABLE IF EXISTS `billing_fees`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_fees` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `billing_profile_id` int(11) unsigned NOT NULL, + `billing_zone_id` int(11) unsigned DEFAULT 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` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `profdestype_idx` (`billing_profile_id`,`destination`,`type`), + KEY `profileid_idx` (`billing_profile_id`), + KEY `zoneid_idx` (`billing_zone_id`), + CONSTRAINT `b_f_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) REFERENCES `billing_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `b_f_zoneid_ref` FOREIGN KEY (`billing_zone_id`) REFERENCES `billing_zones` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `billing_fees_history` +-- + +DROP TABLE IF EXISTS `billing_fees_history`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_fees_history` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `bf_id` int(11) unsigned DEFAULT NULL, + `billing_profile_id` int(11) unsigned NOT NULL, + `billing_zones_history_id` int(11) unsigned DEFAULT 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` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `bfid_idx` (`bf_id`), + KEY `zonehid_idx` (`billing_zones_history_id`), + CONSTRAINT `b_f_h_bfid_ref` FOREIGN KEY (`bf_id`) REFERENCES `billing_fees` (`id`) ON DELETE SET NULL ON UPDATE NO ACTION, + CONSTRAINT `b_f_h_bzhid_ref` FOREIGN KEY (`billing_zones_history_id`) REFERENCES `billing_zones_history` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `billing_mappings` +-- + +DROP TABLE IF EXISTS `billing_mappings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_mappings` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `start_date` datetime DEFAULT NULL, + `end_date` datetime DEFAULT NULL, + `billing_profile_id` int(11) unsigned DEFAULT NULL, + `contract_id` int(11) unsigned NOT NULL, + `product_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `profileid_idx` (`billing_profile_id`), + KEY `contractid_idx` (`contract_id`), + KEY `productid_idx` (`product_id`), + CONSTRAINT `b_m_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) REFERENCES `billing_profiles` (`id`) ON UPDATE CASCADE, + CONSTRAINT `b_m_contractid_ref` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `b_m_productid_ref` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `billing_peaktime_special` +-- + +DROP TABLE IF EXISTS `billing_peaktime_special`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_peaktime_special` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `billing_profile_id` int(11) unsigned NOT NULL, + `start` datetime DEFAULT NULL, + `end` datetime DEFAULT NULL, + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `billing_peaktime_weekdays` +-- + +DROP TABLE IF EXISTS `billing_peaktime_weekdays`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_peaktime_weekdays` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `billing_profile_id` int(11) unsigned NOT NULL, + `weekday` tinyint(3) unsigned NOT NULL, + `start` time DEFAULT NULL, + `end` time DEFAULT NULL, + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `billing_profiles` +-- + +DROP TABLE IF EXISTS `billing_profiles`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_profiles` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned DEFAULT NULL, + `handle` varchar(63) NOT NULL, + `name` varchar(31) NOT NULL, + `prepaid` tinyint(1) NOT NULL DEFAULT '0', + `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 DEFAULT NULL, + `fraud_interval_lock` tinyint(3) unsigned DEFAULT NULL, + `fraud_interval_notify` varchar(255) DEFAULT NULL, + `currency` varchar(31) DEFAULT NULL, + `vat_rate` tinyint(3) unsigned DEFAULT NULL, + `vat_included` tinyint(1) NOT NULL DEFAULT '1', + 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 AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `billing_zones` +-- + +DROP TABLE IF EXISTS `billing_zones`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_zones` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `billing_profile_id` int(11) unsigned NOT NULL, + `zone` varchar(127) NOT NULL, + `detail` varchar(127) DEFAULT NULL, + 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 AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `billing_zones_history` +-- + +DROP TABLE IF EXISTS `billing_zones_history`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `billing_zones_history` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `bz_id` int(11) unsigned DEFAULT NULL, + `billing_profile_id` int(11) unsigned NOT NULL, + `zone` varchar(127) NOT NULL, + `detail` varchar(127) DEFAULT 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 AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `contacts` +-- + +DROP TABLE IF EXISTS `contacts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contacts` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `gender` enum('male','female') DEFAULT NULL, + `firstname` varchar(127) DEFAULT NULL, + `lastname` varchar(127) DEFAULT NULL, + `comregnum` varchar(31) DEFAULT NULL, + `company` varchar(127) DEFAULT NULL, + `street` varchar(127) DEFAULT NULL, + `postcode` int(6) DEFAULT NULL, + `city` varchar(127) DEFAULT NULL, + `country` char(2) DEFAULT NULL, + `phonenumber` varchar(31) DEFAULT NULL, + `mobilenumber` varchar(31) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `newsletter` tinyint(1) NOT NULL DEFAULT '0', + `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`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `contract_balances` +-- + +DROP TABLE IF EXISTS `contract_balances`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contract_balances` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `contract_id` int(11) unsigned NOT NULL, + `cash_balance` double DEFAULT NULL, + `cash_balance_interval` double NOT NULL DEFAULT '0', + `free_time_balance` int(11) DEFAULT NULL, + `free_time_balance_interval` int(11) NOT NULL DEFAULT '0', + `start` datetime NOT NULL, + `end` datetime NOT NULL, + `invoice_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `contractid_idx` (`contract_id`), + KEY `invoiceid_idx` (`invoice_id`), + CONSTRAINT `cb_invoiceid_ref` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `c_b_contractid_ref` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `contract_credits` +-- + +DROP TABLE IF EXISTS `contract_credits`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contract_credits` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `balance_id` int(11) unsigned NOT NULL, + `state` enum('init','transact','charged','failed','success') NOT NULL DEFAULT 'init', + `amount` double DEFAULT NULL, + `reason` text, + `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`), + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `contract_registers` +-- + +DROP TABLE IF EXISTS `contract_registers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contract_registers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `contract_id` int(11) unsigned NOT NULL, + `actor` varchar(15) DEFAULT NULL, + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `contracts` +-- + +DROP TABLE IF EXISTS `contracts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contracts` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int(11) unsigned DEFAULT NULL, + `reseller_id` int(11) unsigned DEFAULT NULL, + `contact_id` int(11) unsigned DEFAULT NULL, + `order_id` int(11) unsigned DEFAULT NULL, + `status` enum('pending','active','locked','terminated') NOT NULL DEFAULT 'active', + `external_id` varchar(255) 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', + `activate_timestamp` timestamp NULL DEFAULT NULL, + `terminate_timestamp` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `contactid_idx` (`contact_id`), + KEY `customerid_idx` (`customer_id`), + KEY `resellerid_idx` (`reseller_id`), + KEY `orderid_idx` (`order_id`), + KEY `externalid_idx` (`external_id`), + CONSTRAINT `co_contactid_ref` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `co_orderid_ref` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `co_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `c_customerid_ref` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `credit_payments` +-- + +DROP TABLE IF EXISTS `credit_payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `credit_payments` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `credit_id` int(11) unsigned NOT NULL, + `payment_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `creditid_idx` (`credit_id`), + KEY `paymentid_idx` (`payment_id`), + CONSTRAINT `cp_creditid_ref` FOREIGN KEY (`credit_id`) REFERENCES `contract_credits` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `cp_paymentid_ref` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `customer_registers` +-- + +DROP TABLE IF EXISTS `customer_registers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `customer_registers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int(11) unsigned NOT NULL, + `actor` varchar(15) DEFAULT NULL, + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `customers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned DEFAULT NULL, + `shopuser` varchar(31) DEFAULT NULL, + `shoppass` varchar(31) DEFAULT NULL, + `business` tinyint(1) NOT NULL DEFAULT '0', + `contact_id` int(11) unsigned DEFAULT NULL, + `tech_contact_id` int(11) unsigned DEFAULT NULL, + `comm_contact_id` int(11) unsigned DEFAULT NULL, + `external_id` varchar(255) 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 `reseller_id` (`reseller_id`,`shopuser`), + KEY `resellerid_idx` (`reseller_id`), + KEY `contactid_idx` (`contact_id`), + KEY `commcontactid_idx` (`comm_contact_id`), + KEY `techcontact_idx` (`tech_contact_id`), + KEY `externalid_idx` (`external_id`), + CONSTRAINT `cu_commcontactid_ref` FOREIGN KEY (`comm_contact_id`) REFERENCES `contacts` (`id`) ON UPDATE CASCADE, + CONSTRAINT `cu_contactid_ref` FOREIGN KEY (`contact_id`) REFERENCES `contacts` (`id`) ON UPDATE CASCADE, + CONSTRAINT `cu_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON UPDATE CASCADE, + CONSTRAINT `cu_techcontact_ref` FOREIGN KEY (`tech_contact_id`) REFERENCES `contacts` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `domain_resellers` +-- + +DROP TABLE IF EXISTS `domain_resellers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `domain_resellers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `domain_id` int(11) unsigned NOT NULL, + `reseller_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `domainid_idx` (`domain_id`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `dr_domainid_ref` FOREIGN KEY (`domain_id`) REFERENCES `domains` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `dr_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `domains` +-- + +DROP TABLE IF EXISTS `domains`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoices` +-- + +DROP TABLE IF EXISTS `invoices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lnp_numbers` +-- + +DROP TABLE IF EXISTS `lnp_numbers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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, + `start` datetime DEFAULT NULL, + `end` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `l_n_lnpproid_ref` (`lnp_provider_id`), + CONSTRAINT `l_n_lnpproid_ref` FOREIGN KEY (`lnp_provider_id`) REFERENCES `lnp_providers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lnp_providers` +-- + +DROP TABLE IF EXISTS `lnp_providers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `lnp_providers` ( + `id` int(11) unsigned NOT NULL, + `name` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ncos_levels` +-- + +DROP TABLE IF EXISTS `ncos_levels`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ncos_levels` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned DEFAULT NULL, + `level` varchar(31) NOT NULL, + `mode` enum('blacklist','whitelist') NOT NULL DEFAULT 'blacklist', + `local_ac` tinyint(1) NOT NULL DEFAULT '0', + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ncos_lnp_list` +-- + +DROP TABLE IF EXISTS `ncos_lnp_list`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ncos_lnp_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `ncos_level_id` int(11) unsigned NOT NULL, + `lnp_provider_id` int(11) unsigned NOT NULL, + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `levpro_idx` (`ncos_level_id`,`lnp_provider_id`), + KEY `c_l_l_lnpproid_ref` (`lnp_provider_id`), + CONSTRAINT `c_l_l_lnpproid_ref` FOREIGN KEY (`lnp_provider_id`) REFERENCES `lnp_providers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `c_l_l_ncoslevid_ref` FOREIGN KEY (`ncos_level_id`) REFERENCES `ncos_levels` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ncos_pattern_list` +-- + +DROP TABLE IF EXISTS `ncos_pattern_list`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ncos_pattern_list` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `ncos_level_id` int(11) unsigned NOT NULL, + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `order_payments` +-- + +DROP TABLE IF EXISTS `order_payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `order_payments` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `order_id` int(11) unsigned NOT NULL, + `payment_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `orderid_idx` (`order_id`), + KEY `paymentid_idx` (`payment_id`), + CONSTRAINT `op_orderid_ref` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `op_paymentid_ref` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orders` +-- + +DROP TABLE IF EXISTS `orders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orders` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned DEFAULT NULL, + `customer_id` int(11) unsigned DEFAULT NULL, + `delivery_contact_id` int(11) unsigned DEFAULT NULL, + `type` varchar(31) DEFAULT NULL, + `state` enum('init','transact','failed','success') NOT NULL DEFAULT 'init', + `value` int(11) DEFAULT NULL, + `shipping_costs` int(11) DEFAULT NULL, + `invoice_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', + `complete_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `customerid_idx` (`customer_id`), + KEY `resellerid_idx` (`reseller_id`), + KEY `contactid_idx` (`delivery_contact_id`), + KEY `invoiceid_idx` (`invoice_id`), + CONSTRAINT `o_contactid_ref` FOREIGN KEY (`delivery_contact_id`) REFERENCES `contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `o_customerid_ref` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `o_invoiceid_ref` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `o_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `payments` +-- + +DROP TABLE IF EXISTS `payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payments` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `amount` int(11) DEFAULT NULL, + `type` varchar(31) DEFAULT NULL, + `state` enum('init','transact','failed','success') DEFAULT NULL, + `mpaytid` int(11) unsigned DEFAULT NULL, + `status` varchar(31) DEFAULT NULL, + `errno` int(11) DEFAULT NULL, + `returncode` varchar(63) DEFAULT NULL, + `externalstatus` text, + `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`), + KEY `state_idx` (`state`), + KEY `mpaytid_idx` (`mpaytid`), + KEY `status_idx` (`status`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `products` +-- + +DROP TABLE IF EXISTS `products`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `products` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned DEFAULT NULL, + `class` enum('sippeering','pstnpeering','reseller','voip','hardware','auxiliary') NOT NULL, + `handle` varchar(63) NOT NULL, + `name` varchar(127) NOT NULL, + `on_sale` tinyint(1) NOT NULL DEFAULT '0', + `price` double DEFAULT NULL, + `weight` mediumint(9) unsigned DEFAULT NULL, + `billing_profile_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `resnam_idx` (`reseller_id`,`name`), + UNIQUE KEY `reshand_idx` (`reseller_id`,`handle`), + KEY `resellerid_idx` (`reseller_id`), + KEY `profileid_idx` (`billing_profile_id`), + CONSTRAINT `p_bilprofid_ref` FOREIGN KEY (`billing_profile_id`) REFERENCES `billing_profiles` (`id`) ON UPDATE CASCADE, + CONSTRAINT `p_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `resellers` +-- + +DROP TABLE IF EXISTS `resellers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `resellers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `contract_id` int(11) unsigned NOT NULL, + `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`), + CONSTRAINT `r_contractid_ref` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_intercept` +-- + +DROP TABLE IF EXISTS `voip_intercept`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_intercept` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reseller_id` int(11) unsigned DEFAULT NULL, + `LIID` int(11) unsigned DEFAULT NULL, + `number` varchar(63) DEFAULT NULL, + `cc_required` tinyint(1) NOT NULL DEFAULT '0', + `delivery_host` varchar(15) DEFAULT NULL, + `delivery_port` smallint(5) unsigned DEFAULT NULL, + `delivery_user` text, + `delivery_pass` text, + `modify_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `create_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `deleted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `resellerid_idx` (`reseller_id`), + KEY `number_idx` (`number`), + KEY `deleted_idx` (`deleted`), + CONSTRAINT `vi_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_number_block_resellers` +-- + +DROP TABLE IF EXISTS `voip_number_block_resellers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_number_block_resellers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `number_block_id` int(11) unsigned NOT NULL, + `reseller_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `numblockid_idx` (`number_block_id`), + KEY `resellerid_idx` (`reseller_id`), + CONSTRAINT `vnbr_numblockid_ref` FOREIGN KEY (`number_block_id`) REFERENCES `voip_number_blocks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `vnbr_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_number_blocks` +-- + +DROP TABLE IF EXISTS `voip_number_blocks`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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` tinyint(1) NOT NULL DEFAULT '0', + `authoritative` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `prefix_idx` (`cc`,`ac`,`sn_prefix`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_numbers` +-- + +DROP TABLE IF EXISTS `voip_numbers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT NULL, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `status` enum('active','reserved','locked','deported') NOT NULL DEFAULT 'active', + `ported` tinyint(1) NOT NULL DEFAULT '0', + `list_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `number_idx` (`cc`,`ac`,`sn`), + KEY `listts_idx` (`list_timestamp`), + KEY `resellerid_idx` (`reseller_id`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_n_resellerid_ref` FOREIGN KEY (`reseller_id`) REFERENCES `resellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `v_n_subscriberid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_subscribers` +-- + +DROP TABLE IF EXISTS `voip_subscribers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_subscribers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `contract_id` int(11) unsigned NOT NULL, + `uuid` char(36) NOT NULL, + `username` varchar(127) NOT NULL, + `domain_id` int(11) unsigned NOT NULL, + `status` enum('active','locked','terminated') NOT NULL DEFAULT 'active', + `primary_number_id` int(11) unsigned DEFAULT NULL, + `external_id` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uuid_idx` (`uuid`), + KEY `username_idx` (`username`), + KEY `contractid_idx` (`contract_id`), + KEY `domainid_idx` (`domain_id`), + KEY `pnumid_idx` (`primary_number_id`), + KEY `externalid_idx` (`external_id`), + CONSTRAINT `v_s_contractid_ref` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_s_domainid_ref` FOREIGN KEY (`domain_id`) REFERENCES `domains` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_s_pnumid_ref` FOREIGN KEY (`primary_number_id`) REFERENCES `voip_numbers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `carrier` +-- + +/*!40000 DROP DATABASE IF EXISTS `carrier`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `carrier` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `carrier`; + +-- +-- Table structure for table `contracts` +-- + +DROP TABLE IF EXISTS `contracts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contracts` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `external_id` varchar(255) DEFAULT NULL, + `url` varchar(31) DEFAULT NULL, + `customer_id` int(11) unsigned DEFAULT NULL, + `sip_uri` varchar(127) 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `credits` +-- + +DROP TABLE IF EXISTS `credits`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `credits` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `contract_id` int(11) unsigned NOT NULL, + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `customers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `external_id` varchar(255) DEFAULT NULL, + `url` varchar(31) NOT NULL, + `shopuser` varchar(31) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `shopuser_idx` (`shopuser`), + UNIQUE KEY `externalid_idx` (`external_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `interceptions` +-- + +DROP TABLE IF EXISTS `interceptions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `interceptions` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `url` varchar(31) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `numbers` +-- + +DROP TABLE IF EXISTS `numbers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `numbers` ( + `number` varchar(42) NOT NULL, + `subscriber_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orders` +-- + +DROP TABLE IF EXISTS `orders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orders` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int(11) unsigned NOT NULL, + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `payments` +-- + +DROP TABLE IF EXISTS `payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payments` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `order_id` int(11) unsigned DEFAULT NULL, + `credit_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `orderid_idx` (`order_id`), + KEY `creditid_idx` (`credit_id`), + CONSTRAINT `p_creditid_ref` FOREIGN KEY (`credit_id`) REFERENCES `credits` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `p_orderid_ref` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `subscribers` +-- + +DROP TABLE IF EXISTS `subscribers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `subscribers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `external_id` varchar(255) DEFAULT NULL, + `username` varchar(127) NOT NULL, + `domain` varchar(127) NOT NULL, + `webusername` varchar(127) DEFAULT NULL, + `contract_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `usrdom_idx` (`username`,`domain`), + UNIQUE KEY `domwebuser_idx` (`domain`,`webusername`), + UNIQUE KEY `externalid_idx` (`external_id`), + KEY `contractid_idx` (`contract_id`), + CONSTRAINT `s_contractid_ref` FOREIGN KEY (`contract_id`) REFERENCES `contracts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `kamailio` +-- + +/*!40000 DROP DATABASE IF EXISTS `kamailio`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `kamailio` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `kamailio`; + +-- +-- Table structure for table `acc` +-- + +DROP TABLE IF EXISTS `acc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `acc_backup` +-- + +DROP TABLE IF EXISTS `acc_backup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `acc_backup` ( + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `acc_trash` +-- + +DROP TABLE IF EXISTS `acc_trash`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `acc_trash` ( + `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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `address` +-- + +DROP TABLE IF EXISTS `address`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dbaliases` +-- + +DROP TABLE IF EXISTS `dbaliases`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dialog` +-- + +DROP TABLE IF EXISTS `dialog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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(20) NOT NULL, + `callee_cseq` varchar(20) 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', + `toroute_name` varchar(32) DEFAULT NULL, + `req_uri` varchar(128) NOT NULL, + PRIMARY KEY (`id`), + KEY `hash_idx` (`hash_entry`,`hash_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dialplan` +-- + +DROP TABLE IF EXISTS `dialplan`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dispatcher` +-- + +DROP TABLE IF EXISTS `dispatcher`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dom_preferences` +-- + +DROP TABLE IF EXISTS `dom_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `domain` +-- + +DROP TABLE IF EXISTS `domain`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fax_destinations` +-- + +DROP TABLE IF EXISTS `fax_destinations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fax_journal` +-- + +DROP TABLE IF EXISTS `fax_journal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fax_preferences` +-- + +DROP TABLE IF EXISTS `fax_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lcr_gw` +-- + +DROP TABLE IF EXISTS `lcr_gw`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lcr_rule` +-- + +DROP TABLE IF EXISTS `lcr_rule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lcr_rule_target` +-- + +DROP TABLE IF EXISTS `lcr_rule_target`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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_gwid_ref` FOREIGN KEY (`gw_id`) REFERENCES `lcr_gw` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `l_r_t_ruleid_ref` FOREIGN KEY (`rule_id`) REFERENCES `lcr_rule` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `location` +-- + +DROP TABLE IF EXISTS `location`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `peer_preferences` +-- + +DROP TABLE IF EXISTS `peer_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sems_registrations` +-- + +DROP TABLE IF EXISTS `sems_registrations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `speed_dial` +-- + +DROP TABLE IF EXISTS `speed_dial`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `subscriber` +-- + +DROP TABLE IF EXISTS `subscriber`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `trusted` +-- + +DROP TABLE IF EXISTS `trusted`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `usr_preferences` +-- + +DROP TABLE IF EXISTS `usr_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `version` +-- + +DROP TABLE IF EXISTS `version`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `version` ( + `table_name` varchar(32) NOT NULL, + `table_version` int(10) unsigned NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voicemail_spool` +-- + +DROP TABLE IF EXISTS `voicemail_spool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voicemail_users` +-- + +DROP TABLE IF EXISTS `voicemail_users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `ngcp` +-- + +/*!40000 DROP DATABASE IF EXISTS `ngcp`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `ngcp` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `ngcp`; + +-- +-- Table structure for table `cfg_schema` +-- + +DROP TABLE IF EXISTS `cfg_schema`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `db_schema` +-- + +DROP TABLE IF EXISTS `db_schema`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=98 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `provisioning` +-- + +/*!40000 DROP DATABASE IF EXISTS `provisioning`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `provisioning` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `provisioning`; + +-- +-- Table structure for table `language_strings` +-- + +DROP TABLE IF EXISTS `language_strings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=905 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_aig_sequence` +-- + +DROP TABLE IF EXISTS `voip_aig_sequence`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_aig_sequence` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_allowed_ip_groups` +-- + +DROP TABLE IF EXISTS `voip_allowed_ip_groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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`), + UNIQUE KEY `groupnet_idx` (`group_id`,`ipnet`), + KEY `groupid_idx` (`group_id`), + KEY `ipnet_idx` (`ipnet`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_audio_files` +-- + +DROP TABLE IF EXISTS `voip_audio_files`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_audio_files` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned DEFAULT NULL, + `domain_id` int(11) unsigned DEFAULT NULL, + `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_domainid_ref` FOREIGN KEY (`domain_id`) REFERENCES `voip_domains` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_a_f_subscriberid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_cf_destination_sets` +-- + +DROP TABLE IF EXISTS `voip_cf_destination_sets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_cf_destinations` +-- + +DROP TABLE IF EXISTS `voip_cf_destinations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_cf_mappings` +-- + +DROP TABLE IF EXISTS `voip_cf_mappings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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`), + KEY `cfmap_time_ref` (`time_set_id`), + KEY `cfmap_dest_ref` (`destination_set_id`), + CONSTRAINT `cfmap_dest_ref` FOREIGN KEY (`destination_set_id`) REFERENCES `voip_cf_destination_sets` (`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 `v_cfmap_subid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_cf_periods` +-- + +DROP TABLE IF EXISTS `voip_cf_periods`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_cf_time_sets` +-- + +DROP TABLE IF EXISTS `voip_cf_time_sets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_contacts` +-- + +DROP TABLE IF EXISTS `voip_contacts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_contacts` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `firstname` varchar(127) DEFAULT NULL, + `lastname` varchar(127) DEFAULT NULL, + `company` varchar(127) DEFAULT NULL, + `phonenumber` varchar(31) DEFAULT NULL, + `homephonenumber` varchar(31) DEFAULT NULL, + `mobilenumber` varchar(31) DEFAULT NULL, + `faxnumber` varchar(31) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `homepage` varchar(255) DEFAULT NULL, + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_dbaliases` +-- + +DROP TABLE IF EXISTS `voip_dbaliases`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_dbaliases` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(127) NOT NULL, + `domain_id` int(11) unsigned NOT NULL, + `subscriber_id` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_dom_idx` (`username`,`domain_id`), + KEY `domainid_idx` (`domain_id`), + KEY `subscriberid_idx` (`subscriber_id`), + CONSTRAINT `v_da_domainid_ref` FOREIGN KEY (`domain_id`) REFERENCES `voip_domains` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_da_subscriberid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_dom_preferences` +-- + +DROP TABLE IF EXISTS `voip_dom_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_dom_preferences` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `domain_id` int(11) unsigned NOT NULL, + `attribute_id` int(11) unsigned NOT NULL, + `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_attributeid_ref` FOREIGN KEY (`attribute_id`) REFERENCES `voip_preferences` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_d_p_domainid_ref` FOREIGN KEY (`domain_id`) REFERENCES `voip_domains` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_domains` +-- + +DROP TABLE IF EXISTS `voip_domains`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 TRIGGER provisioning.voip_dom_crepl_trig AFTER INSERT ON voip_domains + FOR EACH ROW BEGIN + + INSERT INTO kamailio.domain (domain) VALUES(NEW.domain); + + END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 TRIGGER voip_dom_drepl_trig BEFORE DELETE ON voip_domains + FOR EACH ROW BEGIN + + DELETE FROM kamailio.domain WHERE domain = OLD.domain; + + + + DELETE FROM kamailio.dom_preferences WHERE domain = OLD.domain; + + DELETE FROM provisioning.voip_subscribers WHERE domain_id = OLD.id; + + END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_fax_destinations` +-- + +DROP TABLE IF EXISTS `voip_fax_destinations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_fax_destinations` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `destination` varchar(255) NOT NULL, + `filetype` enum('PS','TIFF','PDF','PDF14') NOT NULL DEFAULT 'TIFF', + `cc` tinyint(1) NOT NULL DEFAULT '0', + `incoming` tinyint(1) NOT NULL DEFAULT '1', + `outgoing` tinyint(1) NOT NULL DEFAULT '0', + `status` tinyint(1) NOT NULL DEFAULT '0', + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_fax_preferences` +-- + +DROP TABLE IF EXISTS `voip_fax_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_fax_preferences` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `password` varchar(64) DEFAULT NULL, + `name` varchar(64) DEFAULT NULL, + `active` tinyint(1) NOT NULL DEFAULT '0', + `send_status` tinyint(1) NOT NULL DEFAULT '1', + `send_copy` tinyint(1) NOT NULL DEFAULT '1', + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_peer_groups` +-- + +DROP TABLE IF EXISTS `voip_peer_groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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) DEFAULT NULL, + `peering_contract_id` int(11) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_peer_hosts` +-- + +DROP TABLE IF EXISTS `voip_peer_hosts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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; + + + + END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_peer_preferences` +-- + +DROP TABLE IF EXISTS `voip_peer_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_peer_preferences` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `peer_host_id` int(11) unsigned NOT NULL, + `attribute_id` int(11) unsigned NOT NULL, + `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_attributeid_ref` FOREIGN KEY (`attribute_id`) REFERENCES `voip_preferences` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_p_p_peerhostid_ref` FOREIGN KEY (`peer_host_id`) REFERENCES `voip_peer_hosts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_peer_rules` +-- + +DROP TABLE IF EXISTS `voip_peer_rules`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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; + + + + END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_preferences` +-- + +DROP TABLE IF EXISTS `voip_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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` tinyint(1) NOT NULL DEFAULT '0', + `dom_pref` tinyint(1) NOT NULL DEFAULT '0', + `peer_pref` tinyint(1) NOT NULL DEFAULT '0', + `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` tinyint(1) NOT NULL DEFAULT '0', + `description` text, + PRIMARY KEY (`id`), + UNIQUE KEY `attribute_idx` (`attribute`) +) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 TRIGGER voip_pref_drepl_trig BEFORE DELETE ON voip_preferences + FOR EACH ROW BEGIN + + + + 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_reminder` +-- + +DROP TABLE IF EXISTS `voip_reminder`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_rewrite_rule_sets` +-- + +DROP TABLE IF EXISTS `voip_rewrite_rule_sets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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; + + + + 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_rewrite_rules` +-- + +DROP TABLE IF EXISTS `voip_rewrite_rules`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_rwrs_sequence` +-- + +DROP TABLE IF EXISTS `voip_rwrs_sequence`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_rwrs_sequence` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `voip_speed_dial` +-- + +DROP TABLE IF EXISTS `voip_speed_dial`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_speed_dial` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `slot` varchar(64) NOT NULL, + `destination` varchar(192) NOT NULL, + PRIMARY KEY (`id`), + 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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_subscribers` +-- + +DROP TABLE IF EXISTS `voip_subscribers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_subscribers` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(127) NOT NULL, + `domain_id` int(11) unsigned NOT NULL, + `uuid` char(36) NOT NULL, + `password` varchar(40) DEFAULT NULL, + `admin` tinyint(1) NOT NULL DEFAULT '0', + `account_id` int(11) unsigned 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 AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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; + + + + DELETE FROM kamailio.voicemail_users WHERE customer_id = OLD.uuid; + + + + 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_trusted_sources` +-- + +DROP TABLE IF EXISTS `voip_trusted_sources`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_trusted_sources` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(10) unsigned NOT NULL, + `src_ip` varchar(50) NOT NULL, + `protocol` varchar(4) NOT NULL, + `from_pattern` varchar(64) DEFAULT NULL, + `uuid` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `peer_idx` (`src_ip`), + KEY `subscriber_id_ref` (`subscriber_id`), + CONSTRAINT `subscriber_id_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 TRIGGER trusted_sources_insert AFTER INSERT ON voip_trusted_sources +FOR EACH ROW + INSERT INTO kamailio.trusted (src_ip, proto, from_pattern, tag) + VALUES (NEW.src_ip, NEW.protocol, NEW.from_pattern, NEW.uuid) */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 TRIGGER trusted_sources_update BEFORE UPDATE ON voip_trusted_sources +FOR EACH ROW + UPDATE kamailio.trusted SET + src_ip=NEW.src_ip, proto=NEW.protocol, from_pattern=NEW.from_pattern, tag=NEW.uuid + WHERE + src_ip=OLD.src_ip and proto=OLD.protocol and from_pattern=OLD.from_pattern and tag=OLD.uuid */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 TRIGGER trusted_sources_delete BEFORE DELETE ON voip_trusted_sources +FOR EACH ROW + DELETE FROM kamailio.trusted + WHERE src_ip=OLD.src_ip and proto=OLD.protocol and from_pattern=OLD.from_pattern and tag=OLD.uuid */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_usr_preferences` +-- + +DROP TABLE IF EXISTS `voip_usr_preferences`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_usr_preferences` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `subscriber_id` int(11) unsigned NOT NULL, + `attribute_id` int(11) unsigned NOT NULL, + `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_attributeid_ref` FOREIGN KEY (`attribute_id`) REFERENCES `voip_preferences` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `v_u_p_subscriberid_ref` FOREIGN KEY (`subscriber_id`) REFERENCES `voip_subscribers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`sipwise`@`localhost`*/ /*!50003 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 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `voip_vscs` +-- + +DROP TABLE IF EXISTS `voip_vscs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `voip_vscs` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `domain_id` int(11) unsigned DEFAULT NULL, + `digits` char(2) DEFAULT NULL, + `action` varchar(31) NOT NULL, + `audio_id` int(11) unsigned NOT NULL, + `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_audioid_ref` FOREIGN KEY (`audio_id`) REFERENCES `voip_audio_files` (`id`) ON UPDATE CASCADE, + CONSTRAINT `v_v_domainid_ref` FOREIGN KEY (`domain_id`) REFERENCES `voip_domains` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `xmlgroups` +-- + +DROP TABLE IF EXISTS `xmlgroups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `xmlgroups` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(32) NOT NULL, + PRIMARY KEY (`id`), + KEY `gname` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `xmlhostgroups` +-- + +DROP TABLE IF EXISTS `xmlhostgroups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `xmlhosts` +-- + +DROP TABLE IF EXISTS `xmlhosts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `xmlqueue` +-- + +DROP TABLE IF EXISTS `xmlqueue`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `sipstats` +-- + +/*!40000 DROP DATABASE IF EXISTS `sipstats`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `sipstats` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `sipstats`; + +-- +-- Table structure for table `mark` +-- + +DROP TABLE IF EXISTS `mark`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mark` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `value` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `name_idx` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packets` +-- + +DROP TABLE IF EXISTS `packets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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 +/*!50100 PARTITION BY RANGE (FLOOR(`timestamp`)) +(PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `statistics` +-- + +DROP TABLE IF EXISTS `statistics`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `statistics` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `timestamp` decimal(17,6) NOT NULL, + `req_count` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_register` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_invite` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_bye` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_ack` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_prack` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_cancel` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_update` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_options` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_publish` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_subscribe` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_notify` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_message` bigint(20) unsigned NOT NULL DEFAULT '0', + `req_other` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_count` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_18x` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_1xx` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_2xx` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_3xx` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_401` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_407` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_403` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_404` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_480` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_486` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_487` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_4xx` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_5xx` bigint(20) unsigned NOT NULL DEFAULT '0', + `res_6xx` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`,`timestamp`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +/*!50100 PARTITION BY RANGE (FLOOR(`timestamp`)) +(PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Current Database: `syslog` +-- + +/*!40000 DROP DATABASE IF EXISTS `syslog`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `syslog` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `syslog`; + +-- +-- Table structure for table `SystemEvents` +-- + +DROP TABLE IF EXISTS `SystemEvents`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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`); +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se1` +-- + +DROP TABLE IF EXISTS `se1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se10` +-- + +DROP TABLE IF EXISTS `se10`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se10` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se11` +-- + +DROP TABLE IF EXISTS `se11`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se11` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se12` +-- + +DROP TABLE IF EXISTS `se12`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se12` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se13` +-- + +DROP TABLE IF EXISTS `se13`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se13` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se14` +-- + +DROP TABLE IF EXISTS `se14`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se14` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se15` +-- + +DROP TABLE IF EXISTS `se15`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se15` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se16` +-- + +DROP TABLE IF EXISTS `se16`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se16` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se17` +-- + +DROP TABLE IF EXISTS `se17`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se17` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se18` +-- + +DROP TABLE IF EXISTS `se18`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se18` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se19` +-- + +DROP TABLE IF EXISTS `se19`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se19` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se2` +-- + +DROP TABLE IF EXISTS `se2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se2` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se20` +-- + +DROP TABLE IF EXISTS `se20`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se20` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se21` +-- + +DROP TABLE IF EXISTS `se21`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se21` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se22` +-- + +DROP TABLE IF EXISTS `se22`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se22` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se23` +-- + +DROP TABLE IF EXISTS `se23`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se23` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se24` +-- + +DROP TABLE IF EXISTS `se24`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se24` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se25` +-- + +DROP TABLE IF EXISTS `se25`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se25` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se26` +-- + +DROP TABLE IF EXISTS `se26`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se26` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se27` +-- + +DROP TABLE IF EXISTS `se27`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se27` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se28` +-- + +DROP TABLE IF EXISTS `se28`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se28` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se3` +-- + +DROP TABLE IF EXISTS `se3`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se3` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se4` +-- + +DROP TABLE IF EXISTS `se4`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se4` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se5` +-- + +DROP TABLE IF EXISTS `se5`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se5` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se6` +-- + +DROP TABLE IF EXISTS `se6`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se6` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se7` +-- + +DROP TABLE IF EXISTS `se7`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se7` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se8` +-- + +DROP TABLE IF EXISTS `se8`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se8` ( + `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; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `se9` +-- + +DROP TABLE IF EXISTS `se9`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `se9` ( + `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; +/*!40101 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 */; + +-- Dump completed on 2012-04-16 22:25:53