mirror of
https://github.com/jambonz/sbc-sip-sidecar.git
synced 2026-10-04 02:04:20 +00:00
enhancements to allow customization of from header and domain/ip in Contact
This commit is contained in:
+2
-2
@@ -86,7 +86,7 @@ const checkAccountLimits = (logger) => {
|
|||||||
debug('checkAccountLimits: device calling not allowed for this account');
|
debug('checkAccountLimits: device calling not allowed for this account');
|
||||||
logger.info({account_sid}, 'checkAccountLimits: device calling not allowed for this account');
|
logger.info({account_sid}, 'checkAccountLimits: device calling not allowed for this account');
|
||||||
writeAlerts({
|
writeAlerts({
|
||||||
alert_type: AlertType.DEVICE_LIMIT,
|
alert_type: AlertType.ACCOUNT_DEVICE_LIMIT,
|
||||||
account_sid,
|
account_sid,
|
||||||
count: 0
|
count: 0
|
||||||
}).catch((err) => logger.info({err}, 'checkAccountLimits: error writing alert'));
|
}).catch((err) => logger.info({err}, 'checkAccountLimits: error writing alert'));
|
||||||
@@ -99,7 +99,7 @@ const checkAccountLimits = (logger) => {
|
|||||||
debug(account_sid, `checkAccountLimits: limit ${limit_registrations} count ${deviceCount}`);
|
debug(account_sid, `checkAccountLimits: limit ${limit_registrations} count ${deviceCount}`);
|
||||||
logger.info({account_sid}, 'checkAccountLimits: registration rejected due to limits');
|
logger.info({account_sid}, 'checkAccountLimits: registration rejected due to limits');
|
||||||
writeAlerts({
|
writeAlerts({
|
||||||
alert_type: AlertType.DEVICE_LIMIT,
|
alert_type: AlertType.ACCOUNT_DEVICE_LIMIT,
|
||||||
account_sid,
|
account_sid,
|
||||||
count: limit_registrations
|
count: limit_registrations
|
||||||
}).catch((err) => logger.info({err}, 'checkAccountLimits: error writing alert'));
|
}).catch((err) => logger.info({err}, 'checkAccountLimits: error writing alert'));
|
||||||
|
|||||||
@@ -12,11 +12,17 @@ class Regbot {
|
|||||||
|
|
||||||
['ipv4', 'port', 'username', 'password', 'sip_realm'].forEach((prop) => this[prop] = opts[prop]);
|
['ipv4', 'port', 'username', 'password', 'sip_realm'].forEach((prop) => this[prop] = opts[prop]);
|
||||||
|
|
||||||
|
logger.debug({opts}, 'Regbot');
|
||||||
this.username = opts.username;
|
this.username = opts.username;
|
||||||
this.password = opts.password;
|
this.password = opts.password;
|
||||||
this.sip_realm = opts.sip_realm || opts.ipv4;
|
this.sip_realm = opts.sip_realm || opts.ipv4;
|
||||||
this.ipv4 = opts.ipv4;
|
this.ipv4 = opts.ipv4;
|
||||||
this.port = opts.port;
|
this.port = opts.port;
|
||||||
|
this.use_public_ip_in_contact = opts.use_public_ip_in_contact || process.env.JAMBONES_REGBOT_CONTACT_USE_IP;
|
||||||
|
|
||||||
|
const fromUser = opts.from_user || this.username;
|
||||||
|
const fromDomain = opts.from_domain || this.sip_realm;
|
||||||
|
this.from = `sip:${fromUser}@${fromDomain}`;
|
||||||
this.aor = `${this.username}@${this.sip_realm}`;
|
this.aor = `${this.username}@${this.sip_realm}`;
|
||||||
this.status = 'none';
|
this.status = 'none';
|
||||||
}
|
}
|
||||||
@@ -44,13 +50,13 @@ class Regbot {
|
|||||||
|
|
||||||
async register(srf) {
|
async register(srf) {
|
||||||
try {
|
try {
|
||||||
const contactAddress = process.env.JAMBONES_REGBOT_CONTACT_USE_IP ?
|
const contactAddress = this.use_public_ip_in_contact ?
|
||||||
`${this.username}@${srf.locals.sbcPublicIpAddress}` : this.aor;
|
`${this.username}@${srf.locals.sbcPublicIpAddress}` : this.aor;
|
||||||
const req = await srf.request(`sip:${this.aor}`, {
|
const req = await srf.request(`sip:${this.aor}`, {
|
||||||
method: 'REGISTER',
|
method: 'REGISTER',
|
||||||
proxy: `sip:${this.ipv4}:${this.port}`,
|
proxy: `sip:${this.ipv4}:${this.port}`,
|
||||||
headers: {
|
headers: {
|
||||||
'From': `sip:${this.aor}`,
|
'From': this.from,
|
||||||
'Contact': `<sip:${contactAddress}>;expires=${DEFAULT_EXPIRES}`,
|
'Contact': `<sip:${contactAddress}>;expires=${DEFAULT_EXPIRES}`,
|
||||||
'Expires': DEFAULT_EXPIRES
|
'Expires': DEFAULT_EXPIRES
|
||||||
},
|
},
|
||||||
@@ -152,7 +158,10 @@ const getCarriers = async(logger, srf) => {
|
|||||||
port: gw.port,
|
port: gw.port,
|
||||||
username: gw.carrier.register_username,
|
username: gw.carrier.register_username,
|
||||||
password: gw.carrier.register_password,
|
password: gw.carrier.register_password,
|
||||||
sip_realm: gw.carrier.register_sip_realm
|
sip_realm: gw.carrier.register_sip_realm,
|
||||||
|
from_user: gw.carrier.register_from_user,
|
||||||
|
from_domain: gw.carrier.register_from_domain,
|
||||||
|
use_public_ip_in_contact: gw.carrier.register_public_ip_in_contact
|
||||||
});
|
});
|
||||||
regbots.push(rb);
|
regbots.push(rb);
|
||||||
rb.start(srf);
|
rb.start(srf);
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "sbc-sip-sidecar",
|
"name": "sbc-sip-sidecar",
|
||||||
"version": "0.0.1",
|
"version": "0.7.7",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "sbc-sip-sidecar",
|
"name": "sbc-sip-sidecar",
|
||||||
"version": "0.0.1",
|
"version": "0.7.7",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jambonz/db-helpers": "^0.6.18",
|
"@jambonz/db-helpers": "^0.6.18",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sbc-sip-sidecar",
|
"name": "sbc-sip-sidecar",
|
||||||
"version": "0.0.1",
|
"version": "0.7.7",
|
||||||
"description": "SBC SIP sidecar app (handles REGISTER and OPTIONS)",
|
"description": "SBC SIP sidecar app (handles REGISTER and OPTIONS)",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
+142
-28
@@ -8,6 +8,8 @@ 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,24 +22,34 @@ DROP TABLE IF EXISTS lcr_routes;
|
|||||||
|
|
||||||
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_carriers;
|
DROP TABLE IF EXISTS predefined_carriers;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS account_offers;
|
DROP TABLE IF EXISTS account_offers;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS products;
|
DROP TABLE IF EXISTS products;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS schema_version;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS api_keys;
|
DROP TABLE IF EXISTS api_keys;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS sbc_addresses;
|
DROP TABLE IF EXISTS sbc_addresses;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS ms_teams_tenants;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS signup_history;
|
DROP TABLE IF EXISTS signup_history;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS ms_teams_tenants;
|
DROP TABLE IF EXISTS service_provider_limits;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS smpp_addresses;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS speech_credentials;
|
DROP TABLE IF EXISTS speech_credentials;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS users;
|
DROP TABLE IF EXISTS users;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS smpp_gateways;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS phone_numbers;
|
DROP TABLE IF EXISTS phone_numbers;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS sip_gateways;
|
DROP TABLE IF EXISTS sip_gateways;
|
||||||
@@ -80,6 +92,15 @@ 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 ,
|
||||||
@@ -144,6 +165,20 @@ predefined_carrier_sid CHAR(36) NOT NULL,
|
|||||||
PRIMARY KEY (predefined_sip_gateway_sid)
|
PRIMARY KEY (predefined_sip_gateway_sid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE predefined_smpp_gateways
|
||||||
|
(
|
||||||
|
predefined_smpp_gateway_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
ipv4 VARCHAR(128) NOT NULL COMMENT 'ip address or DNS name of the gateway. ',
|
||||||
|
port INTEGER NOT NULL DEFAULT 2775 COMMENT 'smpp signaling port',
|
||||||
|
inbound BOOLEAN NOT NULL COMMENT 'if true, whitelist this IP to allow inbound SMS from the gateway',
|
||||||
|
outbound BOOLEAN NOT NULL COMMENT 'i',
|
||||||
|
netmask INTEGER NOT NULL DEFAULT 32,
|
||||||
|
is_primary BOOLEAN NOT NULL DEFAULT 1,
|
||||||
|
use_tls BOOLEAN DEFAULT 0,
|
||||||
|
predefined_carrier_sid CHAR(36) NOT NULL,
|
||||||
|
PRIMARY KEY (predefined_smpp_gateway_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE products
|
CREATE TABLE products
|
||||||
(
|
(
|
||||||
product_sid CHAR(36) NOT NULL UNIQUE ,
|
product_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -170,6 +205,11 @@ stripe_product_id VARCHAR(56) NOT NULL,
|
|||||||
PRIMARY KEY (account_offer_sid)
|
PRIMARY KEY (account_offer_sid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE schema_version
|
||||||
|
(
|
||||||
|
version VARCHAR(16)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE api_keys
|
CREATE TABLE api_keys
|
||||||
(
|
(
|
||||||
api_key_sid CHAR(36) NOT NULL UNIQUE ,
|
api_key_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -191,14 +231,6 @@ service_provider_sid CHAR(36),
|
|||||||
PRIMARY KEY (sbc_address_sid)
|
PRIMARY KEY (sbc_address_sid)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE signup_history
|
|
||||||
(
|
|
||||||
email VARCHAR(255) NOT NULL,
|
|
||||||
name VARCHAR(255),
|
|
||||||
signed_up_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (email)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE ms_teams_tenants
|
CREATE TABLE ms_teams_tenants
|
||||||
(
|
(
|
||||||
ms_teams_tenant_sid CHAR(36) NOT NULL UNIQUE ,
|
ms_teams_tenant_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -209,6 +241,34 @@ 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 signup_history
|
||||||
|
(
|
||||||
|
email VARCHAR(255) NOT NULL,
|
||||||
|
name VARCHAR(255),
|
||||||
|
signed_up_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
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
|
||||||
|
(
|
||||||
|
smpp_address_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
ipv4 VARCHAR(255) NOT NULL,
|
||||||
|
port INTEGER NOT NULL DEFAULT 5060,
|
||||||
|
use_tls BOOLEAN NOT NULL DEFAULT 0,
|
||||||
|
is_primary BOOLEAN NOT NULL DEFAULT 1,
|
||||||
|
service_provider_sid CHAR(36),
|
||||||
|
PRIMARY KEY (smpp_address_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE speech_credentials
|
CREATE TABLE speech_credentials
|
||||||
(
|
(
|
||||||
speech_credential_sid CHAR(36) NOT NULL UNIQUE ,
|
speech_credential_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -254,6 +314,7 @@ voip_carrier_sid CHAR(36) NOT NULL UNIQUE ,
|
|||||||
name VARCHAR(64) NOT NULL,
|
name VARCHAR(64) NOT NULL,
|
||||||
description VARCHAR(255),
|
description VARCHAR(255),
|
||||||
account_sid CHAR(36) COMMENT 'if provided, indicates this entity represents a sip trunk that is associated with a specific account',
|
account_sid CHAR(36) COMMENT 'if provided, indicates this entity represents a sip trunk that is associated with a specific account',
|
||||||
|
service_provider_sid CHAR(36),
|
||||||
application_sid CHAR(36) COMMENT 'If provided, all incoming calls from this source will be routed to the associated application',
|
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 COMMENT 'if true, a leading plus should be prepended to outbound phone numbers',
|
e164_leading_plus BOOLEAN NOT NULL DEFAULT false COMMENT 'if true, a leading plus should be prepended to outbound phone numbers',
|
||||||
requires_register BOOLEAN NOT NULL DEFAULT false,
|
requires_register BOOLEAN NOT NULL DEFAULT false,
|
||||||
@@ -266,9 +327,31 @@ inbound_auth_password VARCHAR(64),
|
|||||||
diversion VARCHAR(32),
|
diversion VARCHAR(32),
|
||||||
is_active BOOLEAN NOT NULL DEFAULT true,
|
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
smpp_system_id VARCHAR(255),
|
||||||
|
smpp_password VARCHAR(64),
|
||||||
|
smpp_enquire_link_interval INTEGER DEFAULT 0,
|
||||||
|
smpp_inbound_system_id VARCHAR(255),
|
||||||
|
smpp_inbound_password VARCHAR(64),
|
||||||
|
register_from_user VARCHAR(128),
|
||||||
|
register_from_domain VARBINARY(255),
|
||||||
|
register_public_ip_in_contact BOOLEAN NOT NULL DEFAULT false,
|
||||||
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 smpp_gateways
|
||||||
|
(
|
||||||
|
smpp_gateway_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
ipv4 VARCHAR(128) NOT NULL,
|
||||||
|
port INTEGER NOT NULL DEFAULT 2775,
|
||||||
|
netmask INTEGER NOT NULL DEFAULT 32,
|
||||||
|
is_primary BOOLEAN NOT NULL DEFAULT 1,
|
||||||
|
inbound BOOLEAN NOT NULL DEFAULT 0 COMMENT 'if true, whitelist this IP to allow inbound calls from the gateway',
|
||||||
|
outbound BOOLEAN NOT NULL DEFAULT 1 COMMENT 'if true, include in least-cost routing when placing calls to the PSTN',
|
||||||
|
use_tls BOOLEAN DEFAULT 0,
|
||||||
|
voip_carrier_sid CHAR(36) NOT NULL,
|
||||||
|
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 ,
|
||||||
@@ -349,6 +432,7 @@ name VARCHAR(64) NOT NULL,
|
|||||||
sip_realm VARCHAR(132) UNIQUE COMMENT 'sip domain that will be used for devices registering under this account',
|
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',
|
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',
|
registration_hook_sid CHAR(36) COMMENT 'webhook to call when devices underr this account attempt to register',
|
||||||
|
queue_event_hook_sid CHAR(36),
|
||||||
device_calling_application_sid CHAR(36) COMMENT 'application to use for outbound calling from an account',
|
device_calling_application_sid CHAR(36) COMMENT 'application to use for outbound calling from an account',
|
||||||
is_active BOOLEAN NOT NULL DEFAULT true,
|
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
@@ -359,6 +443,11 @@ disable_cdrs BOOLEAN NOT NULL DEFAULT 0,
|
|||||||
trial_end_date DATETIME,
|
trial_end_date DATETIME,
|
||||||
deactivated_reason VARCHAR(255),
|
deactivated_reason VARCHAR(255),
|
||||||
device_to_call_ratio INTEGER NOT NULL DEFAULT 5,
|
device_to_call_ratio INTEGER NOT NULL DEFAULT 5,
|
||||||
|
subspace_client_id VARCHAR(255),
|
||||||
|
subspace_client_secret VARCHAR(255),
|
||||||
|
subspace_sip_teleport_id VARCHAR(255),
|
||||||
|
subspace_sip_teleport_destinations VARCHAR(255),
|
||||||
|
siprec_hook_sid CHAR(36),
|
||||||
PRIMARY KEY (account_sid)
|
PRIMARY KEY (account_sid)
|
||||||
) COMMENT='An enterprise that uses the platform for comm services';
|
) COMMENT='An enterprise that uses the platform for comm services';
|
||||||
|
|
||||||
@@ -370,20 +459,27 @@ CREATE INDEX account_subscription_sid_idx ON account_subscriptions (account_subs
|
|||||||
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_1 (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);
|
||||||
ALTER TABLE call_routes ADD FOREIGN KEY account_sid_idxfk_2 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE call_routes ADD FOREIGN KEY account_sid_idxfk_3 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
ALTER TABLE call_routes ADD FOREIGN KEY application_sid_idxfk (application_sid) REFERENCES applications (application_sid);
|
ALTER TABLE call_routes ADD FOREIGN KEY application_sid_idxfk (application_sid) REFERENCES applications (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_3 (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 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);
|
||||||
ALTER TABLE predefined_sip_gateways ADD FOREIGN KEY predefined_carrier_sid_idxfk (predefined_carrier_sid) REFERENCES predefined_carriers (predefined_carrier_sid);
|
ALTER TABLE predefined_sip_gateways ADD FOREIGN KEY predefined_carrier_sid_idxfk (predefined_carrier_sid) REFERENCES predefined_carriers (predefined_carrier_sid);
|
||||||
|
|
||||||
|
CREATE INDEX predefined_smpp_gateway_sid_idx ON predefined_smpp_gateways (predefined_smpp_gateway_sid);
|
||||||
|
CREATE INDEX predefined_carrier_sid_idx ON predefined_smpp_gateways (predefined_carrier_sid);
|
||||||
|
ALTER TABLE predefined_smpp_gateways ADD FOREIGN KEY predefined_carrier_sid_idxfk_1 (predefined_carrier_sid) REFERENCES predefined_carriers (predefined_carrier_sid);
|
||||||
|
|
||||||
CREATE INDEX product_sid_idx ON products (product_sid);
|
CREATE INDEX product_sid_idx ON products (product_sid);
|
||||||
CREATE INDEX account_product_sid_idx ON account_products (account_product_sid);
|
CREATE INDEX account_product_sid_idx ON account_products (account_product_sid);
|
||||||
CREATE INDEX account_subscription_sid_idx ON account_products (account_subscription_sid);
|
CREATE INDEX account_subscription_sid_idx ON account_products (account_subscription_sid);
|
||||||
@@ -393,14 +489,14 @@ ALTER TABLE account_products ADD FOREIGN KEY product_sid_idxfk (product_sid) REF
|
|||||||
|
|
||||||
CREATE INDEX account_offer_sid_idx ON account_offers (account_offer_sid);
|
CREATE INDEX account_offer_sid_idx ON account_offers (account_offer_sid);
|
||||||
CREATE INDEX account_sid_idx ON account_offers (account_sid);
|
CREATE INDEX account_sid_idx ON account_offers (account_sid);
|
||||||
ALTER TABLE account_offers ADD FOREIGN KEY account_sid_idxfk_4 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE account_offers ADD FOREIGN KEY account_sid_idxfk_5 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
CREATE INDEX product_sid_idx ON account_offers (product_sid);
|
CREATE INDEX product_sid_idx ON account_offers (product_sid);
|
||||||
ALTER TABLE account_offers ADD FOREIGN KEY product_sid_idxfk_1 (product_sid) REFERENCES products (product_sid);
|
ALTER TABLE account_offers ADD FOREIGN KEY product_sid_idxfk_1 (product_sid) REFERENCES products (product_sid);
|
||||||
|
|
||||||
CREATE INDEX api_key_sid_idx ON api_keys (api_key_sid);
|
CREATE INDEX api_key_sid_idx ON api_keys (api_key_sid);
|
||||||
CREATE INDEX account_sid_idx ON api_keys (account_sid);
|
CREATE INDEX account_sid_idx ON api_keys (account_sid);
|
||||||
ALTER TABLE api_keys ADD FOREIGN KEY account_sid_idxfk_5 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE api_keys ADD FOREIGN KEY account_sid_idxfk_6 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
CREATE INDEX service_provider_sid_idx ON api_keys (service_provider_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);
|
ALTER TABLE api_keys ADD FOREIGN KEY service_provider_sid_idxfk (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
@@ -411,70 +507,84 @@ CREATE INDEX sbc_address_sid_idx ON sbc_addresses (sbc_address_sid);
|
|||||||
CREATE INDEX service_provider_sid_idx ON sbc_addresses (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON sbc_addresses (service_provider_sid);
|
||||||
ALTER TABLE sbc_addresses ADD FOREIGN KEY service_provider_sid_idxfk_1 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE sbc_addresses ADD FOREIGN KEY service_provider_sid_idxfk_1 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
CREATE INDEX email_idx ON signup_history (email);
|
|
||||||
CREATE INDEX ms_teams_tenant_sid_idx ON ms_teams_tenants (ms_teams_tenant_sid);
|
CREATE INDEX ms_teams_tenant_sid_idx ON ms_teams_tenants (ms_teams_tenant_sid);
|
||||||
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY service_provider_sid_idxfk_2 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY service_provider_sid_idxfk_2 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY account_sid_idxfk_6 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY account_sid_idxfk_7 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
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);
|
||||||
|
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 smpp_address_sid_idx ON smpp_addresses (smpp_address_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);
|
||||||
|
|
||||||
CREATE UNIQUE INDEX speech_credentials_idx_1 ON speech_credentials (vendor,account_sid);
|
CREATE UNIQUE INDEX speech_credentials_idx_1 ON speech_credentials (vendor,account_sid);
|
||||||
|
|
||||||
CREATE INDEX speech_credential_sid_idx ON speech_credentials (speech_credential_sid);
|
CREATE INDEX speech_credential_sid_idx ON speech_credentials (speech_credential_sid);
|
||||||
CREATE INDEX service_provider_sid_idx ON speech_credentials (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON speech_credentials (service_provider_sid);
|
||||||
ALTER TABLE speech_credentials ADD FOREIGN KEY service_provider_sid_idxfk_3 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE speech_credentials ADD FOREIGN KEY service_provider_sid_idxfk_5 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
CREATE INDEX account_sid_idx ON speech_credentials (account_sid);
|
CREATE INDEX account_sid_idx ON speech_credentials (account_sid);
|
||||||
ALTER TABLE speech_credentials ADD FOREIGN KEY account_sid_idxfk_7 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE speech_credentials ADD FOREIGN KEY account_sid_idxfk_8 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
CREATE INDEX user_sid_idx ON users (user_sid);
|
CREATE INDEX user_sid_idx ON users (user_sid);
|
||||||
CREATE INDEX email_idx ON users (email);
|
CREATE INDEX email_idx ON users (email);
|
||||||
CREATE INDEX phone_idx ON users (phone);
|
CREATE INDEX phone_idx ON users (phone);
|
||||||
CREATE INDEX account_sid_idx ON users (account_sid);
|
CREATE INDEX account_sid_idx ON users (account_sid);
|
||||||
ALTER TABLE users ADD FOREIGN KEY account_sid_idxfk_8 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE users ADD FOREIGN KEY account_sid_idxfk_9 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
CREATE INDEX service_provider_sid_idx ON users (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON users (service_provider_sid);
|
||||||
ALTER TABLE users ADD FOREIGN KEY service_provider_sid_idxfk_4 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE users ADD FOREIGN KEY service_provider_sid_idxfk_6 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
CREATE INDEX email_activation_code_idx ON users (email_activation_code);
|
CREATE INDEX email_activation_code_idx ON users (email_activation_code);
|
||||||
CREATE INDEX voip_carrier_sid_idx ON voip_carriers (voip_carrier_sid);
|
CREATE INDEX voip_carrier_sid_idx ON voip_carriers (voip_carrier_sid);
|
||||||
CREATE INDEX account_sid_idx ON voip_carriers (account_sid);
|
CREATE INDEX account_sid_idx ON voip_carriers (account_sid);
|
||||||
ALTER TABLE voip_carriers ADD FOREIGN KEY account_sid_idxfk_9 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE voip_carriers ADD FOREIGN KEY account_sid_idxfk_10 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
|
CREATE INDEX service_provider_sid_idx ON voip_carriers (service_provider_sid);
|
||||||
|
ALTER TABLE voip_carriers ADD FOREIGN KEY service_provider_sid_idxfk_7 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
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 smpp_gateway_sid_idx ON smpp_gateways (smpp_gateway_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);
|
||||||
|
|
||||||
CREATE INDEX phone_number_sid_idx ON phone_numbers (phone_number_sid);
|
CREATE INDEX phone_number_sid_idx ON phone_numbers (phone_number_sid);
|
||||||
CREATE INDEX number_idx ON phone_numbers (number);
|
CREATE INDEX number_idx ON phone_numbers (number);
|
||||||
CREATE INDEX voip_carrier_sid_idx ON phone_numbers (voip_carrier_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 phone_numbers 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_10 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE phone_numbers ADD FOREIGN KEY account_sid_idxfk_11 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
ALTER TABLE phone_numbers ADD FOREIGN KEY application_sid_idxfk_3 (application_sid) REFERENCES applications (application_sid);
|
ALTER TABLE phone_numbers ADD FOREIGN KEY application_sid_idxfk_3 (application_sid) REFERENCES applications (application_sid);
|
||||||
|
|
||||||
CREATE INDEX service_provider_sid_idx ON phone_numbers (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON phone_numbers (service_provider_sid);
|
||||||
ALTER TABLE phone_numbers ADD FOREIGN KEY service_provider_sid_idxfk_5 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE phone_numbers ADD FOREIGN KEY service_provider_sid_idxfk_8 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
CREATE INDEX sip_gateway_idx_hostport ON sip_gateways (ipv4,port);
|
CREATE INDEX sip_gateway_idx_hostport ON sip_gateways (ipv4,port);
|
||||||
|
|
||||||
CREATE INDEX voip_carrier_sid_idx ON sip_gateways (voip_carrier_sid);
|
CREATE INDEX voip_carrier_sid_idx ON sip_gateways (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 sip_gateways ADD FOREIGN KEY voip_carrier_sid_idxfk_2 (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 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);
|
ALTER TABLE lcr_carrier_set_entry ADD FOREIGN KEY voip_carrier_sid_idxfk_3 (voip_carrier_sid) REFERENCES voip_carriers (voip_carrier_sid);
|
||||||
|
|
||||||
CREATE INDEX webhook_sid_idx ON webhooks (webhook_sid);
|
CREATE INDEX webhook_sid_idx ON webhooks (webhook_sid);
|
||||||
CREATE UNIQUE INDEX applications_idx_name ON applications (account_sid,name);
|
CREATE UNIQUE INDEX applications_idx_name ON applications (account_sid,name);
|
||||||
|
|
||||||
CREATE INDEX application_sid_idx ON applications (application_sid);
|
CREATE INDEX application_sid_idx ON applications (application_sid);
|
||||||
CREATE INDEX service_provider_sid_idx ON applications (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON applications (service_provider_sid);
|
||||||
ALTER TABLE applications ADD FOREIGN KEY service_provider_sid_idxfk_6 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE applications ADD FOREIGN KEY service_provider_sid_idxfk_9 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
CREATE INDEX account_sid_idx ON applications (account_sid);
|
CREATE INDEX account_sid_idx ON applications (account_sid);
|
||||||
ALTER TABLE applications ADD FOREIGN KEY account_sid_idxfk_11 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE applications ADD FOREIGN KEY account_sid_idxfk_12 (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_hook_sid_idxfk (call_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
@@ -490,10 +600,14 @@ ALTER TABLE service_providers ADD FOREIGN KEY registration_hook_sid_idxfk (regis
|
|||||||
CREATE INDEX account_sid_idx ON accounts (account_sid);
|
CREATE INDEX account_sid_idx ON accounts (account_sid);
|
||||||
CREATE INDEX sip_realm_idx ON accounts (sip_realm);
|
CREATE INDEX sip_realm_idx ON accounts (sip_realm);
|
||||||
CREATE INDEX service_provider_sid_idx ON accounts (service_provider_sid);
|
CREATE INDEX service_provider_sid_idx ON accounts (service_provider_sid);
|
||||||
ALTER TABLE accounts ADD FOREIGN KEY service_provider_sid_idxfk_7 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
ALTER TABLE accounts ADD FOREIGN KEY service_provider_sid_idxfk_10 (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 registration_hook_sid_idxfk_1 (registration_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
|
ALTER TABLE accounts ADD FOREIGN KEY queue_event_hook_sid_idxfk (queue_event_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);
|
ALTER TABLE accounts ADD FOREIGN KEY device_calling_application_sid_idxfk (device_calling_application_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;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
insert into voip_carriers (voip_carrier_sid, name, e164_leading_plus, requires_register, register_username, register_sip_realm, register_password)
|
insert into voip_carriers (voip_carrier_sid, name, e164_leading_plus, requires_register, register_username, register_sip_realm, register_password, register_from_user, register_from_domain, register_public_ip_in_contact)
|
||||||
values ('287c1452-620d-4195-9f19-c9814ef90d78', 'westco', 1, 1, 'foo', 'sip.jambonz.org', 'bar');
|
values ('287c1452-620d-4195-9f19-c9814ef90d78', 'westco', 1, 1, 'foo', 'sip.jambonz.org', 'bar', 'reguser', 'regdomain', 0);
|
||||||
insert into sip_gateways (sip_gateway_sid, voip_carrier_sid, ipv4, inbound, outbound)
|
insert into sip_gateways (sip_gateway_sid, voip_carrier_sid, ipv4, inbound, outbound)
|
||||||
values ('124a5339-c62c-4075-9e19-f4de70a96597', '287c1452-620d-4195-9f19-c9814ef90d78', '172.39.0.14', true, true);
|
values ('124a5339-c62c-4075-9e19-f4de70a96597', '287c1452-620d-4195-9f19-c9814ef90d78', '172.39.0.14', true, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user