-- phpMyAdmin SQL Dump
-- version 4.0.10.20
-- https://www.phpmyadmin.net
--
-- Host: localhost
-- Generato il: Lug 11, 2018 alle 11:45
-- Versione del server: 5.7.22-log
-- Versione PHP: 5.5.38

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!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 */;

--
-- Database: `asteriskcdrdb`
--

-- --------------------------------------------------------

--
-- Struttura della tabella `cdr`
--

CREATE TABLE IF NOT EXISTS `cdr` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `start` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `answer` datetime NOT NULL,
  `end` datetime NOT NULL,
  `clid` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `src` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `dst` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `dcontext` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `dstchannel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `lastapp` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `lastdata` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `duration` int(11) NOT NULL DEFAULT '0',
  `billsec` int(11) NOT NULL DEFAULT '0',
  `disposition` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `amaflags` int(11) NOT NULL DEFAULT '0',
  `accountcode` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `uniqueid` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `userfield` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `realsrc` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `firstdst` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `lastdst` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `srcCallID` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `prevuniqueid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `peeraccount` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL,
  `sequence` int(11) DEFAULT NULL,
  `originateid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `linkedid` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `wherelanded` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `pincode` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `prevsequence` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`,`accountcode`),
  KEY `accountcode` (`accountcode`),
  KEY `uniqueid` (`uniqueid`),
  KEY `cdr_cc_id` (`accountcode`),
  KEY `srcCallID` (`srcCallID`),
  KEY `cdr_cc_id_2` (`accountcode`),
  KEY `start` (`start`),
  KEY `originateid` (`originateid`),
  KEY `prevuniqueid` (`prevuniqueid`),
  KEY `accountcode_2` (`accountcode`,`start`),
  KEY `accountcode_3` (`accountcode`,`lastdst`),
  KEY `linkedid` (`linkedid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
/*!50100 PARTITION BY KEY (accountcode)
PARTITIONS 500 */ AUTO_INCREMENT=73692835 ;

-- --------------------------------------------------------

--
-- Struttura della tabella `cel`
--

CREATE TABLE IF NOT EXISTS `cel` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `eventtype` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `eventtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `userdeftype` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `cid_name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_num` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_ani` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_rdnis` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `cid_dnid` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `exten` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `context` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `channame` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `appname` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `appdata` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `amaflags` int(11) NOT NULL,
  `accountcode` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `peeraccount` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
  `uniqueid` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `linkedid` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `userfield` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `peer` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `extra` varchar(255) COLLATE utf8_unicode_ci DEFAULT '',
  UNIQUE KEY `id` (`id`),
  KEY `linkedid` (`linkedid`),
  KEY `uniqueid` (`uniqueid`),
  KEY `appdata` (`appdata`),
  KEY `eventtimeaccountcode` (`eventtime`,`accountcode`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11383011 ;

-- --------------------------------------------------------

--
-- Struttura della tabella `sc_simplecdr`
--

CREATE TABLE IF NOT EXISTS `sc_simplecdr` (
  `sc_id` int(11) NOT NULL AUTO_INCREMENT,
  `sc_te_id` int(11) NOT NULL,
  `sc_start` datetime NOT NULL,
  `sc_direction` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `sc_calleridnum` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `sc_calleridname` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `sc_dialednum` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `sc_disposition` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `sc_duration` int(11) NOT NULL,
  `sc_uniqueid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`sc_id`),
  KEY `sc_te_id` (`sc_te_id`,`sc_start`),
  KEY `sc_uniqueid` (`sc_uniqueid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=136771 ;

/*!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 */;
