Compare commits

...

22 Commits

Author SHA1 Message Date
Dave Horton
f4f1827019 minor change in limits enum 2022-11-27 15:29:23 -05:00
Dave Horton
8263b46fff update limits enum again 2022-11-26 12:56:18 -05:00
Dave Horton
b6699a37c3 add limits license_count and voice_call_minutes 2022-11-25 11:03:20 -05:00
Guilherme Rauen
0fc3c95cc5 update node image to the latest and most secure (#81)
Co-authored-by: Guilherme Rauen <g.rauen@cognigy.com>
2022-11-11 17:44:40 -05:00
Dave Horton
aeebf6aee0 add real testing of microsoft stt 2022-11-10 18:11:04 -05:00
Dave Horton
8026f45467 update deps 2022-11-05 10:44:19 -04:00
Dave Horton
505884e68e update deps 2022-11-04 08:31:41 -04:00
Dave Horton
9e4d6eb88b update deps 2022-11-02 13:39:33 -04:00
Dave Horton
e1cfbe5010 update db-helpers 2022-11-01 21:21:38 -04:00
Dave Horton
b8dc0b2f05 update google speech libs 2022-10-31 11:15:40 -04:00
Dave Horton
110c4ed0d8 allow fromHost in createCall REST API 2022-10-25 13:22:30 -04:00
Dave Horton
7890de8c8f update deps 2022-10-23 15:22:36 -04:00
Dave Horton
b65dc7080c Dh password settings (#72)
* update package-lock.json

* Feat: password settings for account (#65)

* feat: password settings for account

* feat: password settings for account

* fix: review comments

* fix: review comments

* fix: review comments

* return empty json

* fix: after review

Co-authored-by: xquanluu <110280845+xquanluu@users.noreply.github.com>
2022-10-23 14:11:00 -04:00
Markus Frindt
9d0be0f8e1 [snyk] Fix vulnerabilities (#70)
Co-authored-by: Markus Frindt <m.frindt@cognigy.com>
2022-10-20 21:34:07 -04:00
Dave Horton
81cae89387 actual fix for column name 2022-10-10 14:14:57 +01:00
Dave Horton
0811002c05 update time-series 2022-10-10 09:17:34 +01:00
Dave Horton
b465e0b8cf bugfix: wrong name of column in db upgrade script 2022-10-10 08:57:21 +01:00
Dave Horton
08edae376e bugfix: db upgrade for v0.7.7 2022-10-09 09:18:08 +01:00
Dave Horton
b7a38c843a bugfix: new column +register_from_domain is varchar not varbinary 2022-10-07 09:42:10 +01:00
Dave Horton
36a1d4bef1 update model for new columns on voip_carriers 2022-10-06 11:08:59 +01:00
Dave Horton
e067fc2cf4 add fields to db for outbound register customization (from user, from domain, whether to use public ip or sip realm in contact) (#67) 2022-10-06 09:57:00 +01:00
Dave Horton
613b801ba9 add support for azure custom endpoints 2022-09-28 00:37:50 +01:00
20 changed files with 2970 additions and 2021 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
# Logs
logs
*.log
run-tests.sh
# Runtime data
pids

View File

@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 node:18.8.0-alpine as base
FROM --platform=linux/amd64 node:18.12.1-alpine3.16 as base
RUN apk --update --no-cache add --virtual .builds-deps build-base python3

View File

@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 node:18.8.0-alpine as base
FROM --platform=linux/amd64 node:18.9.0-alpine3.16 as base
RUN apk --update --no-cache add --virtual .builds-deps build-base python3

View File

@@ -4,12 +4,12 @@ SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS account_static_ips;
DROP TABLE IF EXISTS account_limits;
DROP TABLE IF EXISTS account_products;
DROP TABLE IF EXISTS account_subscriptions;
DROP TABLE IF EXISTS account_limits;
DROP TABLE IF EXISTS beta_invite_codes;
DROP TABLE IF EXISTS call_routes;
@@ -20,6 +20,8 @@ DROP TABLE IF EXISTS lcr_carrier_set_entry;
DROP TABLE IF EXISTS lcr_routes;
DROP TABLE IF EXISTS password_settings;
DROP TABLE IF EXISTS predefined_sip_gateways;
DROP TABLE IF EXISTS predefined_smpp_gateways;
@@ -38,10 +40,10 @@ DROP TABLE IF EXISTS sbc_addresses;
DROP TABLE IF EXISTS ms_teams_tenants;
DROP TABLE IF EXISTS signup_history;
DROP TABLE IF EXISTS service_provider_limits;
DROP TABLE IF EXISTS signup_history;
DROP TABLE IF EXISTS smpp_addresses;
DROP TABLE IF EXISTS speech_credentials;
@@ -73,6 +75,15 @@ private_ipv4 VARBINARY(16) NOT NULL UNIQUE ,
PRIMARY KEY (account_static_ip_sid)
);
CREATE TABLE account_limits
(
account_limits_sid CHAR(36) NOT NULL UNIQUE ,
account_sid CHAR(36) NOT NULL,
category ENUM('api_rate','voice_call_session', 'device','voice_call_minutes','voice_call_session_license', 'voice_call_minutes_license') NOT NULL,
quantity INTEGER NOT NULL,
PRIMARY KEY (account_limits_sid)
);
CREATE TABLE account_subscriptions
(
account_subscription_sid CHAR(36) NOT NULL UNIQUE ,
@@ -92,15 +103,6 @@ pending_reason VARBINARY(52),
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
(
invite_code CHAR(6) NOT NULL UNIQUE ,
@@ -136,6 +138,13 @@ priority INTEGER NOT NULL UNIQUE COMMENT 'lower priority routes are attempted f
PRIMARY KEY (lcr_route_sid)
) COMMENT='Least cost routing table';
CREATE TABLE password_settings
(
min_password_length INTEGER NOT NULL DEFAULT 8,
require_digit BOOLEAN NOT NULL DEFAULT false,
require_special_character BOOLEAN NOT NULL DEFAULT false
);
CREATE TABLE predefined_carriers
(
predefined_carrier_sid CHAR(36) NOT NULL UNIQUE ,
@@ -241,6 +250,15 @@ tenant_fqdn VARCHAR(255) NOT NULL UNIQUE ,
PRIMARY KEY (ms_teams_tenant_sid)
) COMMENT='A Microsoft Teams customer tenant';
CREATE TABLE service_provider_limits
(
service_provider_limits_sid CHAR(36) NOT NULL UNIQUE ,
service_provider_sid CHAR(36) NOT NULL,
category ENUM('api_rate','voice_call_session', 'device','voice_call_minutes','voice_call_session_license', 'voice_call_minutes_license') NOT NULL,
quantity INTEGER NOT NULL,
PRIMARY KEY (service_provider_limits_sid)
);
CREATE TABLE signup_history
(
email VARCHAR(255) NOT NULL,
@@ -249,15 +267,6 @@ 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 ,
@@ -305,6 +314,7 @@ email_activation_code VARCHAR(16),
email_validated BOOLEAN NOT NULL DEFAULT false,
phone_validated BOOLEAN NOT NULL DEFAULT false,
email_content_opt_out BOOLEAN NOT NULL DEFAULT false,
is_active BOOLEAN NOT NULL DEFAULT true,
PRIMARY KEY (user_sid)
);
@@ -332,6 +342,9 @@ 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 VARCHAR(255),
register_public_ip_in_contact BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (voip_carrier_sid)
) COMMENT='A Carrier or customer PBX that can send or receive calls';
@@ -452,12 +465,12 @@ CREATE INDEX account_static_ip_sid_idx ON account_static_ips (account_static_ip_
CREATE INDEX account_sid_idx ON account_static_ips (account_sid);
ALTER TABLE account_static_ips ADD FOREIGN KEY account_sid_idxfk (account_sid) REFERENCES accounts (account_sid);
CREATE INDEX account_sid_idx ON account_limits (account_sid);
ALTER TABLE account_limits ADD FOREIGN KEY account_sid_idxfk_1 (account_sid) REFERENCES accounts (account_sid) ON DELETE CASCADE;
CREATE INDEX account_subscription_sid_idx ON account_subscriptions (account_subscription_sid);
CREATE INDEX account_sid_idx ON account_subscriptions (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;
ALTER TABLE account_subscriptions ADD FOREIGN KEY account_sid_idxfk_2 (account_sid) REFERENCES accounts (account_sid);
CREATE INDEX invite_code_idx ON beta_invite_codes (invite_code);
CREATE INDEX call_route_sid_idx ON call_routes (call_route_sid);
@@ -512,10 +525,10 @@ ALTER TABLE ms_teams_tenants ADD FOREIGN KEY account_sid_idxfk_7 (account_sid) R
ALTER TABLE ms_teams_tenants ADD FOREIGN KEY application_sid_idxfk_1 (application_sid) REFERENCES applications (application_sid);
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 email_idx ON signup_history (email);
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);

View File

@@ -87,7 +87,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[49E56AF4-4E40-49B6-BA88-4E378F1E6C18]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[4]]></labelWindowIndex>
<labelWindowIndex><![CDATA[7]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[0507BD46-ACAC-48A3-841E-4DEC2FEDCB72]]></uid>
</SQLTable>
@@ -148,7 +148,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[6E651E52-F91E-4086-9A1E-FB3425476B2F]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[14]]></labelWindowIndex>
<labelWindowIndex><![CDATA[17]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[0A95311F-47FA-429F-BAF9-1442C6EE0C0E]]></uid>
</SQLTable>
@@ -225,7 +225,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[D1019218-F1FC-4BC5-A890-F8DBB7153375]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[7]]></labelWindowIndex>
<labelWindowIndex><![CDATA[10]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[0AC2FD20-B22F-48DB-8611-801CEF6BFA12]]></uid>
</SQLTable>
@@ -279,10 +279,47 @@
<uid><![CDATA[755D10B0-F60D-4250-8971-C8E4FDB0E0CD]]></uid>
<unique><![CDATA[1]]></unique>
</SQLField>
<labelWindowIndex><![CDATA[11]]></labelWindowIndex>
<labelWindowIndex><![CDATA[14]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[16B9E383-E044-4D71-AB46-FEB86A46A298]]></uid>
</SQLTable>
<SQLTable>
<name><![CDATA[password_settings]]></name>
<schema><![CDATA[]]></schema>
<location>
<x>2170.00</x>
<y>216.00</y>
</location>
<size>
<width>276.00</width>
<height>80.00</height>
</size>
<zorder>31</zorder>
<SQLField>
<name><![CDATA[min_password_length]]></name>
<type><![CDATA[INTEGER]]></type>
<defaultValue><![CDATA[8]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[CA1990AC-489E-47DE-B935-F9C0723519E3]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[require_digit]]></name>
<type><![CDATA[BOOLEAN]]></type>
<defaultValue><![CDATA[false]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[6A8C92C0-A8A3-40EA-A073-F846CB0E6182]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[require_special_character]]></name>
<type><![CDATA[BOOLEAN]]></type>
<defaultValue><![CDATA[false]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[C4EEBFF0-C3CB-4897-8720-12D14DBA93A5]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[1]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[1A80FB9B-419E-483A-86FF-B44A00A44D7F]]></uid>
</SQLTable>
<SQLTable>
<name><![CDATA[users]]></name>
<schema><![CDATA[]]></schema>
@@ -292,7 +329,7 @@
</location>
<size>
<width>316.00</width>
<height>360.00</height>
<height>380.00</height>
</size>
<zorder>11</zorder>
<SQLField>
@@ -426,7 +463,14 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[0FFD2D75-3BB4-4B4A-AD93-28ADADB69045]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[18]]></labelWindowIndex>
<SQLField>
<name><![CDATA[is_active]]></name>
<type><![CDATA[BOOLEAN]]></type>
<defaultValue><![CDATA[true]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[601FA05B-78A5-4E7E-9983-39BB0E6D18EB]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[21]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[2A735FAB-592C-42E5-9C8B-06B109314799]]></uid>
</SQLTable>
@@ -492,7 +536,7 @@
<indexed><![CDATA[1]]></indexed>
<uid><![CDATA[365FB018-429D-4DA4-AC33-D9D106EA97E5]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[3]]></labelWindowIndex>
<labelWindowIndex><![CDATA[6]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[311D99B2-DC8B-4C4A-A1FC-4AFAA1F450F3]]></uid>
</SQLTable>
@@ -501,12 +545,12 @@
<schema><![CDATA[]]></schema>
<comment><![CDATA[A Carrier or customer PBX that can send or receive calls]]></comment>
<location>
<x>24.00</x>
<y>317.00</y>
<x>20.00</x>
<y>287.00</y>
</location>
<size>
<width>267.00</width>
<height>460.00</height>
<width>293.00</width>
<height>520.00</height>
</size>
<zorder>6</zorder>
<SQLField>
@@ -670,7 +714,24 @@
<type><![CDATA[VARCHAR(64)]]></type>
<uid><![CDATA[630DAD4B-E60E-43AE-9822-41C1EED748AA]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[19]]></labelWindowIndex>
<SQLField>
<name><![CDATA[register_from_user]]></name>
<type><![CDATA[VARCHAR(128)]]></type>
<uid><![CDATA[8DC203AE-E70B-4431-9204-CA55F17B9E1B]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[register_from_domain]]></name>
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[82EA1953-92A3-4BD2-A340-B469466BCB5A]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[register_public_ip_in_contact]]></name>
<type><![CDATA[BOOLEAN]]></type>
<defaultValue><![CDATA[false]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[E93A67DB-9A49-4980-9B25-CF1E7DC42F9B]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[22]]></labelWindowIndex>
<objectComment><![CDATA[A Carrier or customer PBX that can send or receive calls]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[3D3136A7-AFC0-4A70-AEC3-68577955CA2E]]></uid>
@@ -752,7 +813,7 @@
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
<uid><![CDATA[C84C9B6A-80B5-4B0B-8C14-EB02F7421BBE]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[28]]></labelWindowIndex>
<labelWindowIndex><![CDATA[31]]></labelWindowIndex>
<objectComment><![CDATA[An authorization token that is used to access the REST api]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[3EDF89A0-FD38-4DF9-BB65-E0FCD0A678BE]]></uid>
@@ -765,7 +826,7 @@
<y>325.00</y>
</location>
<size>
<width>352.00</width>
<width>770.00</width>
<height>100.00</height>
</size>
<zorder>30</zorder>
@@ -795,7 +856,7 @@
</SQLField>
<SQLField>
<name><![CDATA[category]]></name>
<type><![CDATA[ENUM('api_rate','voice_call_session', 'device')]]></type>
<type><![CDATA[ENUM('api_rate','voice_call_session', 'device','voice_call_minutes','voice_call_session_license', 'voice_call_minutes_license')]]></type>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[9724C27F-3B51-453A-99B8-313480D4A63A]]></uid>
</SQLField>
@@ -805,6 +866,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[EA4C1A7E-68ED-41D5-9EE9-345DD61F00C7]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[3]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[4893A0F0-BE1B-4322-9034-644528E802DE]]></uid>
</SQLTable>
@@ -931,7 +993,7 @@
<indexType><![CDATA[UNIQUE]]></indexType>
<uid><![CDATA[554ABEC2-3E1B-41B1-BF07-25F403D5E3B4]]></uid>
</SQLIndex>
<labelWindowIndex><![CDATA[13]]></labelWindowIndex>
<labelWindowIndex><![CDATA[16]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[49A68E1C-DEE2-446C-A4EB-9850E16155CC]]></uid>
</SQLTable>
@@ -952,7 +1014,7 @@
<type><![CDATA[VARCHAR(16)]]></type>
<uid><![CDATA[1EA572BD-FF6B-43CC-9EBB-33A735781429]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[1]]></labelWindowIndex>
<labelWindowIndex><![CDATA[4]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[518AC592-D3E6-4032-8A33-15A3DB72B060]]></uid>
</SQLTable>
@@ -1013,7 +1075,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[6B2F726C-48A6-49D9-B7B1-8850DD6FB3EC]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[6]]></labelWindowIndex>
<labelWindowIndex><![CDATA[9]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[51A02EFE-AA51-46EF-8671-E8B2F1FC5F8D]]></uid>
</SQLTable>
@@ -1025,7 +1087,7 @@
<y>205.00</y>
</location>
<size>
<width>352.00</width>
<width>770.00</width>
<height>100.00</height>
</size>
<zorder>29</zorder>
@@ -1055,7 +1117,7 @@
</SQLField>
<SQLField>
<name><![CDATA[category]]></name>
<type><![CDATA[ENUM('api_rate','voice_call_session', 'device')]]></type>
<type><![CDATA[ENUM('api_rate','voice_call_session', 'device','voice_call_minutes','voice_call_session_license', 'voice_call_minutes_license')]]></type>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[72BFA408-371D-4B21-8DA0-A56644FCD92C]]></uid>
</SQLField>
@@ -1065,6 +1127,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[2EA3A57F-7EF7-4958-B06B-62B0279BB87E]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[2]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[5784AC2F-BEBC-466F-9818-F9A7D227A5B5]]></uid>
</SQLTable>
@@ -1114,7 +1177,7 @@
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[04BB457A-D532-4780-8A58-5900094171EC]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[20]]></labelWindowIndex>
<labelWindowIndex><![CDATA[23]]></labelWindowIndex>
<objectComment><![CDATA[An HTTP callback]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[64D64CB9-0990-4C68-BE71-F9FD43C2BE19]]></uid>
@@ -1214,7 +1277,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[9A75A20B-1EFD-4E16-994A-5376C650EAB5]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[2]]></labelWindowIndex>
<labelWindowIndex><![CDATA[5]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[6511AF7D-91FD-40C7-9F73-B8E9E66DC249]]></uid>
</SQLTable>
@@ -1223,8 +1286,8 @@
<schema><![CDATA[]]></schema>
<comment><![CDATA[a regex-based pattern match for call routing]]></comment>
<location>
<x>36.00</x>
<y>791.00</y>
<x>44.00</x>
<y>821.00</y>
</location>
<size>
<width>254.00</width>
@@ -1283,7 +1346,7 @@
<uid><![CDATA[9B4208B5-9E3B-4B76-B7F7-4E5D36B99BF2]]></uid>
<unsigned><![CDATA[0]]></unsigned>
</SQLField>
<labelWindowIndex><![CDATA[27]]></labelWindowIndex>
<labelWindowIndex><![CDATA[30]]></labelWindowIndex>
<objectComment><![CDATA[a regex-based pattern match for call routing]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[78584D93-2CD7-4495-9C5E-893C7B869133]]></uid>
@@ -1320,7 +1383,7 @@
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
<uid><![CDATA[4D2F7B02-F183-4239-8CE8-3E98206708AE]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[5]]></labelWindowIndex>
<labelWindowIndex><![CDATA[8]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[86FAB0AB-DC68-4ADF-8A08-BBAF61BA1840]]></uid>
</SQLTable>
@@ -1429,7 +1492,7 @@
<uid><![CDATA[1DDAD1A1-942D-4487-89C8-D496B7F82274]]></uid>
<unique><![CDATA[1]]></unique>
</SQLField>
<labelWindowIndex><![CDATA[17]]></labelWindowIndex>
<labelWindowIndex><![CDATA[20]]></labelWindowIndex>
<objectComment><![CDATA[A Microsoft Teams customer tenant]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[92FD042A-5AEC-4D8F-AB94-C73C0F566F75]]></uid>
@@ -1499,7 +1562,7 @@
<objectComment><![CDATA[lower priority carriers are attempted first]]></objectComment>
<uid><![CDATA[01F61C68-799B-49B0-9E6A-0E2162EE5A54]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[23]]></labelWindowIndex>
<labelWindowIndex><![CDATA[26]]></labelWindowIndex>
<objectComment><![CDATA[An entry in the LCR routing list]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[956025F5-0798-47F7-B76C-457814C7B52E]]></uid>
@@ -1692,7 +1755,7 @@
<referencesTableUID><![CDATA[E97EE4F0-7ED7-4E8C-862E-D98192D6EAE0]]></referencesTableUID>
<uid><![CDATA[4B8283B4-5E16-4846-A79D-12C6B2E73C86]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[25]]></labelWindowIndex>
<labelWindowIndex><![CDATA[28]]></labelWindowIndex>
<objectComment><![CDATA[An enterprise that uses the platform for comm services]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[985D6997-B1A7-4AB3-80F4-4D59B45480C8]]></uid>
@@ -1731,7 +1794,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[D0BF7D36-E40C-4385-9BA5-2099B49A1042]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[12]]></labelWindowIndex>
<labelWindowIndex><![CDATA[15]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[A8ED2178-3CC4-4174-A8FC-C2B58FD28214]]></uid>
</SQLTable>
@@ -1823,7 +1886,7 @@
<type><![CDATA[VARCHAR(32)]]></type>
<uid><![CDATA[CE2015BC-8538-4FB0-B4D9-454436FAB1D9]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[8]]></labelWindowIndex>
<labelWindowIndex><![CDATA[11]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[AF34726D-EDFD-414E-9B44-5243DA9D9497]]></uid>
</SQLTable>
@@ -1874,7 +1937,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[73092A7A-9F3F-4C49-8478-39CE5DAF5ADD]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[10]]></labelWindowIndex>
<labelWindowIndex><![CDATA[13]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[B10C0DE3-03CD-4C5A-B1FB-F9F81ED14A40]]></uid>
</SQLTable>
@@ -1883,8 +1946,8 @@
<schema><![CDATA[]]></schema>
<comment><![CDATA[A phone number that has been assigned to an account]]></comment>
<location>
<x>33.00</x>
<y>924.00</y>
<x>29.00</x>
<y>954.00</y>
</location>
<size>
<width>331.00</width>
@@ -1970,7 +2033,7 @@
<objectComment><![CDATA[if not null, this number is a test number for the associated service provider]]></objectComment>
<uid><![CDATA[D2D46B75-F9C7-42A5-8D8C-4A8412C75ECA]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[26]]></labelWindowIndex>
<labelWindowIndex><![CDATA[29]]></labelWindowIndex>
<objectComment><![CDATA[A phone number that has been assigned to an account]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[BA650DDC-AC7B-4DFE-A5E5-828C75607807]]></uid>
@@ -2070,7 +2133,7 @@
<indexNamePrefix><![CDATA[sip_gateway]]></indexNamePrefix>
<uid><![CDATA[1C744DE3-39BD-4EC6-B427-7EB2DD258771]]></uid>
</SQLIndex>
<labelWindowIndex><![CDATA[22]]></labelWindowIndex>
<labelWindowIndex><![CDATA[25]]></labelWindowIndex>
<objectComment><![CDATA[A whitelisted sip gateway used for origination/termination]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[D8A564E2-DA41-4217-8ACE-06CF77E9BEC1]]></uid>
@@ -2239,7 +2302,7 @@
<indexType><![CDATA[UNIQUE]]></indexType>
<uid><![CDATA[3FDDDF3B-375D-4DE4-B759-514438845F7D]]></uid>
</SQLIndex>
<labelWindowIndex><![CDATA[24]]></labelWindowIndex>
<labelWindowIndex><![CDATA[27]]></labelWindowIndex>
<objectComment><![CDATA[A defined set of behaviors to be applied to phone calls ]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[E97EE4F0-7ED7-4E8C-862E-D98192D6EAE0]]></uid>
@@ -2347,7 +2410,7 @@
<type><![CDATA[VARBINARY(52)]]></type>
<uid><![CDATA[B4793720-635C-4E25-A306-62E7416541C4]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[9]]></labelWindowIndex>
<labelWindowIndex><![CDATA[12]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[EB4BC5F9-CC10-4C8C-AB31-6D942256AEFB]]></uid>
</SQLTable>
@@ -2417,7 +2480,7 @@
<indexed><![CDATA[1]]></indexed>
<uid><![CDATA[6F249D1F-111F-45B4-B76C-8B5E6B9CB43F]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[16]]></labelWindowIndex>
<labelWindowIndex><![CDATA[19]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[F0EE651E-DBF6-4CAC-A517-AC85BCC2D3AF]]></uid>
</SQLTable>
@@ -2462,7 +2525,7 @@
<uid><![CDATA[B73773BA-AB1B-47AA-B995-2D2FE006198F]]></uid>
<unique><![CDATA[1]]></unique>
</SQLField>
<labelWindowIndex><![CDATA[21]]></labelWindowIndex>
<labelWindowIndex><![CDATA[24]]></labelWindowIndex>
<objectComment><![CDATA[Least cost routing table]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[F283D572-F670-4571-91FD-A665A9D3E15D]]></uid>
@@ -2529,7 +2592,7 @@
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[FA39B463-61C7-4654-BE9C-D1AC39AB1B97]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[15]]></labelWindowIndex>
<labelWindowIndex><![CDATA[18]]></labelWindowIndex>
<objectComment><![CDATA[A partition of the platform used by one service provider]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[F294B51E-F867-47CA-BC1F-F70BDF8170FF]]></uid>
@@ -2554,10 +2617,10 @@
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[833.000000]]></windowHeight>
<windowHeight><![CDATA[871.000000]]></windowHeight>
<windowLocationX><![CDATA[0.000000]]></windowLocationX>
<windowLocationY><![CDATA[111.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{462, 81}]]></windowScrollOrigin>
<windowLocationY><![CDATA[73.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{0, 0}]]></windowScrollOrigin>
<windowWidth><![CDATA[1512.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>

View File

@@ -53,7 +53,10 @@ const sql = {
`ALTER TABLE account_limits
ADD FOREIGN KEY account_sid_idxfk_2 (account_sid)
REFERENCES accounts (account_sid)
ON DELETE CASCADE`
ON DELETE CASCADE`,
'ALTER TABLE `voip_carriers` ADD COLUMN `register_from_user` VARCHAR(128)',
'ALTER TABLE `voip_carriers` ADD COLUMN `register_from_domain` VARCHAR(256)',
'ALTER TABLE `voip_carriers` ADD COLUMN `register_public_ip_in_contact` BOOLEAN NOT NULL DEFAULT false'
]
};

View File

@@ -0,0 +1,70 @@
const {promisePool} = require('../db');
class PasswordSettings {
/**
* Retrieve object from database
*/
static async retrieve() {
const [r] = await promisePool.execute(`SELECT * FROM ${this.table}`);
return r;
}
/**
* Update object into the database
*/
static async update(obj) {
let sql = `UPDATE ${this.table} SET `;
const values = [];
const keys = Object.keys(obj);
this.fields.forEach(({name}) => {
if (keys.includes(name)) {
sql = sql + `${name} = ?,`;
values.push(obj[name]);
}
});
if (values.length) {
sql = sql.slice(0, -1);
await promisePool.execute(sql, values);
}
}
/**
* insert object into the database
*/
static async make(obj) {
let params = '', marks = '';
const values = [];
const keys = Object.keys(obj);
this.fields.forEach(({name}) => {
if (keys.includes(name)) {
params = params + `${name},`;
marks = marks + '?,';
values.push(obj[name]);
}
});
if (values.length) {
params = `(${params.slice(0, -1)})`;
marks = `values(${marks.slice(0, -1)})`;
return await promisePool.execute(`INSERT into ${this.table} ${params} ${marks}`, values);
}
}
}
PasswordSettings.table = 'password_settings';
PasswordSettings.fields = [
{
name: 'min_password_length',
type: 'number'
},
{
name: 'require_digit',
type: 'number'
},
{
name: 'require_special_character',
type: 'number'
}
];
module.exports = PasswordSettings;

View File

@@ -111,6 +111,18 @@ VoipCarrier.fields = [
name: 'smpp_system_id',
type: 'string'
},
{
name: 'register_from_user',
type: 'string'
},
{
name: 'register_from_domain',
type: 'string'
},
{
name: 'register_public_ip_in_contact',
type: 'number'
}
];
module.exports = VoipCarrier;

View File

@@ -44,6 +44,7 @@ api.use('/Subscriptions', require('./subscriptions'));
api.use('/Invoices', require('./invoices'));
api.use('/InviteCodes', require('./invite-codes'));
api.use('/PredefinedCarriers', require('./predefined-carriers'));
api.use('/PasswordSettings', isAdminScope, require('./password-settings'));
// messaging
api.use('/Smpps', require('./smpps')); // our smpp server info

View File

@@ -0,0 +1,42 @@
const router = require('express').Router();
const sysError = require('../error');
const PasswordSettings = require('../../models/password-settings');
const { DbErrorBadRequest } = require('../../utils/errors');
const validate = (obj) => {
if (obj.min_password_length && (
obj.min_password_length < 8 ||
obj.min_password_length > 20
)) {
throw new DbErrorBadRequest('invalid min_password_length property: should be between 8-20');
}
};
router.post('/', async(req, res) => {
const logger = req.app.locals.logger;
try {
validate(req.body);
const [existing] = (await PasswordSettings.retrieve() || []);
if (existing) {
await PasswordSettings.update(req.body);
} else {
await PasswordSettings.make(req.body);
}
res.status(201).json({});
}
catch (err) {
sysError(logger, res, err);
}
});
router.get('/', async(req, res) => {
const logger = req.app.locals.logger;
try {
const [results] = (await PasswordSettings.retrieve() || []);
return res.status(200).json(results || {min_password_length: 8});
}
catch (err) {
sysError(logger, res, err);
}
});
module.exports = router;

View File

@@ -234,7 +234,7 @@ router.put('/:sid', async(req, res) => {
const sid = req.params.sid;
const logger = req.app.locals.logger;
try {
const {use_for_tts, use_for_stt} = req.body;
const {use_for_tts, use_for_stt, region, aws_region} = req.body;
if (typeof use_for_tts === 'undefined' && typeof use_for_stt === 'undefined') {
throw new DbErrorUnprocessableRequest('use_for_tts and use_for_stt are the only updateable fields');
}
@@ -248,9 +248,39 @@ router.put('/:sid', async(req, res) => {
/* update the credential if provided */
try {
obj.credential = encryptCredential(req.body);
} catch (err) {}
const cred = await SpeechCredential.retrieve(sid);
if (1 === cred.length) {
const {credential, vendor} = cred[0];
const o = JSON.parse(decrypt(credential));
const {
use_custom_tts,
custom_tts_endpoint,
use_custom_stt,
custom_stt_endpoint
} = req.body;
const newCred = {
...o,
region,
vendor,
aws_region,
use_custom_tts,
custom_tts_endpoint,
use_custom_stt,
custom_stt_endpoint
};
logger.info({o, newCred}, 'updating speech credential with this new credential');
obj.credential = encryptCredential(newCred);
obj.vendor = vendor;
}
else {
logger.info({sid}, 'speech credential not found!!');
}
} catch (err) {
logger.error({err}, 'error updating speech credential');
}
logger.info({obj}, 'updating speech credential with changes');
const rowsAffected = await SpeechCredential.update(sid, obj);
if (rowsAffected === 0) {
return res.sendStatus(404);

View File

@@ -909,6 +909,15 @@ paths:
type: string
description: sip password to authenticate with, if registration is required
example: bar
register_from_user:
type: string
description: optional username to apply in From header
register_from_domain:
type: string
description: optional domain to apply in From header
register_public_ip_in_contact:
type: boolean
description: if true, use our public ip in Contact header; otherwise, use sip realm
tech_prefix:
type: string
description: prefix to be applied to the called number for outbound call attempts
@@ -3410,6 +3419,10 @@ paths:
type: string
description: The calling party number
example: "16172375089"
fromHost:
type: string
description: The hostname to put in the SIP From header of the INVITE
example: "blf.finotel.com"
timeout:
type: integer
description: the number of seconds to wait for call to be answered. Defaults to 60.
@@ -4511,6 +4524,12 @@ components:
type: string
register_password:
type: string
register_from_user:
type: string
register_from_domain:
type: string
register_public_ip_in_contact:
type: boolean
tech_prefix:
type: string
inbound_auth_username:

View File

@@ -2,6 +2,8 @@ const ttsGoogle = require('@google-cloud/text-to-speech');
const sttGoogle = require('@google-cloud/speech').v1p1beta1;
const Polly = require('aws-sdk/clients/polly');
const AWS = require('aws-sdk');
const { Deepgram } = require('@deepgram/sdk');
const sdk = require('microsoft-cognitiveservices-speech-sdk');
const bent = require('bent');
const fs = require('fs');
@@ -32,6 +34,65 @@ const testGoogleStt = async(logger, credentials) => {
}
};
const testDeepgramStt = async(logger, credentials) => {
const {api_key} = credentials;
const deepgram = new Deepgram(api_key);
const mimetype = 'audio/wav';
const source = {
buffer: fs.readFileSync(`${__dirname}/../../data/test_audio.wav`),
mimetype: mimetype
};
return new Promise((resolve, reject) => {
// Send the audio to Deepgram and get the response
deepgram.transcription
.preRecorded(source, {punctuate: true})
.then((response) => {
//logger.debug({response}, 'got transcript');
if (response?.results?.channels[0]?.alternatives?.length > 0) resolve(response);
else reject(new Error('no transcript returned'));
return;
})
.catch((err) => {
logger.info({err}, 'failed to get deepgram transcript');
reject(err);
});
});
};
const testMicrosoftStt = async(logger, credentials) => {
const {api_key, region} = credentials;
const speechConfig = sdk.SpeechConfig.fromSubscription(api_key, region);
const audioConfig = sdk.AudioConfig.fromWavFileInput(fs.readFileSync(`${__dirname}/../../data/test_audio.wav`));
speechConfig.speechRecognitionLanguage = 'en-US';
const speechRecognizer = new sdk.SpeechRecognizer(speechConfig, audioConfig);
return new Promise((resolve, reject) => {
speechRecognizer.recognizeOnceAsync((result) => {
switch (result.reason) {
case sdk.ResultReason.RecognizedSpeech:
resolve();
break;
case sdk.ResultReason.NoMatch:
reject('Speech could not be recognized.');
break;
case sdk.ResultReason.Canceled:
const cancellation = sdk.CancellationDetails.fromResult(result);
logger.info(`CANCELED: Reason=${cancellation.reason}`);
if (cancellation.reason == sdk.CancellationReason.Error) {
logger.info(`CANCELED: ErrorCode=${cancellation.ErrorCode}`);
logger.info(`CANCELED: ErrorDetails=${cancellation.errorDetails}`);
}
reject(cancellation.reason);
break;
}
speechRecognizer.close();
});
});
};
const testAwsTts = (logger, credentials) => {
const polly = new Polly(credentials);
return new Promise((resolve, reject) => {
@@ -67,6 +128,14 @@ const testMicrosoftTts = async(logger, credentials) => {
custom_stt_endpoint
} = credentials;
logger.info({
api_key,
region,
use_custom_tts,
custom_tts_endpoint,
use_custom_stt,
custom_stt_endpoint
}, 'testing microsoft tts');
if (!api_key) throw new Error('testMicrosoftTts: credentials are missing api_key');
if (!region) throw new Error('testMicrosoftTts: credentials are missing region');
try {
@@ -81,11 +150,6 @@ const testMicrosoftTts = async(logger, credentials) => {
}
};
const testMicrosoftStt = async(logger, credentials) => {
//TODO
return true;
};
const testWellSaidTts = async(logger, credentials) => {
const {api_key} = credentials;
try {
@@ -119,4 +183,5 @@ module.exports = {
testMicrosoftTts,
testMicrosoftStt,
testWellSaidStt,
testDeepgramStt
};

4363
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -18,11 +18,12 @@
"url": "https://github.com/jambonz/jambonz-api-server.git"
},
"dependencies": {
"@google-cloud/speech": "^4.10.2",
"@google-cloud/text-to-speech": "^3.4.0",
"@jambonz/db-helpers": "^0.6.18",
"@jambonz/realtimedb-helpers": "^0.4.29",
"@jambonz/time-series": "^0.2.1",
"@deepgram/sdk": "^1.10.2",
"@google-cloud/speech": "^5.1.0",
"@google-cloud/text-to-speech": "^4.0.3",
"@jambonz/db-helpers": "^0.7.3",
"@jambonz/realtimedb-helpers": "^0.5.9",
"@jambonz/time-series": "^0.2.5",
"argon2-ffi": "^2.0.0",
"aws-sdk": "^2.1152.0",
"bent": "^7.3.12",
@@ -35,6 +36,7 @@
"helmet": "^5.1.0",
"jsonwebtoken": "^8.5.1",
"mailgun.js": "^3.7.3",
"microsoft-cognitiveservices-speech-sdk": "^1.24.1",
"mysql2": "^2.3.3",
"passport": "^0.6.0",
"passport-http-bearer": "^1.0.1",

View File

@@ -232,7 +232,7 @@ test('account tests', async(t) => {
auth: authAdmin,
json: true,
});
//console.log(result);
// console.log(result);
t.ok(result.length === 1 && result[0].quantity === 205, 'successfully queried account limits by category');
/* delete call session limits for a service provider */

View File

@@ -15,4 +15,5 @@ require('./recent-calls');
require('./webapp_tests');
// require('./homer');
require('./call-test');
require('./password-settings');
require('./docker_stop');

71
test/password-settings.js Normal file
View File

@@ -0,0 +1,71 @@
const test = require('tape') ;
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'
});
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});
test('password settings tests', async(t) => {
/* Check Default Password Settings */
result = await request.get('/PasswordSettings', {
auth: authAdmin,
json: true,
});
t.ok(result.min_password_length == 8 &&
!result.require_digit &&
!result.require_special_character, "default password settings is correct!")
/* Post New Password settings*/
result = await request.post('/PasswordSettings', {
auth: authAdmin,
json: true,
resolveWithFullResponse: true,
body: {
min_password_length: 15,
require_digit: 1,
require_special_character: 1
}
});
t.ok(result.statusCode === 201, 'successfully added a password settings');
/* Check Password Settings*/
result = await request.get('/PasswordSettings', {
auth: authAdmin,
json: true,
});
t.ok(result.min_password_length === 15 &&
result.require_digit === 1 &&
result.require_special_character === 1, 'successfully queried password settings');
/* Update Password settings*/
result = await request.post('/PasswordSettings', {
auth: authAdmin,
json: true,
resolveWithFullResponse: true,
body: {
min_password_length: 10,
require_special_character: 0
}
});
t.ok(result.statusCode === 201, 'successfully updated a password settings');
/* Check Password Settings After update*/
result = await request.get('/PasswordSettings', {
auth: authAdmin,
json: true,
});
t.ok(result.min_password_length === 10 &&
result.require_digit === 1 &&
result.require_special_character === 0, 'successfully queried password settings after updated');
});

View File

@@ -30,7 +30,9 @@ test('speech credentials tests', async(t) => {
json: true,
body: {
vendor: 'google',
service_key: jsonKey
service_key: jsonKey,
use_for_tts: true,
use_for_stt: true
}
});
t.ok(result.statusCode === 201, 'successfully added a speech credential to service provider');
@@ -61,7 +63,9 @@ test('speech credentials tests', async(t) => {
json: true,
body: {
vendor: 'google',
service_key: jsonKey
service_key: jsonKey,
use_for_tts: true,
use_for_stt: true
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential');
@@ -110,20 +114,20 @@ test('speech credentials tests', async(t) => {
});
t.ok(result.statusCode === 204, 'successfully deleted speech credential');
/* add a credential for microsoft */
if (process.env.MICROSOFT_API_KEY && process.env.MICROSOFT_REGION) {
/* add / test a credential for google */
if (process.env.GCP_JSON_KEY) {
result = await request.post(`/Accounts/${account_sid}/SpeechCredentials`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
vendor: 'microsoft',
vendor: 'google',
use_for_tts: true,
api_key: process.env.MICROSOFT_API_KEY,
region: process.env.MICROSOFT_REGION
use_for_stt: true,
service_key: process.env.GCP_JSON_KEY
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential');
t.ok(result.statusCode === 201, 'successfully added speech credential for google');
const ms_sid = result.body.sid;
/* test the speech credential */
@@ -132,7 +136,37 @@ test('speech credentials tests', async(t) => {
auth: authUser,
json: true,
});
console.log(JSON.stringify(result));
//console.log(JSON.stringify(result));
t.ok(result.statusCode === 200 && result.body.tts.status === 'ok', 'successfully tested speech credential for google tts');
t.ok(result.statusCode === 200 && result.body.stt.status === 'ok', 'successfully tested speech credential for google stt');
}
/* add / test a credential for microsoft */
if (process.env.MICROSOFT_API_KEY && process.env.MICROSOFT_REGION) {
result = await request.post(`/Accounts/${account_sid}/SpeechCredentials`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
vendor: 'microsoft',
use_for_tts: true,
use_for_stt: true,
api_key: process.env.MICROSOFT_API_KEY,
region: process.env.MICROSOFT_REGION
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential for microsoft');
const ms_sid = result.body.sid;
/* test the speech credential */
result = await request.get(`/Accounts/${account_sid}/SpeechCredentials/${ms_sid}/test`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
});
//console.log(JSON.stringify(result));
t.ok(result.statusCode === 200 && result.body.tts.status === 'ok', 'successfully tested speech credential for microsoft tts');
t.ok(result.statusCode === 200 && result.body.stt.status === 'ok', 'successfully tested speech credential for microsoft stt');
}
/* add a credential for wellsaid */
@@ -156,7 +190,8 @@ test('speech credentials tests', async(t) => {
auth: authUser,
json: true,
});
console.log(JSON.stringify(result));
//console.log(JSON.stringify(result));
t.ok(result.statusCode === 200 && result.body.tts.status === 'ok', 'successfully tested speech credential for wellsaid');
/* delete the credential */
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/${ms_sid}`, {

View File

@@ -54,7 +54,9 @@ test('voip carrier tests', async(t) => {
requires_register: true,
register_username: 'foo',
register_sip_realm: 'bar',
register_password: 'baz'
register_password: 'baz',
register_from_user: 'fromme',
register_from_domain: 'fromdomain'
}
});
t.ok(result.statusCode === 204, 'successfully updated voip carrier');