mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
add support for sbc_addresses and ms_teams_tenants tables
This commit is contained in:
4
db/create-default-service-provider-and-account.sql
Normal file
4
db/create-default-service-provider-and-account.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
insert into service_providers (service_provider_sid, name)
|
||||||
|
values ('2708b1b3-2736-40ea-b502-c53d8396247f', 'default service provider');
|
||||||
|
insert into accounts (account_sid, service_provider_sid, name)
|
||||||
|
values ('9351f46a-678c-43f5-b8a6-d4eb58d131af','2708b1b3-2736-40ea-b502-c53d8396247f', 'default account');
|
||||||
@@ -7,8 +7,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 ms_teams_tenants;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS api_keys;
|
DROP TABLE IF EXISTS api_keys;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS sbc_addresses;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS users;
|
DROP TABLE IF EXISTS users;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS phone_numbers;
|
DROP TABLE IF EXISTS phone_numbers;
|
||||||
@@ -44,6 +48,16 @@ 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 ms_teams_tenants
|
||||||
|
(
|
||||||
|
ms_teams_tenant_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
service_provider_sid CHAR(36) NOT NULL,
|
||||||
|
account_sid CHAR(36),
|
||||||
|
application_sid CHAR(36),
|
||||||
|
tenant_fqdn VARCHAR(255) NOT NULL UNIQUE ,
|
||||||
|
PRIMARY KEY (ms_teams_tenant_sid)
|
||||||
|
) COMMENT='A Microsoft Teams customer tenant';
|
||||||
|
|
||||||
CREATE TABLE api_keys
|
CREATE TABLE api_keys
|
||||||
(
|
(
|
||||||
api_key_sid CHAR(36) NOT NULL UNIQUE ,
|
api_key_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -54,6 +68,15 @@ expires_at TIMESTAMP,
|
|||||||
PRIMARY KEY (api_key_sid)
|
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 sbc_addresses
|
||||||
|
(
|
||||||
|
sbc_address_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
|
ipv4 VARCHAR(255) NOT NULL,
|
||||||
|
port INTEGER NOT NULL DEFAULT 5060,
|
||||||
|
service_provider_sid CHAR(36),
|
||||||
|
PRIMARY KEY (sbc_address_sid)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE users
|
CREATE TABLE users
|
||||||
(
|
(
|
||||||
user_sid CHAR(36) NOT NULL UNIQUE ,
|
user_sid CHAR(36) NOT NULL UNIQUE ,
|
||||||
@@ -138,6 +161,7 @@ name VARCHAR(64) NOT NULL UNIQUE ,
|
|||||||
description VARCHAR(255),
|
description VARCHAR(255),
|
||||||
root_domain VARCHAR(128) UNIQUE ,
|
root_domain VARCHAR(128) UNIQUE ,
|
||||||
registration_hook_sid CHAR(36),
|
registration_hook_sid CHAR(36),
|
||||||
|
ms_teams_fqdn VARCHAR(255),
|
||||||
PRIMARY KEY (service_provider_sid)
|
PRIMARY KEY (service_provider_sid)
|
||||||
) ENGINE=InnoDB COMMENT='A partition of the platform used by one service provider';
|
) ENGINE=InnoDB COMMENT='A partition of the platform used by one service provider';
|
||||||
|
|
||||||
@@ -158,28 +182,42 @@ ALTER TABLE call_routes ADD FOREIGN KEY account_sid_idxfk (account_sid) REFERENC
|
|||||||
|
|
||||||
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 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 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
|
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY account_sid_idxfk_1 (account_sid) REFERENCES accounts (account_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 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_1 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE api_keys ADD FOREIGN KEY account_sid_idxfk_2 (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_1 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
|
CREATE INDEX sbc_addresses_idx_host_port ON sbc_addresses (ipv4,port);
|
||||||
|
|
||||||
|
CREATE INDEX sbc_address_sid_idx ON sbc_addresses (sbc_address_sid);
|
||||||
|
CREATE INDEX service_provider_sid_idx ON sbc_addresses (service_provider_sid);
|
||||||
|
ALTER TABLE sbc_addresses ADD FOREIGN KEY service_provider_sid_idxfk_2 (service_provider_sid) REFERENCES service_providers (service_provider_sid);
|
||||||
|
|
||||||
CREATE INDEX user_sid_idx ON users (user_sid);
|
CREATE INDEX user_sid_idx ON users (user_sid);
|
||||||
CREATE INDEX name_idx ON users (name);
|
CREATE INDEX name_idx ON users (name);
|
||||||
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 name_idx ON voip_carriers (name);
|
CREATE INDEX name_idx ON voip_carriers (name);
|
||||||
ALTER TABLE voip_carriers ADD FOREIGN KEY account_sid_idxfk_2 (account_sid) REFERENCES accounts (account_sid);
|
ALTER TABLE voip_carriers ADD FOREIGN KEY account_sid_idxfk_3 (account_sid) REFERENCES accounts (account_sid);
|
||||||
|
|
||||||
ALTER TABLE voip_carriers ADD FOREIGN KEY application_sid_idxfk_1 (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 phone_number_sid_idx ON phone_numbers (phone_number_sid);
|
CREATE INDEX phone_number_sid_idx ON phone_numbers (phone_number_sid);
|
||||||
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 (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);
|
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_2 (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 webhook_sid_idx ON webhooks (webhook_sid);
|
CREATE INDEX webhook_sid_idx ON webhooks (webhook_sid);
|
||||||
CREATE UNIQUE INDEX sip_gateway_idx_hostport ON sip_gateways (ipv4,port);
|
CREATE UNIQUE INDEX sip_gateway_idx_hostport ON sip_gateways (ipv4,port);
|
||||||
@@ -193,9 +231,8 @@ ALTER TABLE lcr_carrier_set_entry ADD FOREIGN KEY voip_carrier_sid_idxfk_2 (voip
|
|||||||
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 name_idx ON applications (name);
|
|
||||||
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_4 (account_sid) REFERENCES accounts (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_hook_sid_idxfk (call_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
@@ -207,10 +244,9 @@ 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);
|
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 account_sid_idx ON accounts (account_sid);
|
||||||
CREATE INDEX name_idx ON accounts (name);
|
|
||||||
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_1 (service_provider_sid) REFERENCES service_providers (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 registration_hook_sid_idxfk_1 (registration_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||||
|
|
||||||
|
|||||||
179
db/jambones.sqs
179
db/jambones.sqs
@@ -4,8 +4,8 @@
|
|||||||
<name><![CDATA[users]]></name>
|
<name><![CDATA[users]]></name>
|
||||||
<schema><![CDATA[]]></schema>
|
<schema><![CDATA[]]></schema>
|
||||||
<location>
|
<location>
|
||||||
<x>1632.00</x>
|
<x>1599.00</x>
|
||||||
<y>86.00</y>
|
<y>37.00</y>
|
||||||
</location>
|
</location>
|
||||||
<size>
|
<size>
|
||||||
<width>250.00</width>
|
<width>250.00</width>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<comment><![CDATA[An authorization token that is used to access the REST api]]></comment>
|
<comment><![CDATA[An authorization token that is used to access the REST api]]></comment>
|
||||||
<tableType><![CDATA[InnoDB]]></tableType>
|
<tableType><![CDATA[InnoDB]]></tableType>
|
||||||
<location>
|
<location>
|
||||||
<x>1279.00</x>
|
<x>1302.00</x>
|
||||||
<y>61.00</y>
|
<y>61.00</y>
|
||||||
</location>
|
</location>
|
||||||
<size>
|
<size>
|
||||||
@@ -199,8 +199,8 @@
|
|||||||
<schema><![CDATA[]]></schema>
|
<schema><![CDATA[]]></schema>
|
||||||
<comment><![CDATA[An HTTP callback]]></comment>
|
<comment><![CDATA[An HTTP callback]]></comment>
|
||||||
<location>
|
<location>
|
||||||
<x>1383.00</x>
|
<x>1315.00</x>
|
||||||
<y>365.00</y>
|
<y>376.00</y>
|
||||||
</location>
|
</location>
|
||||||
<size>
|
<size>
|
||||||
<width>254.00</width>
|
<width>254.00</width>
|
||||||
@@ -316,6 +316,81 @@
|
|||||||
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
||||||
<uid><![CDATA[78584D93-2CD7-4495-9C5E-893C7B869133]]></uid>
|
<uid><![CDATA[78584D93-2CD7-4495-9C5E-893C7B869133]]></uid>
|
||||||
</SQLTable>
|
</SQLTable>
|
||||||
|
<SQLTable>
|
||||||
|
<name><![CDATA[ms_teams_tenants]]></name>
|
||||||
|
<schema><![CDATA[]]></schema>
|
||||||
|
<comment><![CDATA[A Microsoft Teams customer tenant]]></comment>
|
||||||
|
<location>
|
||||||
|
<x>1309.00</x>
|
||||||
|
<y>219.00</y>
|
||||||
|
</location>
|
||||||
|
<size>
|
||||||
|
<width>298.00</width>
|
||||||
|
<height>120.00</height>
|
||||||
|
</size>
|
||||||
|
<zorder>12</zorder>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[ms_teams_tenant_sid]]></name>
|
||||||
|
<type><![CDATA[CHAR(36)]]></type>
|
||||||
|
<primaryKey>1</primaryKey>
|
||||||
|
<indexed><![CDATA[1]]></indexed>
|
||||||
|
<notNull><![CDATA[1]]></notNull>
|
||||||
|
<uid><![CDATA[A0E48CB5-C2B2-47FC-8486-EF5F16DAF797]]></uid>
|
||||||
|
<unique><![CDATA[1]]></unique>
|
||||||
|
</SQLField>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[service_provider_sid]]></name>
|
||||||
|
<type><![CDATA[CHAR(36)]]></type>
|
||||||
|
<referencesField>service_provider_sid</referencesField>
|
||||||
|
<referencesTable>service_providers</referencesTable>
|
||||||
|
<referencesField><![CDATA[service_provider_sid]]></referencesField>
|
||||||
|
<referencesTable><![CDATA[service_providers]]></referencesTable>
|
||||||
|
<sourceCardinality>4</sourceCardinality>
|
||||||
|
<destinationCardinality>1</destinationCardinality>
|
||||||
|
<referencesFieldUID><![CDATA[58E1702C-6A95-4B17-8C08-8A3810EA16A1]]></referencesFieldUID>
|
||||||
|
<referencesTableUID><![CDATA[F294B51E-F867-47CA-BC1F-F70BDF8170FF]]></referencesTableUID>
|
||||||
|
<indexed><![CDATA[0]]></indexed>
|
||||||
|
<notNull><![CDATA[1]]></notNull>
|
||||||
|
<uid><![CDATA[519A33A0-B678-4F60-892F-ADA90E656500]]></uid>
|
||||||
|
</SQLField>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[account_sid]]></name>
|
||||||
|
<type><![CDATA[CHAR(36)]]></type>
|
||||||
|
<referencesField>account_sid</referencesField>
|
||||||
|
<referencesTable>accounts</referencesTable>
|
||||||
|
<referencesField><![CDATA[account_sid]]></referencesField>
|
||||||
|
<referencesTable><![CDATA[accounts]]></referencesTable>
|
||||||
|
<sourceCardinality>4</sourceCardinality>
|
||||||
|
<destinationCardinality>2</destinationCardinality>
|
||||||
|
<referencesFieldUID><![CDATA[1342FAFA-C15C-429B-809B-C6C55F9FA5B6]]></referencesFieldUID>
|
||||||
|
<referencesTableUID><![CDATA[985D6997-B1A7-4AB3-80F4-4D59B45480C8]]></referencesTableUID>
|
||||||
|
<uid><![CDATA[EB48F39F-9D5F-43E0-BE8A-34A5C1304A76]]></uid>
|
||||||
|
</SQLField>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[application_sid]]></name>
|
||||||
|
<type><![CDATA[CHAR(36)]]></type>
|
||||||
|
<referencesField>application_sid</referencesField>
|
||||||
|
<referencesTable>applications</referencesTable>
|
||||||
|
<referencesField><![CDATA[application_sid]]></referencesField>
|
||||||
|
<referencesTable><![CDATA[applications]]></referencesTable>
|
||||||
|
<sourceCardinality>4</sourceCardinality>
|
||||||
|
<destinationCardinality>2</destinationCardinality>
|
||||||
|
<referencesFieldUID><![CDATA[EF943D13-DCB0-43C1-B03F-550612E20F9D]]></referencesFieldUID>
|
||||||
|
<referencesTableUID><![CDATA[E97EE4F0-7ED7-4E8C-862E-D98192D6EAE0]]></referencesTableUID>
|
||||||
|
<forcedUnique><![CDATA[0]]></forcedUnique>
|
||||||
|
<uid><![CDATA[7959F455-D49D-4185-97B5-37C7FAAB339B]]></uid>
|
||||||
|
</SQLField>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[tenant_fqdn]]></name>
|
||||||
|
<type><![CDATA[VARCHAR(255)]]></type>
|
||||||
|
<indexed><![CDATA[1]]></indexed>
|
||||||
|
<notNull><![CDATA[1]]></notNull>
|
||||||
|
<uid><![CDATA[1DDAD1A1-942D-4487-89C8-D496B7F82274]]></uid>
|
||||||
|
<unique><![CDATA[1]]></unique>
|
||||||
|
</SQLField>
|
||||||
|
<objectComment><![CDATA[A Microsoft Teams customer tenant]]></objectComment>
|
||||||
|
<uid><![CDATA[92FD042A-5AEC-4D8F-AB94-C73C0F566F75]]></uid>
|
||||||
|
</SQLTable>
|
||||||
<SQLTable>
|
<SQLTable>
|
||||||
<name><![CDATA[lcr_carrier_set_entry]]></name>
|
<name><![CDATA[lcr_carrier_set_entry]]></name>
|
||||||
<schema><![CDATA[]]></schema>
|
<schema><![CDATA[]]></schema>
|
||||||
@@ -413,7 +488,7 @@
|
|||||||
<SQLField>
|
<SQLField>
|
||||||
<name><![CDATA[name]]></name>
|
<name><![CDATA[name]]></name>
|
||||||
<type><![CDATA[VARCHAR(64)]]></type>
|
<type><![CDATA[VARCHAR(64)]]></type>
|
||||||
<indexed><![CDATA[1]]></indexed>
|
<indexed><![CDATA[0]]></indexed>
|
||||||
<notNull><![CDATA[1]]></notNull>
|
<notNull><![CDATA[1]]></notNull>
|
||||||
<uid><![CDATA[87414407-17CB-4582-9C0B-73CA548E1016]]></uid>
|
<uid><![CDATA[87414407-17CB-4582-9C0B-73CA548E1016]]></uid>
|
||||||
</SQLField>
|
</SQLField>
|
||||||
@@ -684,7 +759,7 @@
|
|||||||
<SQLField>
|
<SQLField>
|
||||||
<name><![CDATA[name]]></name>
|
<name><![CDATA[name]]></name>
|
||||||
<type><![CDATA[VARCHAR(64)]]></type>
|
<type><![CDATA[VARCHAR(64)]]></type>
|
||||||
<indexed><![CDATA[1]]></indexed>
|
<indexed><![CDATA[0]]></indexed>
|
||||||
<notNull><![CDATA[1]]></notNull>
|
<notNull><![CDATA[1]]></notNull>
|
||||||
<uid><![CDATA[E0EDB7B1-B7F7-4F56-B94F-6B81BB87C514]]></uid>
|
<uid><![CDATA[E0EDB7B1-B7F7-4F56-B94F-6B81BB87C514]]></uid>
|
||||||
</SQLField>
|
</SQLField>
|
||||||
@@ -790,6 +865,73 @@
|
|||||||
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
||||||
<uid><![CDATA[E97EE4F0-7ED7-4E8C-862E-D98192D6EAE0]]></uid>
|
<uid><![CDATA[E97EE4F0-7ED7-4E8C-862E-D98192D6EAE0]]></uid>
|
||||||
</SQLTable>
|
</SQLTable>
|
||||||
|
<SQLTable>
|
||||||
|
<name><![CDATA[sbc_addresses]]></name>
|
||||||
|
<schema><![CDATA[]]></schema>
|
||||||
|
<location>
|
||||||
|
<x>1305.00</x>
|
||||||
|
<y>564.00</y>
|
||||||
|
</location>
|
||||||
|
<size>
|
||||||
|
<width>281.00</width>
|
||||||
|
<height>120.00</height>
|
||||||
|
</size>
|
||||||
|
<zorder>13</zorder>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[sbc_address_sid]]></name>
|
||||||
|
<type><![CDATA[CHAR(36)]]></type>
|
||||||
|
<primaryKey>1</primaryKey>
|
||||||
|
<indexed><![CDATA[1]]></indexed>
|
||||||
|
<notNull><![CDATA[1]]></notNull>
|
||||||
|
<uid><![CDATA[468F8C06-5A38-494A-8E77-3F53F111237B]]></uid>
|
||||||
|
<unique><![CDATA[1]]></unique>
|
||||||
|
</SQLField>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[ipv4]]></name>
|
||||||
|
<type><![CDATA[VARCHAR(255)]]></type>
|
||||||
|
<notNull><![CDATA[1]]></notNull>
|
||||||
|
<uid><![CDATA[4FE97DA7-8D8E-4BE3-982A-01B0444FB070]]></uid>
|
||||||
|
</SQLField>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[port]]></name>
|
||||||
|
<type><![CDATA[INTEGER]]></type>
|
||||||
|
<defaultValue><![CDATA[5060]]></defaultValue>
|
||||||
|
<notNull><![CDATA[1]]></notNull>
|
||||||
|
<uid><![CDATA[707EF28F-F4AF-4B7E-AB04-C128C894ECE9]]></uid>
|
||||||
|
</SQLField>
|
||||||
|
<SQLIndex>
|
||||||
|
<name><![CDATA[sbc_addresses_idx_host_port]]></name>
|
||||||
|
<fieldName><![CDATA[ipv4]]></fieldName>
|
||||||
|
<fieldName><![CDATA[port]]></fieldName>
|
||||||
|
<SQLIndexEntry>
|
||||||
|
<name><![CDATA[ipv4]]></name>
|
||||||
|
<prefixSize><![CDATA[]]></prefixSize>
|
||||||
|
<fieldUid><![CDATA[4FE97DA7-8D8E-4BE3-982A-01B0444FB070]]></fieldUid>
|
||||||
|
</SQLIndexEntry>
|
||||||
|
<SQLIndexEntry>
|
||||||
|
<name><![CDATA[port]]></name>
|
||||||
|
<prefixSize><![CDATA[]]></prefixSize>
|
||||||
|
<fieldUid><![CDATA[707EF28F-F4AF-4B7E-AB04-C128C894ECE9]]></fieldUid>
|
||||||
|
</SQLIndexEntry>
|
||||||
|
<indexNamePrefix><![CDATA[sbc_addresses]]></indexNamePrefix>
|
||||||
|
<uid><![CDATA[174BD35A-B09C-4F4A-B3D2-D5464D927D9B]]></uid>
|
||||||
|
</SQLIndex>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[service_provider_sid]]></name>
|
||||||
|
<type><![CDATA[CHAR(36)]]></type>
|
||||||
|
<referencesField>service_provider_sid</referencesField>
|
||||||
|
<referencesTable>service_providers</referencesTable>
|
||||||
|
<referencesField><![CDATA[service_provider_sid]]></referencesField>
|
||||||
|
<referencesTable><![CDATA[service_providers]]></referencesTable>
|
||||||
|
<sourceCardinality>4</sourceCardinality>
|
||||||
|
<destinationCardinality>1</destinationCardinality>
|
||||||
|
<referencesFieldUID><![CDATA[58E1702C-6A95-4B17-8C08-8A3810EA16A1]]></referencesFieldUID>
|
||||||
|
<referencesTableUID><![CDATA[F294B51E-F867-47CA-BC1F-F70BDF8170FF]]></referencesTableUID>
|
||||||
|
<indexed><![CDATA[1]]></indexed>
|
||||||
|
<uid><![CDATA[6F249D1F-111F-45B4-B76C-8B5E6B9CB43F]]></uid>
|
||||||
|
</SQLField>
|
||||||
|
<uid><![CDATA[F0EE651E-DBF6-4CAC-A517-AC85BCC2D3AF]]></uid>
|
||||||
|
</SQLTable>
|
||||||
<SQLTable>
|
<SQLTable>
|
||||||
<name><![CDATA[lcr_routes]]></name>
|
<name><![CDATA[lcr_routes]]></name>
|
||||||
<schema><![CDATA[]]></schema>
|
<schema><![CDATA[]]></schema>
|
||||||
@@ -842,12 +984,12 @@
|
|||||||
<comment><![CDATA[A partition of the platform used by one service provider]]></comment>
|
<comment><![CDATA[A partition of the platform used by one service provider]]></comment>
|
||||||
<tableType><![CDATA[InnoDB]]></tableType>
|
<tableType><![CDATA[InnoDB]]></tableType>
|
||||||
<location>
|
<location>
|
||||||
<x>813.00</x>
|
<x>838.00</x>
|
||||||
<y>99.00</y>
|
<y>96.00</y>
|
||||||
</location>
|
</location>
|
||||||
<size>
|
<size>
|
||||||
<width>293.00</width>
|
<width>293.00</width>
|
||||||
<height>120.00</height>
|
<height>140.00</height>
|
||||||
</size>
|
</size>
|
||||||
<zorder>3</zorder>
|
<zorder>3</zorder>
|
||||||
<SQLField>
|
<SQLField>
|
||||||
@@ -894,6 +1036,11 @@
|
|||||||
<referencesTableUID><![CDATA[64D64CB9-0990-4C68-BE71-F9FD43C2BE19]]></referencesTableUID>
|
<referencesTableUID><![CDATA[64D64CB9-0990-4C68-BE71-F9FD43C2BE19]]></referencesTableUID>
|
||||||
<uid><![CDATA[506BBE72-1A97-4776-B2C3-D94169652FFE]]></uid>
|
<uid><![CDATA[506BBE72-1A97-4776-B2C3-D94169652FFE]]></uid>
|
||||||
</SQLField>
|
</SQLField>
|
||||||
|
<SQLField>
|
||||||
|
<name><![CDATA[ms_teams_fqdn]]></name>
|
||||||
|
<type><![CDATA[VARCHAR(255)]]></type>
|
||||||
|
<uid><![CDATA[FA39B463-61C7-4654-BE9C-D1AC39AB1B97]]></uid>
|
||||||
|
</SQLField>
|
||||||
<labelWindowIndex><![CDATA[0]]></labelWindowIndex>
|
<labelWindowIndex><![CDATA[0]]></labelWindowIndex>
|
||||||
<objectComment><![CDATA[A partition of the platform used by one service provider]]></objectComment>
|
<objectComment><![CDATA[A partition of the platform used by one service provider]]></objectComment>
|
||||||
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
||||||
@@ -913,17 +1060,17 @@
|
|||||||
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
|
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
|
||||||
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
|
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
|
||||||
<PageGridVisible><![CDATA[0]]></PageGridVisible>
|
<PageGridVisible><![CDATA[0]]></PageGridVisible>
|
||||||
<RightSidebarWidth><![CDATA[2261.000000]]></RightSidebarWidth>
|
<RightSidebarWidth><![CDATA[1753.000000]]></RightSidebarWidth>
|
||||||
<sidebarIndex><![CDATA[2]]></sidebarIndex>
|
<sidebarIndex><![CDATA[2]]></sidebarIndex>
|
||||||
<snapToGrid><![CDATA[0]]></snapToGrid>
|
<snapToGrid><![CDATA[0]]></snapToGrid>
|
||||||
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
|
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
|
||||||
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
|
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
|
||||||
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
|
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
|
||||||
<windowHeight><![CDATA[1428.000000]]></windowHeight>
|
<windowHeight><![CDATA[1298.000000]]></windowHeight>
|
||||||
<windowLocationX><![CDATA[146.000000]]></windowLocationX>
|
<windowLocationX><![CDATA[192.000000]]></windowLocationX>
|
||||||
<windowLocationY><![CDATA[145.000000]]></windowLocationY>
|
<windowLocationY><![CDATA[74.000000]]></windowLocationY>
|
||||||
<windowScrollOrigin><![CDATA[{0, 0}]]></windowScrollOrigin>
|
<windowScrollOrigin><![CDATA[{298.5, 2}]]></windowScrollOrigin>
|
||||||
<windowWidth><![CDATA[2538.000000]]></windowWidth>
|
<windowWidth><![CDATA[2153.000000]]></windowWidth>
|
||||||
</SQLDocumentInfo>
|
</SQLDocumentInfo>
|
||||||
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
|
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
|
||||||
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>
|
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>
|
||||||
|
|||||||
55
lib/models/sbc.js
Normal file
55
lib/models/sbc.js
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
const Model = require('./model');
|
||||||
|
const {getMysqlConnection} = require('../db');
|
||||||
|
|
||||||
|
class Sbc extends Model {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list all SBCs either for a given service provider, or those not associated with a
|
||||||
|
* service provider (i.e. community SBCs)
|
||||||
|
*/
|
||||||
|
static retrieveAll(service_provider_sid) {
|
||||||
|
const sql = service_provider_sid ?
|
||||||
|
'SELECT * from sbc_addresses WHERE service_provider_sid = ?' :
|
||||||
|
'SELECT * from sbc_addresses WHERE service_provider_sid IS NULL';
|
||||||
|
const args = service_provider_sid ? [service_provider_sid] : [];
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getMysqlConnection((err, conn) => {
|
||||||
|
if (err) return reject(err);
|
||||||
|
conn.query(sql, args, (err, results) => {
|
||||||
|
conn.release();
|
||||||
|
if (err) return reject(err);
|
||||||
|
resolve(results);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Sbc.table = 'sbc_addresses';
|
||||||
|
Sbc.fields = [
|
||||||
|
{
|
||||||
|
name: 'sbc_address_sid',
|
||||||
|
type: 'string',
|
||||||
|
primaryKey: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ipv4',
|
||||||
|
type: 'string',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'port',
|
||||||
|
type: 'number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'service_provider_sid',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
module.exports = Sbc;
|
||||||
36
lib/models/tenant.js
Normal file
36
lib/models/tenant.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
const Model = require('./model');
|
||||||
|
|
||||||
|
class MsTeamsTenant extends Model {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MsTeamsTenant.table = 'ms_teams_tenants';
|
||||||
|
MsTeamsTenant.fields = [
|
||||||
|
{
|
||||||
|
name: 'ms_teams_tenant_sid',
|
||||||
|
type: 'string',
|
||||||
|
primaryKey: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'service_provider_sid',
|
||||||
|
type: 'string',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'account_sid',
|
||||||
|
type: 'string'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'application_sid',
|
||||||
|
type: 'string'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'tenant_fqdn',
|
||||||
|
type: 'string',
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
module.exports = MsTeamsTenant;
|
||||||
@@ -11,7 +11,7 @@ const decorators = {
|
|||||||
'delete': remove
|
'delete': remove
|
||||||
};
|
};
|
||||||
|
|
||||||
function decorate(router, klass, methods, preconditions) {
|
function decorate(router, klass, methods, preconditions = {}) {
|
||||||
const decs = methods && Array.isArray(methods) && methods[0] !== '*' ? methods : Object.keys(decorators);
|
const decs = methods && Array.isArray(methods) && methods[0] !== '*' ? methods : Object.keys(decorators);
|
||||||
decs.forEach((m) => {
|
decs.forEach((m) => {
|
||||||
assert(m in decorators);
|
assert(m in decorators);
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ api.use('/PhoneNumbers', isAdminScope, require('./phone-numbers'));
|
|||||||
api.use('/ApiKeys', require('./api-keys'));
|
api.use('/ApiKeys', require('./api-keys'));
|
||||||
api.use('/Accounts', require('./accounts'));
|
api.use('/Accounts', require('./accounts'));
|
||||||
api.use('/Applications', require('./applications'));
|
api.use('/Applications', require('./applications'));
|
||||||
|
api.use('/MicrosoftTeamsTenants', require('./tenants'));
|
||||||
|
api.use('/Sbcs', isAdminScope, require('./sbcs'));
|
||||||
api.use('/Users', require('./users'));
|
api.use('/Users', require('./users'));
|
||||||
api.use('/login', require('./login'));
|
api.use('/login', require('./login'));
|
||||||
|
|
||||||
|
|||||||
19
lib/routes/api/sbcs.js
Normal file
19
lib/routes/api/sbcs.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const router = require('express').Router();
|
||||||
|
const Sbc = require('../../models/sbc');
|
||||||
|
const decorate = require('./decorate');
|
||||||
|
const sysError = require('./error');
|
||||||
|
|
||||||
|
decorate(router, Sbc, ['add', 'delete']);
|
||||||
|
|
||||||
|
/* list */
|
||||||
|
router.get('/', async(req, res) => {
|
||||||
|
const logger = req.app.locals.logger;
|
||||||
|
try {
|
||||||
|
const results = await Sbc.retrieveAll(req.query.service_provider_sid);
|
||||||
|
res.status(200).json(results);
|
||||||
|
} catch (err) {
|
||||||
|
sysError(logger, res, err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
8
lib/routes/api/tenants.js
Normal file
8
lib/routes/api/tenants.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
const router = require('express').Router();
|
||||||
|
const Tenant = require('../../models/tenant');
|
||||||
|
const decorate = require('./decorate');
|
||||||
|
const preconditions = {};
|
||||||
|
|
||||||
|
decorate(router, Tenant, ['*'], preconditions);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -13,12 +13,57 @@ servers:
|
|||||||
description: development server
|
description: development server
|
||||||
paths:
|
paths:
|
||||||
/Sbcs:
|
/Sbcs:
|
||||||
|
post:
|
||||||
|
summary: add an SBC address
|
||||||
|
operationId: createSbc
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
ipv4:
|
||||||
|
type: string
|
||||||
|
port:
|
||||||
|
type: number
|
||||||
|
service_provider_sid:
|
||||||
|
type: string
|
||||||
|
description: service provider scope for the generated api key
|
||||||
|
required:
|
||||||
|
- ipv4
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
description: sbc address successfully created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/SuccessfulApiKeyAdd'
|
||||||
|
400:
|
||||||
|
description: bad request
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
|
||||||
|
500:
|
||||||
|
description: bad request
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
get:
|
get:
|
||||||
summary: retrieve public IP addresses of the jambonz /Sbcs
|
summary: retrieve public IP addresses of the jambonz Sbcs
|
||||||
operationId: listSbcs
|
operationId: listSbcs
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: service_provider_sid
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: return only the SBCs operated for the sole use of this service provider
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: list of IP addresses
|
description: list of SBC addresses
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
@@ -27,7 +72,7 @@ paths:
|
|||||||
properties:
|
properties:
|
||||||
ipv4:
|
ipv4:
|
||||||
type: string
|
type: string
|
||||||
description: ip address of one of our /Sbcs
|
description: ip address of one of our Sbcs
|
||||||
required:
|
required:
|
||||||
- ipv4
|
- ipv4
|
||||||
500:
|
500:
|
||||||
@@ -36,6 +81,22 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/GeneralError'
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
/Sbcs/{SbcSid}:
|
||||||
|
parameters:
|
||||||
|
- name: SbcSid
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
delete:
|
||||||
|
summary: delete sbc address
|
||||||
|
operationId: deleteSbcAddress
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: sbc address deleted
|
||||||
|
404:
|
||||||
|
description: sbc address not found
|
||||||
|
|
||||||
|
|
||||||
/ApiKeys:
|
/ApiKeys:
|
||||||
post:
|
post:
|
||||||
@@ -116,7 +177,7 @@ paths:
|
|||||||
description: login succeeded
|
description: login succeeded
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema: '#/components/schemas/SuccessfulLogin'
|
schema: '#/components/schemas/Login'
|
||||||
403:
|
403:
|
||||||
description: login failed
|
description: login failed
|
||||||
content:
|
content:
|
||||||
@@ -161,7 +222,7 @@ paths:
|
|||||||
description: password successfully changed
|
description: password successfully changed
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema: '#/components/schemas/SuccessfulLogin'
|
schema: '#/components/schemas/Login'
|
||||||
403:
|
403:
|
||||||
description: password change failed
|
description: password change failed
|
||||||
content:
|
content:
|
||||||
@@ -746,6 +807,140 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/GeneralError'
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
|
||||||
|
/MicrosoftTeamsTenants:
|
||||||
|
post:
|
||||||
|
summary: provision a customer tenant for MS Teams
|
||||||
|
operationId: createMsTeamsTenant
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
service_provider_sid:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
example: 85f9c036-ba61-4f28-b2f5-617c23fa68ff
|
||||||
|
account_sid:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
example: 85f9c036-ba61-4f28-b2f5-617c23fa68ff
|
||||||
|
application_sid:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
example: 85f9c036-ba61-4f28-b2f5-617c23fa68ff
|
||||||
|
tenant_fqdn:
|
||||||
|
type: string
|
||||||
|
example: customer.contoso.com
|
||||||
|
required:
|
||||||
|
- service_provider_sid
|
||||||
|
- account
|
||||||
|
- tenant_fqdn
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
description: tenant successfully created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/SuccessfulAdd'
|
||||||
|
400:
|
||||||
|
description: bad request
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
500:
|
||||||
|
description: system error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
get:
|
||||||
|
summary: list MS Teams tenants
|
||||||
|
operationId: listMsTeamsTenants
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: list of tenants
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/MsTeamsTenant'
|
||||||
|
500:
|
||||||
|
description: system error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
/MicrosoftTeamsTenants/{TenantSid}:
|
||||||
|
parameters:
|
||||||
|
- name: TenantSid
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
delete:
|
||||||
|
summary: delete an MS Teams tenant
|
||||||
|
operationId: deleteTenant
|
||||||
|
responses:
|
||||||
|
204:
|
||||||
|
description: tenant successfully deleted
|
||||||
|
404:
|
||||||
|
description: tenant not found
|
||||||
|
500:
|
||||||
|
description: system error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
get:
|
||||||
|
summary: retrieve an MS Teams tenant
|
||||||
|
operationId: getTenant
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: tenant found
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/MsTeamsTenant'
|
||||||
|
404:
|
||||||
|
description: account not found
|
||||||
|
500:
|
||||||
|
description: system error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
|
||||||
|
put:
|
||||||
|
summary: update tenant
|
||||||
|
operationId: updateAccount
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Tenant'
|
||||||
|
responses:
|
||||||
|
204:
|
||||||
|
description: tenant updated
|
||||||
|
404:
|
||||||
|
description: tenant not found
|
||||||
|
422:
|
||||||
|
description: unprocessable entity
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
500:
|
||||||
|
description: system error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GeneralError'
|
||||||
|
|
||||||
|
|
||||||
/Accounts:
|
/Accounts:
|
||||||
post:
|
post:
|
||||||
summary: create an account
|
summary: create an account
|
||||||
@@ -1350,7 +1545,7 @@ components:
|
|||||||
scheme: bearer
|
scheme: bearer
|
||||||
bearerFormat: token
|
bearerFormat: token
|
||||||
schemas:
|
schemas:
|
||||||
SuccessfulLogin:
|
Login:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
user_sid:
|
user_sid:
|
||||||
@@ -1410,6 +1605,8 @@ components:
|
|||||||
hook_basic_auth_password:
|
hook_basic_auth_password:
|
||||||
type: string
|
type: string
|
||||||
format: url
|
format: url
|
||||||
|
ms_teams_fqdn:
|
||||||
|
type: string
|
||||||
required:
|
required:
|
||||||
- service_provider_sid
|
- service_provider_sid
|
||||||
- name
|
- name
|
||||||
@@ -1565,6 +1762,23 @@ components:
|
|||||||
required:
|
required:
|
||||||
- url
|
- url
|
||||||
example: {"url": "https://acme.com", "method": "POST"}
|
example: {"url": "https://acme.com", "method": "POST"}
|
||||||
|
MsTeamsTenant:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
service_provider_sid:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
account_sid:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
application_sid:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
tenant_fqdn:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- service_provider_sid
|
||||||
|
- tenant_fqdn
|
||||||
Call:
|
Call:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -18,7 +18,7 @@
|
|||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"jambonz-db-helpers": "^0.3.2",
|
"jambonz-db-helpers": "^0.3.2",
|
||||||
"jambonz-realtimedb-helpers": "0.1.7",
|
"jambonz-realtimedb-helpers": "0.2.4",
|
||||||
"mysql2": "^2.0.2",
|
"mysql2": "^2.0.2",
|
||||||
"passport": "^0.4.0",
|
"passport": "^0.4.0",
|
||||||
"passport-http-bearer": "^1.0.1",
|
"passport-http-bearer": "^1.0.1",
|
||||||
@@ -26,17 +26,16 @@
|
|||||||
"request": "^2.88.0",
|
"request": "^2.88.0",
|
||||||
"request-debug": "^0.2.0",
|
"request-debug": "^0.2.0",
|
||||||
"swagger-ui-express": "^4.1.2",
|
"swagger-ui-express": "^4.1.2",
|
||||||
"tape": "^4.11.0",
|
|
||||||
"uuid": "^3.3.3",
|
"uuid": "^3.3.3",
|
||||||
"yamljs": "^0.3.0"
|
"yamljs": "^0.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"nyc": "^14.1.1",
|
"nyc": "^15.0.1",
|
||||||
"request-promise-native": "^1.0.8",
|
"request-promise-native": "^1.0.8",
|
||||||
"tap": "^14.10.2",
|
|
||||||
"tap-dot": "^2.0.0",
|
"tap-dot": "^2.0.0",
|
||||||
"tap-spec": "^5.0.0"
|
"tap-spec": "^5.0.0",
|
||||||
|
"tape": "^4.13.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,6 @@ require('./accounts');
|
|||||||
require('./phone-numbers');
|
require('./phone-numbers');
|
||||||
require('./applications');
|
require('./applications');
|
||||||
require('./auth');
|
require('./auth');
|
||||||
|
require('./sbcs');
|
||||||
|
require('./ms-teams');
|
||||||
require('./remove-test-db');
|
require('./remove-test-db');
|
||||||
|
|||||||
64
test/ms-teams.js
Normal file
64
test/ms-teams.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
const test = require('tape').test ;
|
||||||
|
const ADMIN_TOKEN = '38700987-c7a4-4685-a5bb-af378f9734de';
|
||||||
|
const authAdmin = {bearer: ADMIN_TOKEN};
|
||||||
|
const request = require('request-promise-native').defaults({
|
||||||
|
baseUrl: 'http://127.0.0.1:3000/v1'
|
||||||
|
});
|
||||||
|
const {createServiceProvider, deleteObjectBySid} = require('./utils');
|
||||||
|
|
||||||
|
process.on('unhandledRejection', (reason, p) => {
|
||||||
|
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('sbc_addresses tests', async(t) => {
|
||||||
|
const app = require('../app');
|
||||||
|
let sid;
|
||||||
|
try {
|
||||||
|
let result;
|
||||||
|
const service_provider_sid = await createServiceProvider(request);
|
||||||
|
|
||||||
|
/* add a tenant */
|
||||||
|
result = await request.post('/MicrosoftTeamsTenants', {
|
||||||
|
resolveWithFullResponse: true,
|
||||||
|
auth: authAdmin,
|
||||||
|
json: true,
|
||||||
|
body: {
|
||||||
|
service_provider_sid,
|
||||||
|
tenant_fqdn: 'foo.bar.baz'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.ok(result.statusCode === 201, 'successfully added ms teams tenant');
|
||||||
|
const sid1 = result.body.sid;
|
||||||
|
|
||||||
|
/* add a second tenant */
|
||||||
|
result = await request.post('/MicrosoftTeamsTenants', {
|
||||||
|
resolveWithFullResponse: true,
|
||||||
|
auth: authAdmin,
|
||||||
|
json: true,
|
||||||
|
body: {
|
||||||
|
service_provider_sid,
|
||||||
|
tenant_fqdn: 'junk.bar.baz'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.ok(result.statusCode === 201, 'successfully added ms teams tenant');
|
||||||
|
const sid2 = result.body.sid;
|
||||||
|
|
||||||
|
result = await request.get('/MicrosoftTeamsTenants', {
|
||||||
|
resolveWithFullResponse: true,
|
||||||
|
auth: authAdmin,
|
||||||
|
json: true
|
||||||
|
});
|
||||||
|
t.ok(result.body.length === 2, 'successfully retrieved tenants');
|
||||||
|
|
||||||
|
await deleteObjectBySid(request, '/MicrosoftTeamsTenants', sid1);
|
||||||
|
await deleteObjectBySid(request, '/MicrosoftTeamsTenants', sid2);
|
||||||
|
await deleteObjectBySid(request, '/ServiceProviders', service_provider_sid);
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
t.end(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
70
test/sbcs.js
Normal file
70
test/sbcs.js
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
const test = require('tape').test ;
|
||||||
|
const ADMIN_TOKEN = '38700987-c7a4-4685-a5bb-af378f9734de';
|
||||||
|
const authAdmin = {bearer: ADMIN_TOKEN};
|
||||||
|
const request = require('request-promise-native').defaults({
|
||||||
|
baseUrl: 'http://127.0.0.1:3000/v1'
|
||||||
|
});
|
||||||
|
const {createServiceProvider, deleteObjectBySid} = require('./utils');
|
||||||
|
|
||||||
|
process.on('unhandledRejection', (reason, p) => {
|
||||||
|
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('sbc_addresses tests', async(t) => {
|
||||||
|
const app = require('../app');
|
||||||
|
let sid;
|
||||||
|
try {
|
||||||
|
let result;
|
||||||
|
const service_provider_sid = await createServiceProvider(request);
|
||||||
|
|
||||||
|
/* add a community sbc */
|
||||||
|
result = await request.post('/Sbcs', {
|
||||||
|
resolveWithFullResponse: true,
|
||||||
|
auth: authAdmin,
|
||||||
|
json: true,
|
||||||
|
body: {
|
||||||
|
ipv4: '192.168.1.1'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.ok(result.statusCode === 201, 'successfully created community sbc ');
|
||||||
|
const sid1 = result.body.sid;
|
||||||
|
|
||||||
|
/* add a service provider sbc */
|
||||||
|
result = await request.post('/Sbcs', {
|
||||||
|
resolveWithFullResponse: true,
|
||||||
|
auth: authAdmin,
|
||||||
|
json: true,
|
||||||
|
body: {
|
||||||
|
ipv4: '192.168.1.4',
|
||||||
|
service_provider_sid
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.ok(result.statusCode === 201, 'successfully created service provider sbc ');
|
||||||
|
const sid2 = result.body.sid;
|
||||||
|
|
||||||
|
result = await request.get('/Sbcs', {
|
||||||
|
resolveWithFullResponse: true,
|
||||||
|
auth: authAdmin,
|
||||||
|
json: true
|
||||||
|
});
|
||||||
|
t.ok(result.body.length === 1 && result.body[0].ipv4 === '192.168.1.1', 'successfully retrieved community sbc');
|
||||||
|
|
||||||
|
result = await request.get(`/Sbcs?service_provider_sid=${service_provider_sid}`, {
|
||||||
|
resolveWithFullResponse: true,
|
||||||
|
auth: authAdmin,
|
||||||
|
json: true
|
||||||
|
});
|
||||||
|
t.ok(result.body.length === 1 && result.body[0].ipv4 === '192.168.1.4', 'successfully retrieved service provider sbc');
|
||||||
|
|
||||||
|
await deleteObjectBySid(request, '/Sbcs', sid1);
|
||||||
|
await deleteObjectBySid(request, '/Sbcs', sid2);
|
||||||
|
await deleteObjectBySid(request, '/ServiceProviders', service_provider_sid);
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
t.end(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Reference in New Issue
Block a user