mirror of
https://github.com/jambonz/sbc-sip-sidecar.git
synced 2026-01-24 22:27:52 +00:00
update jambonz sql
This commit is contained in:
@@ -4,12 +4,12 @@ SET FOREIGN_KEY_CHECKS=0;
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS account_static_ips;
|
DROP TABLE IF EXISTS account_static_ips;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS account_limits;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS account_products;
|
DROP TABLE IF EXISTS account_products;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS account_subscriptions;
|
DROP TABLE IF EXISTS account_subscriptions;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS account_limits;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS beta_invite_codes;
|
DROP TABLE IF EXISTS beta_invite_codes;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS call_routes;
|
DROP TABLE IF EXISTS call_routes;
|
||||||
@@ -20,6 +20,12 @@ DROP TABLE IF EXISTS lcr_carrier_set_entry;
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS lcr_routes;
|
DROP TABLE IF EXISTS lcr_routes;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS password_settings;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS user_permissions;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS permissions;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS predefined_sip_gateways;
|
DROP TABLE IF EXISTS predefined_sip_gateways;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS predefined_smpp_gateways;
|
DROP TABLE IF EXISTS predefined_smpp_gateways;
|
||||||
@@ -38,10 +44,10 @@ DROP TABLE IF EXISTS sbc_addresses;
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS ms_teams_tenants;
|
DROP TABLE IF EXISTS ms_teams_tenants;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS signup_history;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS service_provider_limits;
|
DROP TABLE IF EXISTS service_provider_limits;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS signup_history;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS smpp_addresses;
|
DROP TABLE IF EXISTS smpp_addresses;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS speech_credentials;
|
DROP TABLE IF EXISTS speech_credentials;
|
||||||
@@ -73,6 +79,15 @@ private_ipv4 VARBINARY(16) NOT NULL UNIQUE ,
|
|||||||
PRIMARY KEY (account_static_ip_sid)
|
PRIMARY KEY (account_static_ip_sid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE account_limits
|
||||||
|
(
|
||||||
|
account_limits_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
account_sid CHAR(36) NOT NULL,
|
||||||
|
category ENUM('api_rate','voice_call_session', 'device','voice_call_minutes','voice_call_session_license', 'voice_call_minutes_license') NOT NULL,
|
||||||
|
quantity INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (account_limits_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE account_subscriptions
|
CREATE TABLE account_subscriptions
|
||||||
(
|
(
|
||||||
account_subscription_sid CHAR(36) NOT NULL UNIQUE ,
|
account_subscription_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -92,15 +107,6 @@ pending_reason VARBINARY(52),
|
|||||||
PRIMARY KEY (account_subscription_sid)
|
PRIMARY KEY (account_subscription_sid)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE account_limits
|
|
||||||
(
|
|
||||||
account_limits_sid CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
account_sid CHAR(36) NOT NULL,
|
|
||||||
category ENUM('api_rate','voice_call_session', 'device') NOT NULL,
|
|
||||||
quantity INTEGER NOT NULL,
|
|
||||||
PRIMARY KEY (account_limits_sid)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE beta_invite_codes
|
CREATE TABLE beta_invite_codes
|
||||||
(
|
(
|
||||||
invite_code CHAR(6) NOT NULL UNIQUE ,
|
invite_code CHAR(6) NOT NULL UNIQUE ,
|
||||||
@@ -136,6 +142,21 @@ priority INTEGER NOT NULL UNIQUE COMMENT 'lower priority routes are attempted f
|
|||||||
PRIMARY KEY (lcr_route_sid)
|
PRIMARY KEY (lcr_route_sid)
|
||||||
) COMMENT='Least cost routing table';
|
) COMMENT='Least cost routing table';
|
||||||
|
|
||||||
|
CREATE TABLE password_settings
|
||||||
|
(
|
||||||
|
min_password_length INTEGER NOT NULL DEFAULT 8,
|
||||||
|
require_digit BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
require_special_character BOOLEAN NOT NULL DEFAULT false
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE permissions
|
||||||
|
(
|
||||||
|
permission_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
name VARCHAR(32) NOT NULL UNIQUE ,
|
||||||
|
description VARCHAR(255),
|
||||||
|
PRIMARY KEY (permission_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE predefined_carriers
|
CREATE TABLE predefined_carriers
|
||||||
(
|
(
|
||||||
predefined_carrier_sid CHAR(36) NOT NULL UNIQUE ,
|
predefined_carrier_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -228,6 +249,7 @@ sbc_address_sid CHAR(36) NOT NULL UNIQUE ,
|
|||||||
ipv4 VARCHAR(255) NOT NULL,
|
ipv4 VARCHAR(255) NOT NULL,
|
||||||
port INTEGER NOT NULL DEFAULT 5060,
|
port INTEGER NOT NULL DEFAULT 5060,
|
||||||
service_provider_sid CHAR(36),
|
service_provider_sid CHAR(36),
|
||||||
|
last_updated DATETIME,
|
||||||
PRIMARY KEY (sbc_address_sid)
|
PRIMARY KEY (sbc_address_sid)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -241,6 +263,15 @@ tenant_fqdn VARCHAR(255) NOT NULL UNIQUE ,
|
|||||||
PRIMARY KEY (ms_teams_tenant_sid)
|
PRIMARY KEY (ms_teams_tenant_sid)
|
||||||
) COMMENT='A Microsoft Teams customer tenant';
|
) COMMENT='A Microsoft Teams customer tenant';
|
||||||
|
|
||||||
|
CREATE TABLE service_provider_limits
|
||||||
|
(
|
||||||
|
service_provider_limits_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
service_provider_sid CHAR(36) NOT NULL,
|
||||||
|
category ENUM('api_rate','voice_call_session', 'device','voice_call_minutes','voice_call_session_license', 'voice_call_minutes_license') NOT NULL,
|
||||||
|
quantity INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (service_provider_limits_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE signup_history
|
CREATE TABLE signup_history
|
||||||
(
|
(
|
||||||
email VARCHAR(255) NOT NULL,
|
email VARCHAR(255) NOT NULL,
|
||||||
@@ -249,15 +280,6 @@ signed_up_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|||||||
PRIMARY KEY (email)
|
PRIMARY KEY (email)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE service_provider_limits
|
|
||||||
(
|
|
||||||
service_provider_limits_sid CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
service_provider_sid CHAR(36) NOT NULL,
|
|
||||||
category ENUM('api_rate','voice_call_session', 'device') NOT NULL,
|
|
||||||
quantity INTEGER NOT NULL,
|
|
||||||
PRIMARY KEY (service_provider_limits_sid)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE smpp_addresses
|
CREATE TABLE smpp_addresses
|
||||||
(
|
(
|
||||||
smpp_address_sid CHAR(36) NOT NULL UNIQUE ,
|
smpp_address_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -305,6 +327,7 @@ email_activation_code VARCHAR(16),
|
|||||||
email_validated BOOLEAN NOT NULL DEFAULT false,
|
email_validated BOOLEAN NOT NULL DEFAULT false,
|
||||||
phone_validated BOOLEAN NOT NULL DEFAULT false,
|
phone_validated BOOLEAN NOT NULL DEFAULT false,
|
||||||
email_content_opt_out BOOLEAN NOT NULL DEFAULT false,
|
email_content_opt_out BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||||
PRIMARY KEY (user_sid)
|
PRIMARY KEY (user_sid)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -333,11 +356,20 @@ smpp_enquire_link_interval INTEGER DEFAULT 0,
|
|||||||
smpp_inbound_system_id VARCHAR(255),
|
smpp_inbound_system_id VARCHAR(255),
|
||||||
smpp_inbound_password VARCHAR(64),
|
smpp_inbound_password VARCHAR(64),
|
||||||
register_from_user VARCHAR(128),
|
register_from_user VARCHAR(128),
|
||||||
register_from_domain VARBINARY(255),
|
register_from_domain VARCHAR(255),
|
||||||
register_public_ip_in_contact BOOLEAN NOT NULL DEFAULT false,
|
register_public_ip_in_contact BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
register_status VARCHAR(4096),
|
||||||
PRIMARY KEY (voip_carrier_sid)
|
PRIMARY KEY (voip_carrier_sid)
|
||||||
) COMMENT='A Carrier or customer PBX that can send or receive calls';
|
) COMMENT='A Carrier or customer PBX that can send or receive calls';
|
||||||
|
|
||||||
|
CREATE TABLE user_permissions
|
||||||
|
(
|
||||||
|
user_permissions_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
user_sid CHAR(36) NOT NULL,
|
||||||
|
permission_sid CHAR(36) NOT NULL,
|
||||||
|
PRIMARY KEY (user_permissions_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE smpp_gateways
|
CREATE TABLE smpp_gateways
|
||||||
(
|
(
|
||||||
smpp_gateway_sid CHAR(36) NOT NULL UNIQUE ,
|
smpp_gateway_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -355,7 +387,7 @@ PRIMARY KEY (smpp_gateway_sid)
|
|||||||
CREATE TABLE phone_numbers
|
CREATE TABLE phone_numbers
|
||||||
(
|
(
|
||||||
phone_number_sid CHAR(36) UNIQUE ,
|
phone_number_sid CHAR(36) UNIQUE ,
|
||||||
number VARCHAR(32) NOT NULL UNIQUE ,
|
number VARCHAR(132) NOT NULL UNIQUE ,
|
||||||
voip_carrier_sid CHAR(36),
|
voip_carrier_sid CHAR(36),
|
||||||
account_sid CHAR(36),
|
account_sid CHAR(36),
|
||||||
application_sid CHAR(36),
|
application_sid CHAR(36),
|
||||||
@@ -405,6 +437,7 @@ account_sid CHAR(36) COMMENT 'account that this application belongs to (if null,
|
|||||||
call_hook_sid CHAR(36) COMMENT 'webhook to call for inbound calls ',
|
call_hook_sid CHAR(36) COMMENT 'webhook to call for inbound calls ',
|
||||||
call_status_hook_sid CHAR(36) COMMENT 'webhook to call for call status events',
|
call_status_hook_sid CHAR(36) COMMENT 'webhook to call for call status events',
|
||||||
messaging_hook_sid CHAR(36) COMMENT 'webhook to call for inbound SMS/MMS ',
|
messaging_hook_sid CHAR(36) COMMENT 'webhook to call for inbound SMS/MMS ',
|
||||||
|
app_json TEXT,
|
||||||
speech_synthesis_vendor VARCHAR(64) NOT NULL DEFAULT 'google',
|
speech_synthesis_vendor VARCHAR(64) NOT NULL DEFAULT 'google',
|
||||||
speech_synthesis_language VARCHAR(12) NOT NULL DEFAULT 'en-US',
|
speech_synthesis_language VARCHAR(12) NOT NULL DEFAULT 'en-US',
|
||||||
speech_synthesis_voice VARCHAR(64),
|
speech_synthesis_voice VARCHAR(64),
|
||||||
@@ -455,12 +488,12 @@ CREATE INDEX account_static_ip_sid_idx ON account_static_ips (account_static_ip_
|
|||||||
CREATE INDEX account_sid_idx ON account_static_ips (account_sid);
|
CREATE INDEX account_sid_idx ON account_static_ips (account_sid);
|
||||||
ALTER TABLE account_static_ips ADD FOREIGN KEY account_sid_idxfk (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE account_static_ips ADD FOREIGN KEY account_sid_idxfk (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
|
CREATE INDEX account_sid_idx ON account_limits (account_sid);
|
||||||
|
ALTER TABLE account_limits ADD FOREIGN KEY account_sid_idxfk_1 (account_sid) REFERENCES accounts (account_sid) ON DELETE CASCADE;
|
||||||
|
|
||||||
CREATE INDEX account_subscription_sid_idx ON account_subscriptions (account_subscription_sid);
|
CREATE INDEX account_subscription_sid_idx ON account_subscriptions (account_subscription_sid);
|
||||||
CREATE INDEX account_sid_idx ON account_subscriptions (account_sid);
|
CREATE INDEX account_sid_idx ON account_subscriptions (account_sid);
|
||||||
ALTER TABLE account_subscriptions ADD FOREIGN KEY account_sid_idxfk_1 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE account_subscriptions ADD FOREIGN KEY account_sid_idxfk_2 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
CREATE INDEX account_sid_idx ON account_limits (account_sid);
|
|
||||||
ALTER TABLE account_limits ADD FOREIGN KEY account_sid_idxfk_2 (account_sid) REFERENCES accounts (account_sid) ON DELETE CASCADE;
|
|
||||||
|
|
||||||
CREATE INDEX invite_code_idx ON beta_invite_codes (invite_code);
|
CREATE INDEX invite_code_idx ON beta_invite_codes (invite_code);
|
||||||
CREATE INDEX call_route_sid_idx ON call_routes (call_route_sid);
|
CREATE INDEX call_route_sid_idx ON call_routes (call_route_sid);
|
||||||
@@ -471,6 +504,7 @@ ALTER TABLE call_routes ADD FOREIGN KEY application_sid_idxfk (application_sid)
|
|||||||
CREATE INDEX dns_record_sid_idx ON dns_records (dns_record_sid);
|
CREATE INDEX dns_record_sid_idx ON dns_records (dns_record_sid);
|
||||||
ALTER TABLE dns_records ADD FOREIGN KEY account_sid_idxfk_4 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE dns_records ADD FOREIGN KEY account_sid_idxfk_4 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
|
CREATE INDEX permission_sid_idx ON permissions (permission_sid);
|
||||||
CREATE INDEX predefined_carrier_sid_idx ON predefined_carriers (predefined_carrier_sid);
|
CREATE INDEX predefined_carrier_sid_idx ON predefined_carriers (predefined_carrier_sid);
|
||||||
CREATE INDEX predefined_sip_gateway_sid_idx ON predefined_sip_gateways (predefined_sip_gateway_sid);
|
CREATE INDEX predefined_sip_gateway_sid_idx ON predefined_sip_gateways (predefined_sip_gateway_sid);
|
||||||
CREATE INDEX predefined_carrier_sid_idx ON predefined_sip_gateways (predefined_carrier_sid);
|
CREATE INDEX predefined_carrier_sid_idx ON predefined_sip_gateways (predefined_carrier_sid);
|
||||||
@@ -515,10 +549,10 @@ ALTER TABLE ms_teams_tenants ADD FOREIGN KEY account_sid_idxfk_7 (account_sid) R
|
|||||||
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY application_sid_idxfk_1 (application_sid) REFERENCES applications (application_sid);
|
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY application_sid_idxfk_1 (application_sid) REFERENCES applications (application_sid);
|
||||||
|
|
||||||
CREATE INDEX tenant_fqdn_idx ON ms_teams_tenants (tenant_fqdn);
|
CREATE INDEX tenant_fqdn_idx ON ms_teams_tenants (tenant_fqdn);
|
||||||
CREATE INDEX email_idx ON signup_history (email);
|
|
||||||
CREATE INDEX service_provider_sid_idx ON service_provider_limits (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON service_provider_limits (service_provider_sid);
|
||||||
ALTER TABLE service_provider_limits ADD FOREIGN KEY service_provider_sid_idxfk_3 (service_provider_sid) REFERENCES service_providers (service_provider_sid) ON DELETE CASCADE;
|
ALTER TABLE service_provider_limits ADD FOREIGN KEY service_provider_sid_idxfk_3 (service_provider_sid) REFERENCES service_providers (service_provider_sid) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
CREATE INDEX email_idx ON signup_history (email);
|
||||||
CREATE INDEX smpp_address_sid_idx ON smpp_addresses (smpp_address_sid);
|
CREATE INDEX smpp_address_sid_idx ON smpp_addresses (smpp_address_sid);
|
||||||
CREATE INDEX service_provider_sid_idx ON smpp_addresses (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON smpp_addresses (service_provider_sid);
|
||||||
ALTER TABLE smpp_addresses ADD FOREIGN KEY service_provider_sid_idxfk_4 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE smpp_addresses ADD FOREIGN KEY service_provider_sid_idxfk_4 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
@@ -551,6 +585,12 @@ ALTER TABLE voip_carriers ADD FOREIGN KEY service_provider_sid_idxfk_7 (service_
|
|||||||
|
|
||||||
ALTER TABLE voip_carriers ADD FOREIGN KEY application_sid_idxfk_2 (application_sid) REFERENCES applications (application_sid);
|
ALTER TABLE voip_carriers ADD FOREIGN KEY application_sid_idxfk_2 (application_sid) REFERENCES applications (application_sid);
|
||||||
|
|
||||||
|
CREATE INDEX user_permissions_sid_idx ON user_permissions (user_permissions_sid);
|
||||||
|
CREATE INDEX user_sid_idx ON user_permissions (user_sid);
|
||||||
|
ALTER TABLE user_permissions ADD FOREIGN KEY user_sid_idxfk (user_sid) REFERENCES users (user_sid) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE user_permissions ADD FOREIGN KEY permission_sid_idxfk (permission_sid) REFERENCES permissions (permission_sid);
|
||||||
|
|
||||||
CREATE INDEX smpp_gateway_sid_idx ON smpp_gateways (smpp_gateway_sid);
|
CREATE INDEX smpp_gateway_sid_idx ON smpp_gateways (smpp_gateway_sid);
|
||||||
CREATE INDEX voip_carrier_sid_idx ON smpp_gateways (voip_carrier_sid);
|
CREATE INDEX voip_carrier_sid_idx ON smpp_gateways (voip_carrier_sid);
|
||||||
ALTER TABLE smpp_gateways ADD FOREIGN KEY voip_carrier_sid_idxfk (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
|
ALTER TABLE smpp_gateways ADD FOREIGN KEY voip_carrier_sid_idxfk (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
|
||||||
@@ -610,4 +650,4 @@ ALTER TABLE accounts ADD FOREIGN KEY device_calling_application_sid_idxfk (devic
|
|||||||
|
|
||||||
ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES applications (application_sid);
|
ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES applications (application_sid);
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS=1;
|
SET FOREIGN_KEY_CHECKS=1;
|
||||||
Reference in New Issue
Block a user