--
-- Host: localhost    Database: kamailio
-- ------------------------------------------------------


--
-- Current Database: `kamailio`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `kamailio` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `kamailio`;

--
-- Table structure for table `acc`
--

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(128) NOT NULL default '',
  `sip_code` char(3) NOT NULL default '',
  `sip_reason` varchar(32) NOT NULL default '',
  `time` datetime NOT NULL default '0000-00-00 00:00:00',
  `src_ip` varchar(64) NOT NULL default '',
  `dst_user` 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 '',
  `cdr_id` int(11) NOT NULL default '0',
  `dst_ouser` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `acc_callid` (`callid`)
) ENGINE=MyISAM AUTO_INCREMENT=8086 DEFAULT CHARSET=latin1;

--
-- Table structure for table `active_watchers`
--

CREATE TABLE `active_watchers` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `presentity_uri` varchar(128) NOT NULL,
  `watcher_username` varchar(64) NOT NULL,
  `watcher_domain` varchar(64) NOT NULL,
  `to_user` varchar(64) NOT NULL,
  `to_domain` varchar(64) NOT NULL,
  `event` varchar(64) NOT NULL default 'presence',
  `event_id` varchar(64) default NULL,
  `to_tag` varchar(64) NOT NULL,
  `from_tag` varchar(64) NOT NULL,
  `callid` varchar(64) NOT NULL,
  `local_cseq` int(11) NOT NULL,
  `remote_cseq` int(11) NOT NULL,
  `contact` varchar(64) NOT NULL,
  `record_route` text,
  `expires` int(11) NOT NULL,
  `status` int(11) NOT NULL default '2',
  `reason` varchar(64) NOT NULL,
  `version` int(11) NOT NULL default '0',
  `socket_info` varchar(64) NOT NULL,
  `local_contact` varchar(128) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `active_watchers_idx` (`presentity_uri`,`callid`,`to_tag`,`from_tag`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `address`
--

CREATE TABLE `address` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `grp` smallint(5) unsigned NOT NULL default '1',
  `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=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;

--
-- Table structure for table `aliases`
--

CREATE TABLE `aliases` (
  `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 `alias_idx` (`username`,`domain`,`contact`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Table structure for table `carrier_name`
--

CREATE TABLE `carrier_name` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `carrier` varchar(64) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `carrierfailureroute`
--

CREATE TABLE `carrierfailureroute` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `carrier` int(10) unsigned NOT NULL default '0',
  `domain` int(10) unsigned NOT NULL default '0',
  `scan_prefix` varchar(64) NOT NULL default '',
  `host_name` varchar(128) NOT NULL default '',
  `reply_code` varchar(3) NOT NULL default '',
  `flags` int(11) unsigned NOT NULL default '0',
  `mask` int(11) unsigned NOT NULL default '0',
  `next_domain` int(10) unsigned NOT NULL default '0',
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `carrierroute`
--

CREATE TABLE `carrierroute` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `carrier` int(10) unsigned NOT NULL default '0',
  `domain` int(10) unsigned NOT NULL default '0',
  `scan_prefix` varchar(64) NOT NULL default '',
  `flags` int(11) unsigned NOT NULL default '0',
  `mask` int(11) unsigned NOT NULL default '0',
  `prob` float NOT NULL default '0',
  `strip` int(11) unsigned NOT NULL default '0',
  `rewrite_host` varchar(128) NOT NULL default '',
  `rewrite_prefix` varchar(64) NOT NULL default '',
  `rewrite_suffix` varchar(64) NOT NULL default '',
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `cdrs`
--

CREATE TABLE `cdrs` (
  `cdr_id` bigint(20) NOT NULL auto_increment,
  `src_username` varchar(64) NOT NULL default '',
  `src_domain` varchar(128) NOT NULL default '',
  `dst_username` varchar(64) NOT NULL default '',
  `dst_domain` varchar(128) NOT NULL default '',
  `call_start_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `duration` int(10) unsigned NOT NULL default '0',
  `sip_call_id` varchar(128) NOT NULL default '',
  `sip_from_tag` varchar(128) NOT NULL default '',
  `sip_to_tag` varchar(128) NOT NULL default '',
  `src_ip` varchar(64) NOT NULL default '',
  `cost` int(11) NOT NULL default '0',
  `rated` int(11) NOT NULL default '0',
  `created` datetime NOT NULL,
  PRIMARY KEY  (`cdr_id`),
  UNIQUE KEY `uk_cft` (`sip_call_id`,`sip_from_tag`,`sip_to_tag`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `cpl`
--

CREATE TABLE `cpl` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `domain` varchar(64) NOT NULL default '',
  `cpl_xml` text,
  `cpl_bin` text,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `account_idx` (`username`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `custom_authorization`
--

CREATE TABLE `custom_authorization` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `permitedcalls` smallint(6) NOT NULL default '30',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

--
-- Table structure for table `dbaliases`
--

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=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=latin1;

--
-- Table structure for table `dialog`
--

CREATE TABLE `dialog` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `hash_entry` int(10) unsigned NOT NULL,
  `hash_id` int(10) unsigned NOT NULL,
  `callid` varchar(255) NOT NULL,
  `from_uri` varchar(128) NOT NULL,
  `from_tag` varchar(64) NOT NULL,
  `to_uri` varchar(128) NOT NULL,
  `to_tag` varchar(64) NOT NULL,
  `caller_cseq` varchar(7) NOT NULL,
  `callee_cseq` varchar(7) NOT NULL,
  `caller_route_set` varchar(512) default NULL,
  `callee_route_set` varchar(512) default NULL,
  `caller_contact` varchar(128) NOT NULL,
  `callee_contact` varchar(128) NOT NULL,
  `caller_sock` varchar(64) NOT NULL,
  `callee_sock` varchar(64) NOT NULL,
  `state` int(10) unsigned NOT NULL,
  `start_time` int(10) unsigned NOT NULL,
  `timeout` int(10) unsigned NOT NULL default '0',
  `sflags` int(10) unsigned NOT NULL default '0',
  `toroute` int(10) unsigned NOT NULL default '0',
  `toroute_name` varchar(32) default NULL,
  `req_uri` varchar(128) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `hash_idx` (`hash_entry`,`hash_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `dialplan`
--

CREATE TABLE `dialplan` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `dpid` int(11) NOT NULL,
  `pr` int(11) NOT NULL,
  `match_op` int(11) NOT NULL,
  `match_exp` varchar(64) NOT NULL,
  `match_len` int(11) NOT NULL,
  `subst_exp` varchar(64) NOT NULL,
  `repl_exp` varchar(32) NOT NULL,
  `attrs` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `dispatcher`
--

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',
  `attrs` varchar(128) NOT NULL default '',
  `description` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `domain`
--

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=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Table structure for table `domain_name`
--

CREATE TABLE `domain_name` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `domain` varchar(64) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `domainpolicy`
--

CREATE TABLE `domainpolicy` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `rule` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  `att` varchar(255) default NULL,
  `val` varchar(128) default NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `rav_idx` (`rule`,`att`,`val`),
  KEY `rule_idx` (`rule`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `globalblacklist`
--

CREATE TABLE `globalblacklist` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `prefix` varchar(64) NOT NULL default '',
  `whitelist` tinyint(1) NOT NULL default '0',
  `description` varchar(255) default NULL,
  PRIMARY KEY  (`id`),
  KEY `globalblacklist_idx` (`prefix`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `grp`
--

CREATE TABLE `grp` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(64) NOT NULL default '',
  `grp` varchar(64) NOT NULL default '',
  `last_modified` datetime NOT NULL default '1900-01-01 00:00:01',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `account_group_idx` (`username`,`domain`,`grp`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `htable`
--

CREATE TABLE `htable` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `key_name` varchar(64) NOT NULL default '',
  `key_type` int(11) NOT NULL default '0',
  `value_type` int(11) NOT NULL default '0',
  `key_value` varchar(128) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `imc_members`
--

CREATE TABLE `imc_members` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `domain` varchar(64) NOT NULL,
  `room` varchar(64) NOT NULL,
  `flag` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `account_room_idx` (`username`,`domain`,`room`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `imc_rooms`
--

CREATE TABLE `imc_rooms` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(64) NOT NULL,
  `domain` varchar(64) NOT NULL,
  `flag` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name_domain_idx` (`name`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `lcr_gw`
--

CREATE TABLE `lcr_gw` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `lcr_id` smallint(5) unsigned NOT NULL,
  `gw_name` varchar(128) default NULL,
  `ip_addr` varchar(15) default 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,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `lcr_id_ip_addr_port_hostname_idx` (`lcr_id`,`ip_addr`,`port`,`hostname`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `lcr_rule`
--

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',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `lcr_id_prefix_from_uri_idx` (`lcr_id`,`prefix`,`from_uri`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `lcr_rule_target`
--

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`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `location`
--

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=MyISAM AUTO_INCREMENT=3088 DEFAULT CHARSET=latin1;

--
-- Table structure for table `missed_calls`
--

CREATE TABLE `missed_calls` (
  `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(128) NOT NULL default '',
  `sip_code` char(3) NOT NULL default '',
  `sip_reason` varchar(32) NOT NULL default '',
  `time` datetime NOT NULL default '0000-00-00 00:00:00',
  `src_ip` varchar(64) NOT NULL default '',
  `dst_user` 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 '',
  `cdr_id` int(11) NOT NULL default '0',
  `dst_ouser` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `mc_callid` (`callid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `pdt`
--

CREATE TABLE `pdt` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `sdomain` varchar(128) NOT NULL,
  `prefix` varchar(32) NOT NULL,
  `domain` varchar(128) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `sdomain_prefix_idx` (`sdomain`,`prefix`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `presentity`
--

CREATE TABLE `presentity` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `domain` varchar(64) NOT NULL,
  `event` varchar(64) NOT NULL,
  `etag` varchar(64) NOT NULL,
  `expires` int(11) NOT NULL,
  `received_time` int(11) NOT NULL,
  `body` blob NOT NULL,
  `sender` varchar(128) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `presentity_idx` (`username`,`domain`,`event`,`etag`)
) ENGINE=MyISAM AUTO_INCREMENT=1289 DEFAULT CHARSET=latin1;

--
-- Table structure for table `pua`
--

CREATE TABLE `pua` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `pres_uri` varchar(128) NOT NULL,
  `pres_id` varchar(64) NOT NULL,
  `event` int(11) NOT NULL,
  `expires` int(11) NOT NULL,
  `desired_expires` int(11) NOT NULL,
  `flag` int(11) NOT NULL,
  `etag` varchar(64) NOT NULL,
  `tuple_id` varchar(64) default NULL,
  `watcher_uri` varchar(128) NOT NULL,
  `call_id` varchar(64) NOT NULL,
  `to_tag` varchar(64) NOT NULL,
  `from_tag` varchar(64) NOT NULL,
  `cseq` int(11) NOT NULL,
  `record_route` text,
  `contact` varchar(128) NOT NULL,
  `remote_contact` varchar(128) NOT NULL,
  `version` int(11) NOT NULL,
  `extra_headers` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `purplemap`
--

CREATE TABLE `purplemap` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `sip_user` varchar(128) NOT NULL,
  `ext_user` varchar(128) NOT NULL,
  `ext_prot` varchar(16) NOT NULL,
  `ext_pass` varchar(64) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `re_grp`
--

CREATE TABLE `re_grp` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `reg_exp` varchar(128) NOT NULL default '',
  `group_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `group_idx` (`group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `rls_presentity`
--

CREATE TABLE `rls_presentity` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `rlsubs_did` varchar(255) NOT NULL,
  `resource_uri` varchar(128) NOT NULL,
  `content_type` varchar(64) NOT NULL,
  `presence_state` blob NOT NULL,
  `expires` int(11) NOT NULL,
  `updated` int(11) NOT NULL,
  `auth_state` int(11) NOT NULL,
  `reason` varchar(64) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `rls_presentity_idx` (`rlsubs_did`,`resource_uri`),
  KEY `updated_idx` (`updated`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `rls_watchers`
--

CREATE TABLE `rls_watchers` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `presentity_uri` varchar(128) NOT NULL,
  `to_user` varchar(64) NOT NULL,
  `to_domain` varchar(64) NOT NULL,
  `watcher_username` varchar(64) NOT NULL,
  `watcher_domain` varchar(64) NOT NULL,
  `event` varchar(64) NOT NULL default 'presence',
  `event_id` varchar(64) default NULL,
  `to_tag` varchar(64) NOT NULL,
  `from_tag` varchar(64) NOT NULL,
  `callid` varchar(64) NOT NULL,
  `local_cseq` int(11) NOT NULL,
  `remote_cseq` int(11) NOT NULL,
  `contact` varchar(64) NOT NULL,
  `record_route` text,
  `expires` int(11) NOT NULL,
  `status` int(11) NOT NULL default '2',
  `reason` varchar(64) NOT NULL,
  `version` int(11) NOT NULL default '0',
  `socket_info` varchar(64) NOT NULL,
  `local_contact` varchar(128) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `rls_watcher_idx` (`presentity_uri`,`callid`,`to_tag`,`from_tag`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `silo`
--

CREATE TABLE `silo` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `src_addr` varchar(128) NOT NULL default '',
  `dst_addr` varchar(128) NOT NULL default '',
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(64) NOT NULL default '',
  `inc_time` int(11) NOT NULL default '0',
  `exp_time` int(11) NOT NULL default '0',
  `snd_time` int(11) NOT NULL default '0',
  `ctype` varchar(32) NOT NULL default 'text/plain',
  `body` blob NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `account_idx` (`username`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `sip_trace`
--

CREATE TABLE `sip_trace` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `time_stamp` datetime NOT NULL default '1900-01-01 00:00:01',
  `callid` varchar(255) NOT NULL default '',
  `traced_user` varchar(128) NOT NULL default '',
  `msg` text NOT NULL,
  `method` varchar(50) NOT NULL default '',
  `status` varchar(128) NOT NULL default '',
  `fromip` varchar(50) NOT NULL default '',
  `toip` varchar(50) NOT NULL default '',
  `fromtag` varchar(64) NOT NULL default '',
  `direction` varchar(4) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `traced_user_idx` (`traced_user`),
  KEY `date_idx` (`time_stamp`),
  KEY `fromip_idx` (`fromip`),
  KEY `callid_idx` (`callid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `speed_dial`
--

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=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `statistics`
--

CREATE TABLE `statistics` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `time_stamp` int(10) unsigned NOT NULL default '0',
  `shm_used_size` int(10) unsigned NOT NULL default '0',
  `shm_real_used_size` int(10) unsigned NOT NULL default '0',
  `shm_max_used_size` int(10) unsigned NOT NULL default '0',
  `shm_free_used_size` int(10) unsigned NOT NULL default '0',
  `ul_users` int(10) unsigned NOT NULL default '0',
  `ul_contacts` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `subscriber`
--

CREATE TABLE `subscriber` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(64) NOT NULL default '',
  `password` varchar(25) NOT NULL default '',
  `email_address` varchar(64) NOT NULL default '',
  `ha1` varchar(64) NOT NULL default '',
  `ha1b` varchar(64) NOT NULL default '',
  `rpid` varchar(64) default NULL,
  `permitedcalls` smallint(6) default '14',
  `permittedcalls` smallint(6) default '14',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `account_idx` (`username`,`domain`),
  KEY `username_idx` (`username`)
) ENGINE=MyISAM AUTO_INCREMENT=49 DEFAULT CHARSET=latin1;

--
-- Table structure for table `trusted`
--

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=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `uri`
--

CREATE TABLE `uri` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(64) NOT NULL default '',
  `uri_user` varchar(64) NOT NULL default '',
  `last_modified` datetime NOT NULL default '1900-01-01 00:00:01',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `account_idx` (`username`,`domain`,`uri_user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `userblacklist`
--

CREATE TABLE `userblacklist` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(64) NOT NULL default '',
  `prefix` varchar(64) NOT NULL default '',
  `whitelist` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `userblacklist_idx` (`username`,`domain`,`prefix`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `usr_preferences`
--

CREATE TABLE `usr_preferences` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `uuid` varchar(64) NOT NULL default '',
  `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=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;

--
-- Table structure for table `version`
--

CREATE TABLE `version` (
  `table_name` varchar(32) NOT NULL,
  `table_version` int(10) unsigned NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `watchers`
--

CREATE TABLE `watchers` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `presentity_uri` varchar(128) NOT NULL,
  `watcher_username` varchar(64) NOT NULL,
  `watcher_domain` varchar(64) NOT NULL,
  `event` varchar(64) NOT NULL default 'presence',
  `status` int(11) NOT NULL,
  `reason` varchar(64) default NULL,
  `inserted_time` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `watcher_idx` (`presentity_uri`,`watcher_username`,`watcher_domain`,`event`)
) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;

--
-- Table structure for table `xcap`
--

CREATE TABLE `xcap` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `domain` varchar(64) NOT NULL,
  `doc` blob NOT NULL,
  `doc_type` int(11) NOT NULL,
  `etag` varchar(64) NOT NULL,
  `source` int(11) NOT NULL,
  `doc_uri` varchar(128) NOT NULL,
  `port` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `account_doc_type_idx` (`username`,`domain`,`doc_type`,`doc_uri`),
  KEY `source_idx` (`source`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Current Database: `provision`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `provision` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `provision`;

--
-- Table structure for table `number_pool`
--

CREATE TABLE `number_pool` (
  `id` int(11) NOT NULL auto_increment,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `number` varchar(128) character set utf8 NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;

--
-- Table structure for table `phones`
--

CREATE TABLE `phones` (
  `id` int(11) NOT NULL auto_increment,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `mac` varchar(32) character set utf8 NOT NULL,
  `user_rel` int(11) NOT NULL,
  `ua_type` int(11) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

--
-- Table structure for table `servers`
--

CREATE TABLE `servers` (
  `id` int(11) NOT NULL auto_increment,
  `domain` varchar(255) character set utf8 NOT NULL,
  `registrar` varchar(255) character set utf8 default NULL,
  `r_port` int(11) default NULL,
  `proxy` varchar(255) character set utf8 default NULL,
  `p_port` int(11) default NULL,
  `prov_url` text,
   PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Table structure for table `sessionkeys`
--

CREATE TABLE `sessionkeys` (
  `sessid` varchar(255) NOT NULL,
  `session` varchar(128) NOT NULL,
  `authid` varchar(128) NOT NULL,
  `client` varchar(255) NOT NULL,
  `key` varchar(128) NOT NULL,
  `last` datetime default NULL,
  PRIMARY KEY  (`session`,`authid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL auto_increment,
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `username` varchar(128) character set utf8 NOT NULL,
  `password` varchar(128) character set utf8 NOT NULL,
  `displayname` varchar(255) character set utf8 NOT NULL,
  `domain` varchar(255) character set utf8 NOT NULL,
  `registrar` varchar(255) character set utf8 default NULL,
  `r_port` int(11) default NULL,
  `proxy` varchar(255) character set utf8 default NULL,
  `p_port` int(11) default NULL,
  `authid` varchar(128) character set utf8 default NULL,
  `dialplan` varchar(255) character set utf8 default NULL,
  `linetext` varchar(64) character set utf8 default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=latin1;


