From b2760a2d7598d993427f47a51defe9a26e3cc883 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 20 Dec 2019 15:37:44 -0500 Subject: [PATCH] changes to account and application --- db/jambones-sql.sql | 35 +++++++++++--------- db/jambones.sqs | 69 ++++++++++++++++++++++++++------------- lib/models/account.js | 8 +++++ lib/models/application.js | 12 +++++++ lib/swagger/swagger.yaml | 24 ++++++++++++++ 5 files changed, 109 insertions(+), 39 deletions(-) diff --git a/db/jambones-sql.sql b/db/jambones-sql.sql index a36f834..5fa5f0a 100644 --- a/db/jambones-sql.sql +++ b/db/jambones-sql.sql @@ -42,13 +42,16 @@ CREATE TABLE IF NOT EXISTS `applications` `account_sid` CHAR(36) NOT NULL, `call_hook` VARCHAR(255) NOT NULL, `call_status_hook` VARCHAR(255) NOT NULL, +`hook_basic_auth_user` VARCHAR(255), +`hook_basic_auth_password` VARCHAR(255), +`hook_http_method` ENUM('get','post') NOT NULL DEFAULT 'get', PRIMARY KEY (`application_sid`) ) ENGINE=InnoDB COMMENT='A defined set of behaviors to be applied to phone calls with'; CREATE TABLE IF NOT EXISTS `call_routes` ( `call_route_sid` CHAR(36) NOT NULL UNIQUE , -`order` INTEGER NOT NULL, +`priority` INTEGER NOT NULL, `account_sid` CHAR(36) NOT NULL, `regex` VARCHAR(255) NOT NULL, `application_sid` CHAR(36) NOT NULL, @@ -203,6 +206,16 @@ CREATE TABLE IF NOT EXISTS `phone_numbers` PRIMARY KEY (`phone_number_sid`) ) ENGINE=InnoDB COMMENT='A phone number that has been assigned to an account'; +CREATE TABLE IF NOT EXISTS `lcr_carrier_set_entry` +( +`lcr_carrier_set_entry_sid` CHAR(36), +`workload` INTEGER NOT NULL DEFAULT 1, +`lcr_route_sid` CHAR(36) NOT NULL, +`voip_carrier_sid` CHAR(36) NOT NULL, +`priority` INTEGER NOT NULL DEFAULT 0, +PRIMARY KEY (`lcr_carrier_set_entry_sid`) +); + CREATE TABLE IF NOT EXISTS `sip_gateways` ( `sip_gateway_sid` CHAR(36), @@ -215,16 +228,6 @@ CREATE TABLE IF NOT EXISTS `sip_gateways` PRIMARY KEY (`sip_gateway_sid`) ); -CREATE TABLE IF NOT EXISTS `lcr_carrier_set_entry` -( -`lcr_carrier_set_entry_sid` CHAR(36), -`workload` INTEGER NOT NULL DEFAULT 1, -`lcr_route_sid` CHAR(36) NOT NULL, -`voip_carrier_sid` CHAR(36) NOT NULL, -`priority` INTEGER NOT NULL DEFAULT 0, -PRIMARY KEY (`lcr_carrier_set_entry_sid`) -); - CREATE UNIQUE INDEX `applications_idx_name` ON `applications` (`account_sid`,`name`); CREATE INDEX `applications_application_sid_idx` ON `applications` (`application_sid`); @@ -290,10 +293,10 @@ ALTER TABLE `phone_numbers` ADD FOREIGN KEY account_sid_idxfk_3 (`account_sid`) ALTER TABLE `phone_numbers` 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`); - -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`); +ALTER TABLE `lcr_carrier_set_entry` ADD FOREIGN KEY voip_carrier_sid_idxfk_1 (`voip_carrier_sid`) REFERENCES `voip_carriers` (`voip_carrier_sid`); + +CREATE UNIQUE INDEX `sip_gateways_sip_gateway_idx_hostport` ON `sip_gateways` (`ipv4`,`port`); + +ALTER TABLE `sip_gateways` ADD FOREIGN KEY voip_carrier_sid_idxfk_2 (`voip_carrier_sid`) REFERENCES `voip_carriers` (`voip_carrier_sid`); diff --git a/db/jambones.sqs b/db/jambones.sqs index d3cb526..2cc29bb 100644 --- a/db/jambones.sqs +++ b/db/jambones.sqs @@ -48,7 +48,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -202,7 +202,7 @@ - + @@ -231,7 +231,7 @@ - + @@ -272,7 +272,7 @@ - + @@ -337,7 +337,7 @@ - + @@ -403,6 +403,8 @@ + + @@ -483,7 +485,7 @@ - + @@ -540,7 +542,7 @@ - + @@ -775,7 +777,7 @@ - + @@ -857,7 +859,7 @@ - + @@ -915,7 +917,7 @@ - + @@ -1002,6 +1004,8 @@ + + @@ -1044,7 +1048,7 @@ - + @@ -1055,12 +1059,12 @@ - 809.00 - 443.00 + 830.00 + 431.00 345.00 - 140.00 + 200.00 0 @@ -1108,6 +1112,23 @@ + + + + + + + + + + + + + + + + + @@ -1126,7 +1147,7 @@ - + @@ -1169,6 +1190,8 @@ + + @@ -1250,17 +1273,17 @@ - + - - - - - + + + + + diff --git a/lib/models/account.js b/lib/models/account.js index 3fa1d05..b029c64 100644 --- a/lib/models/account.js +++ b/lib/models/account.js @@ -71,6 +71,14 @@ Account.fields = [ { name: 'registration_hook', type: 'string', + }, + { + name: 'hook_basic_auth_user', + type: 'string', + }, + { + name: 'hook_basic_auth_password', + type: 'string', } ]; diff --git a/lib/models/application.js b/lib/models/application.js index 7c0cb64..a072181 100644 --- a/lib/models/application.js +++ b/lib/models/application.js @@ -90,6 +90,18 @@ Application.fields = [ name: 'call_status_hook', type: 'string', required: true + }, + { + name: 'hook_basic_auth_user', + type: 'string', + }, + { + name: 'hook_basic_auth_password', + type: 'string', + }, + { + name: 'hook_http_method', + type: 'string', } ]; diff --git a/lib/swagger/swagger.yaml b/lib/swagger/swagger.yaml index 00efa79..cf09250 100644 --- a/lib/swagger/swagger.yaml +++ b/lib/swagger/swagger.yaml @@ -929,6 +929,18 @@ paths: type: string format: url description: webhook to pass call status updates to + hook_basic_auth_user: + type: string + description: username to use for http basic auth when calling hook + hook_basic_auth_password: + type: string + description: password to use for http basic auth when calling hook + hook_http_method: + type: string + description: whether to use GET or POST + enum: + - get + - post required: - name - account_sid @@ -1263,6 +1275,18 @@ components: call_status_hook: type: string format: url + hook_http_method: + type: string + enum: + - get + - post + default: get + hook_basic_auth_user: + type: string + format: url + hook_basic_auth_password: + type: string + format: url required: - application_sid - name