--
-- Table structure for table `Destinations`
--

CREATE TABLE Destinations (
  i_dest int(10) unsigned NOT NULL auto_increment,
  destination char(16) NOT NULL default '',
  iso_3166_1_a2 char(2) default '',
  i_country_subdivision smallint(5) unsigned default NULL,
  i_time_zone int(10) unsigned default NULL,
  description char(64) NOT NULL default '',
  i_group int(10) unsigned default '0',
  i_env tinyint(1) unsigned default '1',
  dest_type char(20) default NULL,
  PRIMARY KEY  (i_dest),
  UNIQUE KEY destination (destination,i_env),
  KEY iso_3166_1_a2 (iso_3166_1_a2),
  KEY Destinations_i_group (i_group),
  KEY dest_type (dest_type),
  KEY env_dest_i_dest_iso (destination,i_env,i_dest,iso_3166_1_a2)
) TYPE=InnoDB;

--
-- Table structure for table `Active_Calls`
--

CREATE TABLE Active_Calls (
  i_active_callleg int(10) unsigned NOT NULL auto_increment,
  h323_conf_id char(36) default NULL,
  call_id char(64) default NULL,
  i_env int(10) unsigned NOT NULL default '0',
  i_node int(10) unsigned NOT NULL default '0',
  call_type enum('VoIP','Telephony') NOT NULL default 'VoIP',
  call_origin enum('answer','originate') NOT NULL default 'answer',
  port char(32) NOT NULL default '',
  connect_time datetime NOT NULL default '0000-00-00 00:00:00',
  update_time datetime NOT NULL default '0000-00-00 00:00:00',
  disconnect_time datetime default NULL,
  CLI char(32) default NULL,
  CLD char(32) default NULL,
  i_account int(10) unsigned default NULL,
  i_customer int(10) unsigned default NULL,
  i_connection int(10) unsigned default NULL,
  PRIMARY KEY  (i_active_callleg)
) TYPE=InnoDB;

--
-- Table structure for table `Follow_Me`
--

CREATE TABLE Follow_Me (
  i_follow_me int(10) unsigned NOT NULL auto_increment,
  i_account int(10) unsigned NOT NULL default '0',
  mode enum('Never','Always','Unavail') default NULL,
  sequence enum('Order','Random','Simultaneous') default NULL,
  timeout smallint(4) unsigned default NULL,
  PRIMARY KEY  (i_follow_me),
  UNIQUE KEY i_account (i_account)
) TYPE=InnoDB;

--
-- Table structure for table `Rates`
--

CREATE TABLE Rates (
  i_tariff int(10) unsigned NOT NULL default '0',
  i_dest int(10) unsigned NOT NULL default '0',
  i_rate int(10) unsigned NOT NULL auto_increment,
  interval_1 smallint(5) unsigned NOT NULL default '1',
  interval_n smallint(5) unsigned NOT NULL default '1',
  price_1 decimal(15,5) unsigned default NULL,
  price_n decimal(15,5) unsigned default NULL,
  op_interval_1 smallint(5) unsigned NOT NULL default '1',
  op_interval_n smallint(5) unsigned NOT NULL default '1',
  op_price_1 decimal(15,5) unsigned default NULL,
  op_price_n decimal(15,5) unsigned default NULL,
  effective_from datetime NOT NULL default '0000-00-00 00:00:00',
  hidden char(1) NOT NULL default 'N',
  discontinued char(1) NOT NULL default 'N',
  forbidden char(1) NOT NULL default 'N',
  preference tinyint(1) unsigned NOT NULL default '5',
  huntstop char(1) NOT NULL default 'N',
  lot_time int(10) default NULL,
  formula varchar(255) default NULL,
  fake_rate char(1) NOT NULL default 'Y',
  i_master_rate int(10) unsigned default NULL,
  route_category tinyint(1) unsigned default NULL,
  op_route_category tinyint(1) unsigned default NULL,
  op_preference tinyint(1) unsigned default NULL,
  op_huntstop char(1) default 'N',
  PRIMARY KEY  (i_rate),
  KEY Rates_dest_index (i_dest),
  KEY Rates_i_tariff (i_tariff),
  KEY Rates_effective_from (effective_from),
  KEY master_rate (i_master_rate),
  KEY Rates_route_category (route_category,op_route_category),
  KEY tar_dest_effrom_rate (i_tariff,i_dest,effective_from,discontinued,i_rate)
) TYPE=InnoDB PACK_KEYS=1;

--
-- Table structure for table `Service_Attribute_Values`
--

CREATE TABLE Service_Attribute_Values (
  i_savalue int(10) NOT NULL auto_increment,
  i_sattribute int(10) NOT NULL default '0',
  i_foreign int(10) NOT NULL default '0',
  value char(255) default NULL,
  ord tinyint(4) default NULL,
  PRIMARY KEY  (i_savalue),
  KEY savalue_sattribute (i_sattribute,i_foreign)
) TYPE=MyISAM;


