-- http://www.phpmyadmin.net
--
-- Erstellungszeit: 02. Mai 2008 um 14:54
-- Server Version: 5.0.32
-- PHP-Version: 5.2.0-8+etch10


--
-- Datenbank: `openser`
--

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

--
-- Tabellenstruktur für Tabelle `acc`
--

CREATE TABLE IF NOT EXISTS `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,
  PRIMARY KEY  (`id`),
  KEY `acc_callid` (`callid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `active_watchers`
--

CREATE TABLE IF NOT EXISTS `active_watchers` (
  `id` int(10) NOT NULL auto_increment,
  `to_user` varchar(64) NOT NULL,
  `to_domain` varchar(128) NOT NULL,
  `from_user` varchar(64) NOT NULL,
  `from_domain` varchar(128) NOT NULL,
  `event` varchar(64) NOT NULL default 'presence',
  `event_id` varchar(64) default NULL,
  `to_tag` varchar(128) NOT NULL,
  `from_tag` varchar(128) NOT NULL,
  `callid` varchar(128) NOT NULL,
  `local_cseq` int(11) NOT NULL,
  `remote_cseq` int(11) NOT NULL,
  `contact` varchar(128) NOT NULL,
  `record_route` varchar(255) default NULL,
  `expires` int(11) NOT NULL,
  `status` varchar(32) NOT NULL default 'pending',
  `version` int(11) default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `tt_watchers` (`to_tag`),
  KEY `due_activewatchers` (`to_domain`,`to_user`,`event`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `address`
--

CREATE TABLE IF NOT EXISTS `address` (
  `id` int(10) NOT NULL auto_increment,
  `grp` smallint(5) unsigned NOT NULL default '0',
  `ip_addr` varchar(15) NOT NULL,
  `mask` tinyint(4) NOT NULL default '32',
  `port` smallint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `aliases`
--

CREATE TABLE IF NOT EXISTS `aliases` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(128) NOT NULL default '',
  `contact` varchar(255) NOT NULL default '',
  `received` varchar(255) default NULL,
  `path` varchar(255) 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:00',
  `flags` int(11) NOT NULL default '0',
  `cflags` int(11) NOT NULL default '0',
  `user_agent` varchar(255) NOT NULL default '',
  `socket` varchar(128) default NULL,
  `methods` int(11) default NULL,
  PRIMARY KEY  (`id`),
  KEY `udc_als` (`username`,`domain`,`contact`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `carrierroute`
--

CREATE TABLE IF NOT EXISTS `carrierroute` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `carrier` int(10) unsigned NOT NULL default '0',
  `scan_prefix` varchar(64) NOT NULL default '',
  `domain` varchar(64) NOT NULL default '',
  `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 '',
  `comment` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `cpl`
--

CREATE TABLE IF NOT EXISTS `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 `ud_cpl` (`username`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `dbaliases`
--

CREATE TABLE IF NOT EXISTS `dbaliases` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `alias_username` varchar(64) NOT NULL default '',
  `alias_domain` varchar(128) NOT NULL default '',
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(128) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `alias_key` (`alias_username`,`alias_domain`),
  KEY `alias_user` (`username`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `dialog`
--

CREATE TABLE IF NOT EXISTS `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,
  PRIMARY KEY  (`id`),
  KEY `hash_idx` (`hash_entry`,`hash_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `dispatcher`
--

CREATE TABLE IF NOT EXISTS `dispatcher` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `setid` int(11) NOT NULL default '0',
  `destination` varchar(192) NOT NULL default '',
  `description` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `domain`
--

CREATE TABLE IF NOT EXISTS `domain` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `domain` varchar(128) NOT NULL default '',
  `last_modified` datetime NOT NULL,
  `version` bigint(20) default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `d_domain` (`domain`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `domainpolicy`
--

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

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

--
-- Tabellenstruktur für Tabelle `grp`
--

CREATE TABLE IF NOT EXISTS `grp` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(128) NOT NULL default '',
  `grp` varchar(50) NOT NULL default '',
  `last_modified` datetime NOT NULL,
  `version` bigint(20) default NULL,
  `group_id` bigint(20) default NULL,
  `name` varchar(255) default NULL,
  `user_id` bigint(20) default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `udg_grp` (`username`,`domain`,`grp`),
  KEY `FK190E5F7634DFA` (`user_id`),
  KEY `FK190E5224C7D3A` (`group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `gw`
--

CREATE TABLE IF NOT EXISTS `gw` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `gw_name` varchar(128) NOT NULL,
  `grp_id` int(10) unsigned NOT NULL,
  `ip_addr` varchar(15) NOT NULL,
  `port` smallint(5) unsigned default NULL,
  `uri_scheme` tinyint(3) unsigned default NULL,
  `transport` tinyint(3) unsigned default NULL,
  `strip` tinyint(3) unsigned default NULL,
  `prefix` varchar(16) default NULL,
  `dm` tinyint(3) unsigned NOT NULL default '1',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `gw_name_idx` (`gw_name`),
  KEY `grp_id_idx` (`grp_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `gw_grp`
--

CREATE TABLE IF NOT EXISTS `gw_grp` (
  `grp_id` int(10) unsigned NOT NULL auto_increment,
  `grp_name` varchar(64) NOT NULL,
  `version` bigint(20) default NULL,
  PRIMARY KEY  (`grp_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `imc_members`
--

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

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

--
-- Tabellenstruktur für Tabelle `imc_rooms`
--

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

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

--
-- Tabellenstruktur für Tabelle `jsec_permission`
--

CREATE TABLE IF NOT EXISTS `jsec_permission` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `possible_actions` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `type` (`type`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `jsec_role`
--

CREATE TABLE IF NOT EXISTS `jsec_role` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `jsec_role_permission_rel`
--

CREATE TABLE IF NOT EXISTS `jsec_role_permission_rel` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `actions` varchar(255) NOT NULL,
  `permission_id` bigint(20) NOT NULL,
  `role_id` bigint(20) NOT NULL,
  `target` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `FK6DF5807AF1EDA81` (`permission_id`),
  KEY `FK6DF5807ACE88AE61` (`role_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `jsec_user_permission_rel`
--

CREATE TABLE IF NOT EXISTS `jsec_user_permission_rel` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `actions` varchar(255) NOT NULL,
  `permission_id` bigint(20) NOT NULL,
  `target` varchar(255) default NULL,
  `user_id` bigint(20) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `FK28FF6085F1EDA81` (`permission_id`),
  KEY `FK28FF608573B37241` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `jsec_user_role_rel`
--

CREATE TABLE IF NOT EXISTS `jsec_user_role_rel` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `role_id` bigint(20) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `FK238F64AC73B37241` (`user_id`),
  KEY `FK238F64ACCE88AE61` (`role_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `lcr`
--

CREATE TABLE IF NOT EXISTS `lcr` (
  `id` int(10) NOT NULL auto_increment,
  `prefix` varchar(16) NOT NULL,
  `from_uri` varchar(128) default NULL,
  `grp_id` int(10) unsigned NOT NULL,
  `priority` tinyint(3) unsigned NOT NULL,
  `version` bigint(20) default NULL,
  `fromuri` varchar(255) default NULL,
  PRIMARY KEY  (`id`),
  KEY `prefix` (`prefix`),
  KEY `from_uri` (`from_uri`),
  KEY `grp_id` (`grp_id`),
  KEY `FK1A1DB9AF25970` (`grp_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `location`
--

CREATE TABLE IF NOT EXISTS `location` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(128) NOT NULL default '',
  `contact` varchar(255) NOT NULL default '',
  `received` varchar(255) default NULL,
  `path` varchar(255) 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:00',
  `flags` int(11) NOT NULL default '0',
  `cflags` int(11) NOT NULL default '0',
  `user_agent` varchar(255) NOT NULL default '',
  `socket` varchar(128) default NULL,
  `methods` int(11) default NULL,
  PRIMARY KEY  (`id`),
  KEY `udc_loc` (`username`,`domain`,`contact`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `missed_calls`
--

CREATE TABLE IF NOT EXISTS `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,
  PRIMARY KEY  (`id`),
  KEY `acc_callid` (`callid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `pdt`
--

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

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

--
-- Tabellenstruktur für Tabelle `presentity`
--

CREATE TABLE IF NOT EXISTS `presentity` (
  `id` int(10) NOT NULL auto_increment,
  `username` varchar(64) NOT NULL,
  `domain` varchar(124) NOT NULL,
  `event` varchar(64) NOT NULL,
  `etag` varchar(64) NOT NULL,
  `expires` int(11) NOT NULL,
  `received_time` int(11) NOT NULL,
  `body` text NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `udee_presentity` (`username`,`domain`,`event`,`etag`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `pua`
--

CREATE TABLE IF NOT EXISTS `pua` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `pres_uri` varchar(128) NOT NULL,
  `pres_id` varchar(128) NOT NULL,
  `expires` int(11) NOT NULL,
  `flag` int(11) NOT NULL,
  `etag` varchar(128) NOT NULL,
  `tuple_id` varchar(128) NOT NULL,
  `watcher_uri` varchar(128) NOT NULL,
  `call_id` varchar(128) NOT NULL,
  `to_tag` varchar(128) NOT NULL,
  `from_tag` varchar(128) NOT NULL,
  `cseq` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `puorg`
--

CREATE TABLE IF NOT EXISTS `puorg` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `register_user`
--

CREATE TABLE IF NOT EXISTS `register_user` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `caller_id` varchar(255) default NULL,
  `datetime_created` datetime NOT NULL,
  `domain_id` bigint(20) NOT NULL,
  `domain_name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `first_name` varchar(255) NOT NULL,
  `ha1` varchar(255) NOT NULL,
  `ha1b` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `openser_username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `role_id` bigint(20) default NULL,
  `username` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `FKAD2823E7CE88AE61` (`role_id`),
  KEY `FKAD2823E7A13EF75A` (`domain_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `re_grp`
--

CREATE TABLE IF NOT EXISTS `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 `gid_grp` (`group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `rls_presentity`
--

CREATE TABLE IF NOT EXISTS `rls_presentity` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `rlsubs_did` varchar(512) 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`),
  UNIQUE KEY `updated_idx` (`updated`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `rls_watchers`
--

CREATE TABLE IF NOT EXISTS `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;

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

--
-- Tabellenstruktur für Tabelle `route_tree`
--

CREATE TABLE IF NOT EXISTS `route_tree` (
  `id` int(10) unsigned NOT NULL default '0',
  `carrier` varchar(64) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `silo`
--

CREATE TABLE IF NOT EXISTS `silo` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `src_addr` varchar(255) NOT NULL default '',
  `dst_addr` varchar(255) NOT NULL default '',
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(128) 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 `ud_silo` (`username`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `sip_trace`
--

CREATE TABLE IF NOT EXISTS `sip_trace` (
  `id` int(10) NOT NULL auto_increment,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `callid` varchar(254) NOT NULL default '',
  `traced_user` varchar(128) NOT NULL default '',
  `msg` text NOT NULL,
  `method` varchar(50) NOT NULL default '',
  `status` varchar(254) 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 `user_idx` (`traced_user`),
  KEY `date_id` (`date`),
  KEY `ip_idx` (`fromip`),
  KEY `call_id` (`callid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `speed_dial`
--

CREATE TABLE IF NOT EXISTS `speed_dial` (
  `id` int(10) NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(128) NOT NULL default '',
  `sd_username` varchar(64) NOT NULL default '',
  `sd_domain` varchar(128) NOT NULL default '',
  `new_uri` varchar(192) NOT NULL default '',
  `fname` varchar(128) NOT NULL default '',
  `lname` varchar(128) NOT NULL default '',
  `description` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `udss_sd` (`username`,`domain`,`sd_domain`,`sd_username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `subscriber`
--

CREATE TABLE IF NOT EXISTS `subscriber` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `username` varchar(64) NOT NULL default '',
  `domain` varchar(128) NOT NULL default '',
  `password` varchar(25) NOT NULL default '',
  `first_name` varchar(25) NOT NULL default '',
  `last_name` varchar(45) NOT NULL default '',
  `email_address` varchar(50) NOT NULL default '',
  `datetime_created` datetime NOT NULL,
  `ha1` varchar(128) NOT NULL default '',
  `ha1b` varchar(128) NOT NULL default '',
  `timezone` varchar(128) default NULL,
  `rpid` varchar(128) default NULL,
  `version` bigint(20) default '0',
  `password_hash` varchar(255) default NULL,
  `auth_username` varchar(255) default 'user',
  `class` varchar(255) default 'User',
  `domain_id` bigint(20) default NULL,
  `role_id` bigint(20) default '1',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `user_id` (`username`,`domain`),
  KEY `username_id` (`username`),
  KEY `FKB74BCC68CE88AE61` (`role_id`),
  KEY `FKB74BCC68A13EF75A` (`domain_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `trusted`
--

CREATE TABLE IF NOT EXISTS `trusted` (
  `id` int(10) NOT NULL auto_increment,
  `src_ip` varchar(39) NOT NULL,
  `proto` varchar(4) NOT NULL,
  `from_pattern` varchar(64) default NULL,
  `tag` varchar(32) default NULL,
  `version` bigint(20) default NULL,
  PRIMARY KEY  (`id`),
  KEY `Key1` (`src_ip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `uri`
--

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

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

--
-- Tabellenstruktur für Tabelle `usr_preferences`
--

CREATE TABLE IF NOT EXISTS `usr_preferences` (
  `id` int(10) NOT NULL auto_increment,
  `uuid` varchar(64) NOT NULL default '',
  `username` varchar(64) NOT NULL default '0',
  `domain` varchar(128) NOT NULL default '',
  `attribute` varchar(32) NOT NULL default '',
  `type` int(11) NOT NULL default '0',
  `value` varchar(128) NOT NULL default '',
  `last_modified` timestamp NOT NULL default '0000-00-00 00:00:00',
  `version` bigint(20) default NULL,
  `user_id` bigint(20) default NULL,
  PRIMARY KEY  (`id`),
  KEY `ua_idx` (`uuid`,`attribute`),
  KEY `uda_idx` (`username`,`domain`,`attribute`),
  KEY `FKFC944CDF7634DFA` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `version`
--

CREATE TABLE IF NOT EXISTS `version` (
  `table_name` varchar(64) NOT NULL,
  `table_version` smallint(5) NOT NULL default '0',
  PRIMARY KEY  (`table_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `watchers`
--

CREATE TABLE IF NOT EXISTS `watchers` (
  `id` int(10) NOT NULL auto_increment,
  `p_user` varchar(64) NOT NULL,
  `p_domain` varchar(128) NOT NULL,
  `w_user` varchar(64) NOT NULL,
  `w_domain` varchar(128) NOT NULL,
  `subs_status` varchar(64) NOT NULL,
  `reason` varchar(64) default NULL,
  `inserted_time` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `udud_watchers` (`p_user`,`p_domain`,`w_user`,`w_domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `whatthefuck`
--

CREATE TABLE IF NOT EXISTS `whatthefuck` (
  `id` bigint(20) NOT NULL auto_increment,
  `version` bigint(20) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Tabellenstruktur für Tabelle `xcap`
--

CREATE TABLE IF NOT EXISTS `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;

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

--
-- Tabellenstruktur für Tabelle `xcap_xml`
--

CREATE TABLE IF NOT EXISTS `xcap_xml` (
  `id` int(10) NOT NULL auto_increment,
  `username` varchar(66) NOT NULL,
  `domain` varchar(128) NOT NULL,
  `xcap` text NOT NULL,
  `doc_type` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `udd_xcap` (`username`,`domain`,`doc_type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
