mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
deps
This commit is contained in:
1006
package-lock.json
generated
1006
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jambonz-feature-server",
|
"name": "jambonz-feature-server",
|
||||||
"version": "0.2.3",
|
"version": "0.2.4",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10.16.0"
|
"node": ">= 10.16.0"
|
||||||
@@ -26,29 +26,29 @@
|
|||||||
"jslint": "eslint app.js lib"
|
"jslint": "eslint app.js lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bent": "^7.0.6",
|
"@jambonz/db-helpers": "^0.4.1",
|
||||||
|
"@jambonz/realtimedb-helpers": "^0.2.16",
|
||||||
|
"@jambonz/stats-collector": "^0.0.4",
|
||||||
|
"bent": "^7.3.7",
|
||||||
"cidr-matcher": "^2.1.1",
|
"cidr-matcher": "^2.1.1",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"drachtio-fsmrf": "^2.0.1",
|
"drachtio-fsmrf": "^2.0.1",
|
||||||
"drachtio-srf": "^4.4.36",
|
"drachtio-srf": "^4.4.36",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"ip": "^1.1.5",
|
"ip": "^1.1.5",
|
||||||
"@jambonz/db-helpers": "^0.3.7",
|
|
||||||
"jambonz-mw-registrar": "^0.1.3",
|
"jambonz-mw-registrar": "^0.1.3",
|
||||||
"@jambonz/realtimedb-helpers": "^0.2.16",
|
"moment": "^2.27.0",
|
||||||
"@jambonz/stats-collector": "^0.0.4",
|
|
||||||
"moment": "^2.24.0",
|
|
||||||
"parse-url": "^5.0.1",
|
"parse-url": "^5.0.1",
|
||||||
"pino": "^5.16.0",
|
"pino": "^6.4.0",
|
||||||
"verify-aws-sns-signature": "0.0.5",
|
"verify-aws-sns-signature": "^0.0.6",
|
||||||
"xml2js": "^0.4.23"
|
"xml2js": "^0.4.23"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"blue-tape": "^1.0.0",
|
"blue-tape": "^1.0.0",
|
||||||
"clear-module": "^4.1.1",
|
"clear-module": "^4.1.1",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^7.4.0",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"nyc": "^15.0.1",
|
"nyc": "^15.1.0",
|
||||||
"tap-spec": "^5.0.0"
|
"tap-spec": "^5.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,272 +1,257 @@
|
|||||||
/* SQLEditor (MySQL (2))*/
|
/* SQLEditor (MySQL (2))*/
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `call_routes`;
|
DROP TABLE IF EXISTS call_routes;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `conference_participants`;
|
DROP TABLE IF EXISTS lcr_carrier_set_entry;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `queue_members`;
|
DROP TABLE IF EXISTS lcr_routes;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `calls`;
|
DROP TABLE IF EXISTS api_keys;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `phone_numbers`;
|
DROP TABLE IF EXISTS ms_teams_tenants;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `applications`;
|
DROP TABLE IF EXISTS sbc_addresses;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `conferences`;
|
DROP TABLE IF EXISTS users;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `queues`;
|
DROP TABLE IF EXISTS phone_numbers;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `subscriptions`;
|
DROP TABLE IF EXISTS sip_gateways;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `registrations`;
|
DROP TABLE IF EXISTS voip_carriers;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `api_keys`;
|
DROP TABLE IF EXISTS accounts;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `accounts`;
|
DROP TABLE IF EXISTS applications;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `service_providers`;
|
DROP TABLE IF EXISTS service_providers;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `sip_gateways`;
|
DROP TABLE IF EXISTS webhooks;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `voip_carriers`;
|
CREATE TABLE call_routes
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `applications`
|
|
||||||
(
|
(
|
||||||
`application_sid` CHAR(36) NOT NULL UNIQUE ,
|
call_route_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
`name` VARCHAR(255) NOT NULL,
|
priority INTEGER NOT NULL,
|
||||||
`account_sid` CHAR(36) NOT NULL,
|
account_sid CHAR(36) NOT NULL,
|
||||||
`call_hook` VARCHAR(255) NOT NULL,
|
regex VARCHAR(255) NOT NULL,
|
||||||
`call_status_hook` VARCHAR(255) NOT NULL,
|
application_sid CHAR(36) NOT NULL,
|
||||||
PRIMARY KEY (`application_sid`)
|
PRIMARY KEY (call_route_sid)
|
||||||
) ENGINE=InnoDB COMMENT='A defined set of behaviors to be applied to phone calls with';
|
) ENGINE=InnoDB COMMENT='a regex-based pattern match for call routing';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `call_routes`
|
CREATE TABLE lcr_routes
|
||||||
(
|
(
|
||||||
`call_route_sid` CHAR(36) NOT NULL UNIQUE ,
|
lcr_route_sid CHAR(36),
|
||||||
`order` INTEGER NOT NULL,
|
regex VARCHAR(32) NOT NULL COMMENT 'regex-based pattern match against dialed number, used for LCR routing of PSTN calls',
|
||||||
`account_sid` CHAR(36) NOT NULL,
|
description VARCHAR(1024),
|
||||||
`regex` VARCHAR(255) NOT NULL,
|
priority INTEGER NOT NULL UNIQUE COMMENT 'lower priority routes are attempted first',
|
||||||
`application_sid` CHAR(36) NOT NULL,
|
PRIMARY KEY (lcr_route_sid)
|
||||||
PRIMARY KEY (`call_route_sid`)
|
) COMMENT='Least cost routing table';
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `conferences`
|
CREATE TABLE api_keys
|
||||||
(
|
(
|
||||||
`id` INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE ,
|
api_key_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
`conference_sid` CHAR(36) NOT NULL UNIQUE ,
|
token CHAR(36) NOT NULL UNIQUE ,
|
||||||
`name` VARCHAR(255),
|
account_sid CHAR(36),
|
||||||
PRIMARY KEY (`id`)
|
service_provider_sid CHAR(36),
|
||||||
) ENGINE=InnoDB COMMENT='An audio conference';
|
expires_at TIMESTAMP,
|
||||||
|
PRIMARY KEY (api_key_sid)
|
||||||
CREATE TABLE IF NOT EXISTS `conference_participants`
|
|
||||||
(
|
|
||||||
`conference_participant_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`call_sid` CHAR(36),
|
|
||||||
`conference_sid` CHAR(36) NOT NULL,
|
|
||||||
PRIMARY KEY (`conference_participant_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='A relationship between a call and a conference that it is co';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `queues`
|
|
||||||
(
|
|
||||||
`id` INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE ,
|
|
||||||
`queue_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`name` VARCHAR(255),
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB COMMENT='A set of behaviors to be applied to parked calls';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registrations`
|
|
||||||
(
|
|
||||||
`registration_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`username` VARCHAR(255) NOT NULL,
|
|
||||||
`domain` VARCHAR(255) NOT NULL,
|
|
||||||
`sip_contact` VARCHAR(255) NOT NULL,
|
|
||||||
`sip_user_agent` VARCHAR(255),
|
|
||||||
PRIMARY KEY (`registration_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='An active sip registration';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `queue_members`
|
|
||||||
(
|
|
||||||
`queue_member_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`call_sid` CHAR(36),
|
|
||||||
`queue_sid` CHAR(36) NOT NULL,
|
|
||||||
`position` INTEGER,
|
|
||||||
PRIMARY KEY (`queue_member_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='A relationship between a call and a queue that it is waiting';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `calls`
|
|
||||||
(
|
|
||||||
`call_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`parent_call_sid` CHAR(36),
|
|
||||||
`application_sid` CHAR(36),
|
|
||||||
`status_url` VARCHAR(255),
|
|
||||||
`time_start` DATETIME NOT NULL,
|
|
||||||
`time_alerting` DATETIME,
|
|
||||||
`time_answered` DATETIME,
|
|
||||||
`time_ended` DATETIME,
|
|
||||||
`direction` ENUM('inbound','outbound'),
|
|
||||||
`phone_number_sid` CHAR(36),
|
|
||||||
`inbound_user_sid` CHAR(36),
|
|
||||||
`outbound_user_sid` CHAR(36),
|
|
||||||
`calling_number` VARCHAR(255),
|
|
||||||
`called_number` VARCHAR(255),
|
|
||||||
`caller_name` VARCHAR(255),
|
|
||||||
`status` VARCHAR(255) NOT NULL COMMENT 'Possible values are queued, ringing, in-progress, completed, failed, busy and no-answer',
|
|
||||||
`sip_uri` VARCHAR(255) NOT NULL,
|
|
||||||
`sip_call_id` VARCHAR(255) NOT NULL,
|
|
||||||
`sip_cseq` INTEGER NOT NULL,
|
|
||||||
`sip_from_tag` VARCHAR(255) NOT NULL,
|
|
||||||
`sip_via_branch` VARCHAR(255) NOT NULL,
|
|
||||||
`sip_contact` VARCHAR(255),
|
|
||||||
`sip_final_status` INTEGER UNSIGNED,
|
|
||||||
`sdp_offer` VARCHAR(4096),
|
|
||||||
`sdp_answer` VARCHAR(4096),
|
|
||||||
`source_address` VARCHAR(255) NOT NULL,
|
|
||||||
`source_port` INTEGER UNSIGNED NOT NULL,
|
|
||||||
`dest_address` VARCHAR(255),
|
|
||||||
`dest_port` INTEGER UNSIGNED,
|
|
||||||
`url` VARCHAR(255),
|
|
||||||
PRIMARY KEY (`call_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='A phone call';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `service_providers`
|
|
||||||
(
|
|
||||||
`service_provider_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`name` VARCHAR(255) NOT NULL UNIQUE ,
|
|
||||||
`description` VARCHAR(255),
|
|
||||||
`root_domain` VARCHAR(255) UNIQUE ,
|
|
||||||
`registration_hook` VARCHAR(255),
|
|
||||||
`hook_basic_auth_user` VARCHAR(255),
|
|
||||||
`hook_basic_auth_password` VARCHAR(255),
|
|
||||||
PRIMARY KEY (`service_provider_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='An organization that provides communication services to its ';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `api_keys`
|
|
||||||
(
|
|
||||||
`api_key_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`token` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`account_sid` CHAR(36),
|
|
||||||
`service_provider_sid` CHAR(36),
|
|
||||||
PRIMARY KEY (`api_key_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='An authorization token that is used to access the REST api';
|
) ENGINE=InnoDB COMMENT='An authorization token that is used to access the REST api';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `accounts`
|
CREATE TABLE ms_teams_tenants
|
||||||
(
|
(
|
||||||
`account_sid` CHAR(36) NOT NULL UNIQUE ,
|
ms_teams_tenant_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
`name` VARCHAR(255) NOT NULL,
|
service_provider_sid CHAR(36) NOT NULL,
|
||||||
`sip_realm` VARCHAR(255) UNIQUE ,
|
account_sid CHAR(36) NOT NULL,
|
||||||
`service_provider_sid` CHAR(36) NOT NULL,
|
application_sid CHAR(36),
|
||||||
`registration_hook` VARCHAR(255),
|
tenant_fqdn VARCHAR(255) NOT NULL UNIQUE ,
|
||||||
`hook_basic_auth_user` VARCHAR(255),
|
PRIMARY KEY (ms_teams_tenant_sid)
|
||||||
`hook_basic_auth_password` VARCHAR(255),
|
) COMMENT='A Microsoft Teams customer tenant';
|
||||||
`is_active` BOOLEAN NOT NULL DEFAULT true,
|
|
||||||
PRIMARY KEY (`account_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='A single end-user of the platform';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `subscriptions`
|
CREATE TABLE sbc_addresses
|
||||||
(
|
(
|
||||||
`id` INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE ,
|
sbc_address_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
`subscription_sid` CHAR(36) NOT NULL UNIQUE ,
|
ipv4 VARCHAR(255) NOT NULL,
|
||||||
`registration_sid` CHAR(36) NOT NULL,
|
port INTEGER NOT NULL DEFAULT 5060,
|
||||||
`event` VARCHAR(255),
|
service_provider_sid CHAR(36),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (sbc_address_sid)
|
||||||
) ENGINE=InnoDB COMMENT='An active sip subscription';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `voip_carriers`
|
|
||||||
(
|
|
||||||
`voip_carrier_sid` CHAR(36) NOT NULL UNIQUE ,
|
|
||||||
`name` VARCHAR(255) NOT NULL UNIQUE ,
|
|
||||||
`description` VARCHAR(255),
|
|
||||||
PRIMARY KEY (`voip_carrier_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='An external organization that can provide sip trunking and D';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `phone_numbers`
|
|
||||||
(
|
|
||||||
`phone_number_sid` CHAR(36) UNIQUE ,
|
|
||||||
`number` VARCHAR(255) NOT NULL UNIQUE ,
|
|
||||||
`voip_carrier_sid` CHAR(36) NOT NULL,
|
|
||||||
`account_sid` CHAR(36),
|
|
||||||
`application_sid` CHAR(36),
|
|
||||||
PRIMARY KEY (`phone_number_sid`)
|
|
||||||
) ENGINE=InnoDB COMMENT='A phone number that has been assigned to an account';
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `sip_gateways`
|
|
||||||
(
|
|
||||||
`sip_gateway_sid` CHAR(36),
|
|
||||||
`ipv4` VARCHAR(32) NOT NULL,
|
|
||||||
`port` INTEGER NOT NULL DEFAULT 5060,
|
|
||||||
`inbound` BOOLEAN NOT NULL,
|
|
||||||
`outbound` BOOLEAN NOT NULL,
|
|
||||||
`voip_carrier_sid` CHAR(36) NOT NULL,
|
|
||||||
`is_active` BOOLEAN NOT NULL DEFAULT true,
|
|
||||||
PRIMARY KEY (`sip_gateway_sid`)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE UNIQUE INDEX `applications_idx_name` ON `applications` (`account_sid`,`name`);
|
CREATE TABLE users
|
||||||
|
(
|
||||||
|
user_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
name CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
hashed_password VARCHAR(1024) NOT NULL,
|
||||||
|
salt CHAR(16) NOT NULL,
|
||||||
|
force_change BOOLEAN NOT NULL DEFAULT TRUE,
|
||||||
|
PRIMARY KEY (user_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE INDEX `applications_application_sid_idx` ON `applications` (`application_sid`);
|
CREATE TABLE voip_carriers
|
||||||
CREATE INDEX `applications_name_idx` ON `applications` (`name`);
|
(
|
||||||
CREATE INDEX `applications_account_sid_idx` ON `applications` (`account_sid`);
|
voip_carrier_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
ALTER TABLE `applications` ADD FOREIGN KEY account_sid_idxfk (`account_sid`) REFERENCES `accounts` (`account_sid`);
|
name VARCHAR(64) NOT NULL UNIQUE ,
|
||||||
|
description VARCHAR(255),
|
||||||
|
account_sid CHAR(36) COMMENT 'if provided, indicates this entity represents a customer PBX that is associated with a specific account',
|
||||||
|
application_sid CHAR(36) COMMENT 'If provided, all incoming calls from this source will be routed to the associated application',
|
||||||
|
e164_leading_plus BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
PRIMARY KEY (voip_carrier_sid)
|
||||||
|
) ENGINE=InnoDB COMMENT='A Carrier or customer PBX that can send or receive calls';
|
||||||
|
|
||||||
CREATE INDEX `call_routes_call_route_sid_idx` ON `call_routes` (`call_route_sid`);
|
CREATE TABLE phone_numbers
|
||||||
ALTER TABLE `call_routes` ADD FOREIGN KEY account_sid_idxfk_1 (`account_sid`) REFERENCES `accounts` (`account_sid`);
|
(
|
||||||
|
phone_number_sid CHAR(36) UNIQUE ,
|
||||||
|
number VARCHAR(32) NOT NULL UNIQUE ,
|
||||||
|
voip_carrier_sid CHAR(36) NOT NULL,
|
||||||
|
account_sid CHAR(36),
|
||||||
|
application_sid CHAR(36),
|
||||||
|
PRIMARY KEY (phone_number_sid)
|
||||||
|
) ENGINE=InnoDB COMMENT='A phone number that has been assigned to an account';
|
||||||
|
|
||||||
ALTER TABLE `call_routes` ADD FOREIGN KEY application_sid_idxfk (`application_sid`) REFERENCES `applications` (`application_sid`);
|
CREATE TABLE webhooks
|
||||||
|
(
|
||||||
|
webhook_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
url VARCHAR(1024) NOT NULL,
|
||||||
|
method ENUM("GET","POST") NOT NULL DEFAULT 'POST',
|
||||||
|
username VARCHAR(255),
|
||||||
|
password VARCHAR(255),
|
||||||
|
PRIMARY KEY (webhook_sid)
|
||||||
|
) COMMENT='An HTTP callback';
|
||||||
|
|
||||||
CREATE INDEX `conferences_conference_sid_idx` ON `conferences` (`conference_sid`);
|
CREATE TABLE sip_gateways
|
||||||
CREATE INDEX `conference_participants_conference_participant_sid_idx` ON `conference_participants` (`conference_participant_sid`);
|
(
|
||||||
ALTER TABLE `conference_participants` ADD FOREIGN KEY call_sid_idxfk (`call_sid`) REFERENCES `calls` (`call_sid`);
|
sip_gateway_sid CHAR(36),
|
||||||
|
ipv4 VARCHAR(128) NOT NULL COMMENT 'ip address or DNS name of the gateway. For gateways providing inbound calling service, ip address is required.',
|
||||||
|
port INTEGER NOT NULL DEFAULT 5060 COMMENT 'sip signaling port',
|
||||||
|
inbound BOOLEAN NOT NULL COMMENT 'if true, whitelist this IP to allow inbound calls from the gateway',
|
||||||
|
outbound BOOLEAN NOT NULL COMMENT 'if true, include in least-cost routing when placing calls to the PSTN',
|
||||||
|
voip_carrier_sid CHAR(36) NOT NULL,
|
||||||
|
is_active BOOLEAN NOT NULL DEFAULT 1,
|
||||||
|
PRIMARY KEY (sip_gateway_sid)
|
||||||
|
) COMMENT='A whitelisted sip gateway used for origination/termination';
|
||||||
|
|
||||||
ALTER TABLE `conference_participants` ADD FOREIGN KEY conference_sid_idxfk (`conference_sid`) REFERENCES `conferences` (`conference_sid`);
|
CREATE TABLE lcr_carrier_set_entry
|
||||||
|
(
|
||||||
|
lcr_carrier_set_entry_sid CHAR(36),
|
||||||
|
workload INTEGER NOT NULL DEFAULT 1 COMMENT 'represents a proportion of traffic to send through the associated carrier; can be used for load balancing traffic across carriers with a common priority for a destination',
|
||||||
|
lcr_route_sid CHAR(36) NOT NULL,
|
||||||
|
voip_carrier_sid CHAR(36) NOT NULL,
|
||||||
|
priority INTEGER NOT NULL DEFAULT 0 COMMENT 'lower priority carriers are attempted first',
|
||||||
|
PRIMARY KEY (lcr_carrier_set_entry_sid)
|
||||||
|
) COMMENT='An entry in the LCR routing list';
|
||||||
|
|
||||||
CREATE INDEX `queues_queue_sid_idx` ON `queues` (`queue_sid`);
|
CREATE TABLE applications
|
||||||
CREATE INDEX `registrations_registration_sid_idx` ON `registrations` (`registration_sid`);
|
(
|
||||||
CREATE INDEX `queue_members_queue_member_sid_idx` ON `queue_members` (`queue_member_sid`);
|
application_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
ALTER TABLE `queue_members` ADD FOREIGN KEY call_sid_idxfk_1 (`call_sid`) REFERENCES `calls` (`call_sid`);
|
name VARCHAR(64) NOT NULL,
|
||||||
|
account_sid CHAR(36) NOT NULL COMMENT 'account that this application belongs to',
|
||||||
|
call_hook_sid CHAR(36) COMMENT 'webhook to call for inbound calls to phone numbers owned by this account',
|
||||||
|
call_status_hook_sid CHAR(36) COMMENT 'webhook to call for call status events',
|
||||||
|
speech_synthesis_vendor VARCHAR(64) NOT NULL DEFAULT 'google',
|
||||||
|
speech_synthesis_language VARCHAR(12) NOT NULL DEFAULT 'en-US',
|
||||||
|
speech_synthesis_voice VARCHAR(64),
|
||||||
|
speech_recognizer_vendor VARCHAR(64) NOT NULL DEFAULT 'google',
|
||||||
|
speech_recognizer_language VARCHAR(64) NOT NULL DEFAULT 'en-US',
|
||||||
|
PRIMARY KEY (application_sid)
|
||||||
|
) ENGINE=InnoDB COMMENT='A defined set of behaviors to be applied to phone calls ';
|
||||||
|
|
||||||
ALTER TABLE `queue_members` ADD FOREIGN KEY queue_sid_idxfk (`queue_sid`) REFERENCES `queues` (`queue_sid`);
|
CREATE TABLE service_providers
|
||||||
|
(
|
||||||
|
service_provider_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
name VARCHAR(64) NOT NULL UNIQUE ,
|
||||||
|
description VARCHAR(255),
|
||||||
|
root_domain VARCHAR(128) UNIQUE ,
|
||||||
|
registration_hook_sid CHAR(36),
|
||||||
|
ms_teams_fqdn VARCHAR(255),
|
||||||
|
PRIMARY KEY (service_provider_sid)
|
||||||
|
) ENGINE=InnoDB COMMENT='A partition of the platform used by one service provider';
|
||||||
|
|
||||||
CREATE INDEX `calls_call_sid_idx` ON `calls` (`call_sid`);
|
CREATE TABLE accounts
|
||||||
ALTER TABLE `calls` ADD FOREIGN KEY parent_call_sid_idxfk (`parent_call_sid`) REFERENCES `calls` (`call_sid`);
|
(
|
||||||
|
account_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
name VARCHAR(64) NOT NULL,
|
||||||
|
sip_realm VARCHAR(132) UNIQUE COMMENT 'sip domain that will be used for devices registering under this account',
|
||||||
|
service_provider_sid CHAR(36) NOT NULL COMMENT 'service provider that owns the customer relationship with this account',
|
||||||
|
registration_hook_sid CHAR(36) COMMENT 'webhook to call when devices underr this account attempt to register',
|
||||||
|
device_calling_application_sid CHAR(36) COMMENT 'application to use for outbound calling from an account',
|
||||||
|
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||||
|
PRIMARY KEY (account_sid)
|
||||||
|
) ENGINE=InnoDB COMMENT='An enterprise that uses the platform for comm services';
|
||||||
|
|
||||||
ALTER TABLE `calls` ADD FOREIGN KEY application_sid_idxfk_1 (`application_sid`) REFERENCES `applications` (`application_sid`);
|
CREATE INDEX call_route_sid_idx ON call_routes (call_route_sid);
|
||||||
|
ALTER TABLE call_routes ADD FOREIGN KEY account_sid_idxfk (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
CREATE INDEX `calls_phone_number_sid_idx` ON `calls` (`phone_number_sid`);
|
ALTER TABLE call_routes ADD FOREIGN KEY application_sid_idxfk (application_sid) REFERENCES applications (application_sid);
|
||||||
ALTER TABLE `calls` ADD FOREIGN KEY phone_number_sid_idxfk (`phone_number_sid`) REFERENCES `phone_numbers` (`phone_number_sid`);
|
|
||||||
|
|
||||||
ALTER TABLE `calls` ADD FOREIGN KEY inbound_user_sid_idxfk (`inbound_user_sid`) REFERENCES `registrations` (`registration_sid`);
|
CREATE INDEX api_key_sid_idx ON api_keys (api_key_sid);
|
||||||
|
CREATE INDEX account_sid_idx ON api_keys (account_sid);
|
||||||
|
ALTER TABLE api_keys ADD FOREIGN KEY account_sid_idxfk_1 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
ALTER TABLE `calls` ADD FOREIGN KEY outbound_user_sid_idxfk (`outbound_user_sid`) REFERENCES `registrations` (`registration_sid`);
|
CREATE INDEX service_provider_sid_idx ON api_keys (service_provider_sid);
|
||||||
|
ALTER TABLE api_keys ADD FOREIGN KEY service_provider_sid_idxfk (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
CREATE INDEX `service_providers_service_provider_sid_idx` ON `service_providers` (`service_provider_sid`);
|
CREATE INDEX ms_teams_tenant_sid_idx ON ms_teams_tenants (ms_teams_tenant_sid);
|
||||||
CREATE INDEX `service_providers_name_idx` ON `service_providers` (`name`);
|
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY service_provider_sid_idxfk_1 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
CREATE INDEX `service_providers_root_domain_idx` ON `service_providers` (`root_domain`);
|
|
||||||
CREATE INDEX `api_keys_api_key_sid_idx` ON `api_keys` (`api_key_sid`);
|
|
||||||
CREATE INDEX `api_keys_account_sid_idx` ON `api_keys` (`account_sid`);
|
|
||||||
ALTER TABLE `api_keys` ADD FOREIGN KEY account_sid_idxfk_2 (`account_sid`) REFERENCES `accounts` (`account_sid`);
|
|
||||||
|
|
||||||
CREATE INDEX `api_keys_service_provider_sid_idx` ON `api_keys` (`service_provider_sid`);
|
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY account_sid_idxfk_2 (account_sid) REFERENCES accounts (account_sid);
|
||||||
ALTER TABLE `api_keys` ADD FOREIGN KEY service_provider_sid_idxfk (`service_provider_sid`) REFERENCES `service_providers` (`service_provider_sid`);
|
|
||||||
|
|
||||||
CREATE INDEX `accounts_account_sid_idx` ON `accounts` (`account_sid`);
|
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY application_sid_idxfk_1 (application_sid) REFERENCES applications (application_sid);
|
||||||
CREATE INDEX `accounts_name_idx` ON `accounts` (`name`);
|
|
||||||
CREATE INDEX `accounts_sip_realm_idx` ON `accounts` (`sip_realm`);
|
|
||||||
CREATE INDEX `accounts_service_provider_sid_idx` ON `accounts` (`service_provider_sid`);
|
|
||||||
ALTER TABLE `accounts` ADD FOREIGN KEY service_provider_sid_idxfk_1 (`service_provider_sid`) REFERENCES `service_providers` (`service_provider_sid`);
|
|
||||||
|
|
||||||
ALTER TABLE `subscriptions` ADD FOREIGN KEY registration_sid_idxfk (`registration_sid`) REFERENCES `registrations` (`registration_sid`);
|
CREATE INDEX tenant_fqdn_idx ON ms_teams_tenants (tenant_fqdn);
|
||||||
|
CREATE INDEX sbc_addresses_idx_host_port ON sbc_addresses (ipv4,port);
|
||||||
|
|
||||||
CREATE INDEX `voip_carriers_voip_carrier_sid_idx` ON `voip_carriers` (`voip_carrier_sid`);
|
CREATE INDEX sbc_address_sid_idx ON sbc_addresses (sbc_address_sid);
|
||||||
CREATE INDEX `voip_carriers_name_idx` ON `voip_carriers` (`name`);
|
CREATE INDEX service_provider_sid_idx ON sbc_addresses (service_provider_sid);
|
||||||
CREATE INDEX `phone_numbers_phone_number_sid_idx` ON `phone_numbers` (`phone_number_sid`);
|
ALTER TABLE sbc_addresses ADD FOREIGN KEY service_provider_sid_idxfk_2 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
CREATE INDEX `phone_numbers_voip_carrier_sid_idx` ON `phone_numbers` (`voip_carrier_sid`);
|
|
||||||
ALTER TABLE `phone_numbers` ADD FOREIGN KEY voip_carrier_sid_idxfk (`voip_carrier_sid`) REFERENCES `voip_carriers` (`voip_carrier_sid`);
|
|
||||||
|
|
||||||
ALTER TABLE `phone_numbers` ADD FOREIGN KEY account_sid_idxfk_3 (`account_sid`) REFERENCES `accounts` (`account_sid`);
|
CREATE INDEX user_sid_idx ON users (user_sid);
|
||||||
|
CREATE INDEX name_idx ON users (name);
|
||||||
|
CREATE INDEX voip_carrier_sid_idx ON voip_carriers (voip_carrier_sid);
|
||||||
|
CREATE INDEX name_idx ON voip_carriers (name);
|
||||||
|
ALTER TABLE voip_carriers ADD FOREIGN KEY account_sid_idxfk_3 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
ALTER TABLE `phone_numbers` 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 UNIQUE INDEX `sip_gateways_sip_gateway_idx_hostport` ON `sip_gateways` (`ipv4`,`port`);
|
CREATE INDEX phone_number_sid_idx ON phone_numbers (phone_number_sid);
|
||||||
|
CREATE INDEX voip_carrier_sid_idx ON phone_numbers (voip_carrier_sid);
|
||||||
|
ALTER TABLE phone_numbers ADD FOREIGN KEY voip_carrier_sid_idxfk (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
|
||||||
|
|
||||||
ALTER TABLE `sip_gateways` ADD FOREIGN KEY voip_carrier_sid_idxfk_1 (`voip_carrier_sid`) REFERENCES `voip_carriers` (`voip_carrier_sid`);
|
ALTER TABLE phone_numbers ADD FOREIGN KEY account_sid_idxfk_4 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
|
ALTER TABLE phone_numbers ADD FOREIGN KEY application_sid_idxfk_3 (application_sid) REFERENCES applications (application_sid);
|
||||||
|
|
||||||
|
CREATE INDEX webhook_sid_idx ON webhooks (webhook_sid);
|
||||||
|
CREATE UNIQUE INDEX sip_gateway_idx_hostport ON sip_gateways (ipv4,port);
|
||||||
|
|
||||||
|
ALTER TABLE sip_gateways ADD FOREIGN KEY voip_carrier_sid_idxfk_1 (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
|
||||||
|
|
||||||
|
ALTER TABLE lcr_carrier_set_entry ADD FOREIGN KEY lcr_route_sid_idxfk (lcr_route_sid) REFERENCES lcr_routes (lcr_route_sid);
|
||||||
|
|
||||||
|
ALTER TABLE lcr_carrier_set_entry ADD FOREIGN KEY voip_carrier_sid_idxfk_2 (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX applications_idx_name ON applications (account_sid,name);
|
||||||
|
|
||||||
|
CREATE INDEX application_sid_idx ON applications (application_sid);
|
||||||
|
CREATE INDEX account_sid_idx ON applications (account_sid);
|
||||||
|
ALTER TABLE applications ADD FOREIGN KEY account_sid_idxfk_5 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
|
ALTER TABLE applications ADD FOREIGN KEY call_hook_sid_idxfk (call_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
|
ALTER TABLE applications ADD FOREIGN KEY call_status_hook_sid_idxfk (call_status_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
|
CREATE INDEX service_provider_sid_idx ON service_providers (service_provider_sid);
|
||||||
|
CREATE INDEX name_idx ON service_providers (name);
|
||||||
|
CREATE INDEX root_domain_idx ON service_providers (root_domain);
|
||||||
|
ALTER TABLE service_providers ADD FOREIGN KEY registration_hook_sid_idxfk (registration_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
|
CREATE INDEX account_sid_idx ON accounts (account_sid);
|
||||||
|
CREATE INDEX sip_realm_idx ON accounts (sip_realm);
|
||||||
|
CREATE INDEX service_provider_sid_idx ON accounts (service_provider_sid);
|
||||||
|
ALTER TABLE accounts ADD FOREIGN KEY service_provider_sid_idxfk_3 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
|
ALTER TABLE accounts ADD FOREIGN KEY registration_hook_sid_idxfk_1 (registration_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
|
ALTER TABLE accounts ADD FOREIGN KEY device_calling_application_sid_idxfk (device_calling_application_sid) REFERENCES applications (application_sid);
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS=1;
|
||||||
|
|||||||
Reference in New Issue
Block a user