google custom voice (#245)

* google custom voice

* wip

* wip

* fix failing testcase
This commit is contained in:
Hoan Luu Huu
2023-10-31 07:29:12 +07:00
committed by GitHub
parent a4e767e1e4
commit 30ba84d57b
9 changed files with 509 additions and 43 deletions

View File

@@ -53,6 +53,8 @@ DROP TABLE IF EXISTS signup_history;
DROP TABLE IF EXISTS smpp_addresses;
DROP TABLE IF EXISTS google_custom_voices;
DROP TABLE IF EXISTS speech_credentials;
DROP TABLE IF EXISTS system_information;
@@ -338,6 +340,16 @@ label VARCHAR(64),
PRIMARY KEY (speech_credential_sid)
);
CREATE TABLE google_custom_voices
(
google_custom_voice_sid CHAR(36) NOT NULL UNIQUE ,
speech_credential_sid CHAR(36) NOT NULL,
model VARCHAR(512) NOT NULL,
reported_usage ENUM('REPORTED_USAGE_UNSPECIFIED','REALTIME','OFFLINE') DEFAULT 'REALTIME',
name VARCHAR(64) NOT NULL,
PRIMARY KEY (google_custom_voice_sid)
);
CREATE TABLE system_information
(
domain_name VARCHAR(255),
@@ -628,6 +640,10 @@ ALTER TABLE speech_credentials ADD FOREIGN KEY service_provider_sid_idxfk_5 (ser
CREATE INDEX account_sid_idx ON speech_credentials (account_sid);
ALTER TABLE speech_credentials ADD FOREIGN KEY account_sid_idxfk_8 (account_sid) REFERENCES accounts (account_sid);
CREATE INDEX google_custom_voice_sid_idx ON google_custom_voices (google_custom_voice_sid);
CREATE INDEX speech_credential_sid_idx ON google_custom_voices (speech_credential_sid);
ALTER TABLE google_custom_voices ADD FOREIGN KEY speech_credential_sid_idxfk (speech_credential_sid) REFERENCES speech_credentials (speech_credential_sid) ON DELETE CASCADE;
CREATE INDEX user_sid_idx ON users (user_sid);
CREATE INDEX email_idx ON users (email);
CREATE INDEX phone_idx ON users (phone);

View File

@@ -87,7 +87,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[49E56AF4-4E40-49B6-BA88-4E378F1E6C18]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[12]]></labelWindowIndex>
<labelWindowIndex><![CDATA[13]]></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[22]]></labelWindowIndex>
<labelWindowIndex><![CDATA[23]]></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[15]]></labelWindowIndex>
<labelWindowIndex><![CDATA[16]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[0AC2FD20-B22F-48DB-8611-801CEF6BFA12]]></uid>
</SQLTable>
@@ -279,7 +279,7 @@
<uid><![CDATA[755D10B0-F60D-4250-8971-C8E4FDB0E0CD]]></uid>
<unique><![CDATA[1]]></unique>
</SQLField>
<labelWindowIndex><![CDATA[19]]></labelWindowIndex>
<labelWindowIndex><![CDATA[20]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[16B9E383-E044-4D71-AB46-FEB86A46A298]]></uid>
</SQLTable>
@@ -316,7 +316,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[C4EEBFF0-C3CB-4897-8720-12D14DBA93A5]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[6]]></labelWindowIndex>
<labelWindowIndex><![CDATA[7]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[1A80FB9B-419E-483A-86FF-B44A00A44D7F]]></uid>
</SQLTable>
@@ -471,7 +471,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[601FA05B-78A5-4E7E-9983-39BB0E6D18EB]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[26]]></labelWindowIndex>
<labelWindowIndex><![CDATA[27]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[2A735FAB-592C-42E5-9C8B-06B109314799]]></uid>
</SQLTable>
@@ -537,7 +537,7 @@
<indexed><![CDATA[1]]></indexed>
<uid><![CDATA[365FB018-429D-4DA4-AC33-D9D106EA97E5]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[11]]></labelWindowIndex>
<labelWindowIndex><![CDATA[12]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[311D99B2-DC8B-4C4A-A1FC-4AFAA1F450F3]]></uid>
</SQLTable>
@@ -737,7 +737,7 @@
<type><![CDATA[VARCHAR(4096)]]></type>
<uid><![CDATA[7C7DFE92-D7AC-4447-A1C2-E0F10C1EA26A]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[27]]></labelWindowIndex>
<labelWindowIndex><![CDATA[28]]></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>
@@ -819,7 +819,7 @@
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
<uid><![CDATA[C84C9B6A-80B5-4B0B-8C14-EB02F7421BBE]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[36]]></labelWindowIndex>
<labelWindowIndex><![CDATA[37]]></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>
@@ -872,7 +872,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[EA4C1A7E-68ED-41D5-9EE9-345DD61F00C7]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[8]]></labelWindowIndex>
<labelWindowIndex><![CDATA[9]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[4893A0F0-BE1B-4322-9034-644528E802DE]]></uid>
</SQLTable>
@@ -892,6 +892,7 @@
<name><![CDATA[speech_credential_sid]]></name>
<type><![CDATA[CHAR(36)]]></type>
<primaryKey>1</primaryKey>
<forcedUnique><![CDATA[1]]></forcedUnique>
<indexed><![CDATA[1]]></indexed>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[A5B51E8C-D4F3-4D7A-953D-B3082D87A226]]></uid>
@@ -986,7 +987,7 @@
<type><![CDATA[VARCHAR(64)]]></type>
<uid><![CDATA[0D42A22C-DF14-42A1-BDE2-A53AC8B0D8D6]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[21]]></labelWindowIndex>
<labelWindowIndex><![CDATA[22]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[49A68E1C-DEE2-446C-A4EB-9850E16155CC]]></uid>
</SQLTable>
@@ -1007,7 +1008,7 @@
<type><![CDATA[VARCHAR(16)]]></type>
<uid><![CDATA[1EA572BD-FF6B-43CC-9EBB-33A735781429]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[9]]></labelWindowIndex>
<labelWindowIndex><![CDATA[10]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[518AC592-D3E6-4032-8A33-15A3DB72B060]]></uid>
</SQLTable>
@@ -1068,7 +1069,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[6B2F726C-48A6-49D9-B7B1-8850DD6FB3EC]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[14]]></labelWindowIndex>
<labelWindowIndex><![CDATA[15]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[51A02EFE-AA51-46EF-8671-E8B2F1FC5F8D]]></uid>
</SQLTable>
@@ -1120,7 +1121,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[2EA3A57F-7EF7-4958-B06B-62B0279BB87E]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[7]]></labelWindowIndex>
<labelWindowIndex><![CDATA[8]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[5784AC2F-BEBC-466F-9818-F9A7D227A5B5]]></uid>
</SQLTable>
@@ -1170,7 +1171,7 @@
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[04BB457A-D532-4780-8A58-5900094171EC]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[28]]></labelWindowIndex>
<labelWindowIndex><![CDATA[29]]></labelWindowIndex>
<objectComment><![CDATA[An HTTP callback]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[64D64CB9-0990-4C68-BE71-F9FD43C2BE19]]></uid>
@@ -1270,7 +1271,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[9A75A20B-1EFD-4E16-994A-5376C650EAB5]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[10]]></labelWindowIndex>
<labelWindowIndex><![CDATA[11]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[6511AF7D-91FD-40C7-9F73-B8E9E66DC249]]></uid>
</SQLTable>
@@ -1339,7 +1340,7 @@
<uid><![CDATA[9B4208B5-9E3B-4B76-B7F7-4E5D36B99BF2]]></uid>
<unsigned><![CDATA[0]]></unsigned>
</SQLField>
<labelWindowIndex><![CDATA[35]]></labelWindowIndex>
<labelWindowIndex><![CDATA[36]]></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>
@@ -1376,7 +1377,7 @@
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
<uid><![CDATA[4D2F7B02-F183-4239-8CE8-3E98206708AE]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[13]]></labelWindowIndex>
<labelWindowIndex><![CDATA[14]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[86FAB0AB-DC68-4ADF-8A08-BBAF61BA1840]]></uid>
</SQLTable>
@@ -1414,7 +1415,7 @@
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[673137EA-B74C-4BA7-AD25-1B71360A2E26]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[5]]></labelWindowIndex>
<labelWindowIndex><![CDATA[6]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[87F254ED-D381-48E3-8E8F-C0F3D99CC01C]]></uid>
</SQLTable>
@@ -1446,7 +1447,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[8998AAD6-A21C-4697-9660-8DC5005AED07]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[4]]></labelWindowIndex>
<labelWindowIndex><![CDATA[5]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[8E75DB2D-9078-40E6-88BF-7DDED5033362]]></uid>
</SQLTable>
@@ -1523,7 +1524,7 @@
<uid><![CDATA[1DDAD1A1-942D-4487-89C8-D496B7F82274]]></uid>
<unique><![CDATA[1]]></unique>
</SQLField>
<labelWindowIndex><![CDATA[25]]></labelWindowIndex>
<labelWindowIndex><![CDATA[26]]></labelWindowIndex>
<objectComment><![CDATA[A Microsoft Teams customer tenant]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[92FD042A-5AEC-4D8F-AB94-C73C0F566F75]]></uid>
@@ -1594,7 +1595,7 @@
<objectComment><![CDATA[lower priority carriers are attempted first]]></objectComment>
<uid><![CDATA[01F61C68-799B-49B0-9E6A-0E2162EE5A54]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[31]]></labelWindowIndex>
<labelWindowIndex><![CDATA[32]]></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>
@@ -1808,7 +1809,7 @@
<objectComment><![CDATA[credential used to authenticate with storage service]]></objectComment>
<uid><![CDATA[E81859C0-DCBD-4FF3-BEEF-FA575394326B]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[33]]></labelWindowIndex>
<labelWindowIndex><![CDATA[34]]></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>
@@ -1847,7 +1848,7 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[D0BF7D36-E40C-4385-9BA5-2099B49A1042]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[20]]></labelWindowIndex>
<labelWindowIndex><![CDATA[21]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[A8ED2178-3CC4-4174-A8FC-C2B58FD28214]]></uid>
</SQLTable>
@@ -1939,7 +1940,7 @@
<type><![CDATA[VARCHAR(32)]]></type>
<uid><![CDATA[CE2015BC-8538-4FB0-B4D9-454436FAB1D9]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[16]]></labelWindowIndex>
<labelWindowIndex><![CDATA[17]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[AF34726D-EDFD-414E-9B44-5243DA9D9497]]></uid>
</SQLTable>
@@ -2009,7 +2010,7 @@
<indexed><![CDATA[1]]></indexed>
<uid><![CDATA[EA936343-89D3-4E3F-BD92-9F8967DC27C4]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[3]]></labelWindowIndex>
<labelWindowIndex><![CDATA[4]]></labelWindowIndex>
<objectComment><![CDATA[An LCR (least cost routing) table that is used by a service provider or account to make decisions about routing outbound calls when multiple carriers are available.]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[AFD51FD4-44C8-4442-94C2-0DFA93CD48AE]]></uid>
@@ -2061,10 +2062,72 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[73092A7A-9F3F-4C49-8478-39CE5DAF5ADD]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[18]]></labelWindowIndex>
<labelWindowIndex><![CDATA[19]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[B10C0DE3-03CD-4C5A-B1FB-F9F81ED14A40]]></uid>
</SQLTable>
<SQLTable>
<name><![CDATA[google_custom_voices]]></name>
<schema><![CDATA[]]></schema>
<location>
<x>1803.00</x>
<y>1036.00</y>
</location>
<size>
<width>521.00</width>
<height>120.00</height>
</size>
<zorder>37</zorder>
<SQLField>
<name><![CDATA[google_custom_voice_sid]]></name>
<type><![CDATA[CHAR(36)]]></type>
<primaryKey>1</primaryKey>
<indexed><![CDATA[1]]></indexed>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[D246DAFE-98AB-4DC6-A384-1DFE8E40573D]]></uid>
<unique><![CDATA[1]]></unique>
</SQLField>
<SQLField>
<name><![CDATA[speech_credential_sid]]></name>
<type><![CDATA[CHAR(36)]]></type>
<referencesField>speech_credential_sid</referencesField>
<referencesTable>speech_credentials</referencesTable>
<deleteAction>1</deleteAction>
<referencesField><![CDATA[speech_credential_sid]]></referencesField>
<referencesTable><![CDATA[speech_credentials]]></referencesTable>
<sourceCardinality>4</sourceCardinality>
<destinationCardinality>1</destinationCardinality>
<referencesFieldUID><![CDATA[A5B51E8C-D4F3-4D7A-953D-B3082D87A226]]></referencesFieldUID>
<referencesTableUID><![CDATA[49A68E1C-DEE2-446C-A4EB-9850E16155CC]]></referencesTableUID>
<forcedUnique><![CDATA[0]]></forcedUnique>
<indexed><![CDATA[1]]></indexed>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[AB763F3E-8E49-46EE-BE99-5ED02A688E93]]></uid>
<unique><![CDATA[0]]></unique>
</SQLField>
<SQLField>
<name><![CDATA[model]]></name>
<type><![CDATA[VARCHAR(512)]]></type>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[CB4E2A6B-7C59-4C8F-B5F5-5F27200B971F]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[reported_usage]]></name>
<type><![CDATA[ENUM('REPORTED_USAGE_UNSPECIFIED','REALTIME','OFFLINE')]]></type>
<defaultValue><![CDATA[REALTIME]]></defaultValue>
<notNull><![CDATA[0]]></notNull>
<uid><![CDATA[A17005D7-81E3-4E12-91EB-6DB23DEAA618]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[name]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[D22EED9A-3502-489E-BE0A-5609B76697A8]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[1]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[B83321B9-0B89-4E5F-95D4-864ADE2EC405]]></uid>
</SQLTable>
<SQLTable>
<name><![CDATA[phone_numbers]]></name>
<schema><![CDATA[]]></schema>
@@ -2175,7 +2238,7 @@
<indexType><![CDATA[UNIQUE]]></indexType>
<uid><![CDATA[4E84523A-7F30-4A5D-A0A8-578652102BD0]]></uid>
</SQLIndex>
<labelWindowIndex><![CDATA[34]]></labelWindowIndex>
<labelWindowIndex><![CDATA[35]]></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>
@@ -2234,7 +2297,7 @@
<notNull><![CDATA[0]]></notNull>
<uid><![CDATA[2963DB28-7248-4D58-92E6-F21F2EB9E680]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[1]]></labelWindowIndex>
<labelWindowIndex><![CDATA[2]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[C2CDB45C-3F50-40B3-B8CE-2F093EB0D517]]></uid>
</SQLTable>
@@ -2346,7 +2409,7 @@
<objectComment><![CDATA[Outbound call protocol]]></objectComment>
<uid><![CDATA[30661D66-96EC-4B02-995C-5E7EB8A3BD70]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[30]]></labelWindowIndex>
<labelWindowIndex><![CDATA[31]]></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>
@@ -2588,7 +2651,7 @@
<indexType><![CDATA[UNIQUE]]></indexType>
<uid><![CDATA[3FDDDF3B-375D-4DE4-B759-514438845F7D]]></uid>
</SQLIndex>
<labelWindowIndex><![CDATA[32]]></labelWindowIndex>
<labelWindowIndex><![CDATA[33]]></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>
@@ -2696,7 +2759,7 @@
<type><![CDATA[VARBINARY(52)]]></type>
<uid><![CDATA[B4793720-635C-4E25-A306-62E7416541C4]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[17]]></labelWindowIndex>
<labelWindowIndex><![CDATA[18]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[EB4BC5F9-CC10-4C8C-AB31-6D942256AEFB]]></uid>
</SQLTable>
@@ -2727,7 +2790,7 @@
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[0A8DB34E-76C9-4D40-9E31-786E0228DCEE]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[2]]></labelWindowIndex>
<labelWindowIndex><![CDATA[3]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[F0C2DC80-CBA7-4BE7-8856-D10B062A7B17]]></uid>
</SQLTable>
@@ -2812,7 +2875,7 @@
<type><![CDATA[DATETIME]]></type>
<uid><![CDATA[CD43B91B-F34E-4422-9C0F-A4B92E2E7B95]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[24]]></labelWindowIndex>
<labelWindowIndex><![CDATA[25]]></labelWindowIndex>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[F0EE651E-DBF6-4CAC-A517-AC85BCC2D3AF]]></uid>
</SQLTable>
@@ -2872,7 +2935,7 @@
<uid><![CDATA[B73773BA-AB1B-47AA-B995-2D2FE006198F]]></uid>
<unique><![CDATA[0]]></unique>
</SQLField>
<labelWindowIndex><![CDATA[29]]></labelWindowIndex>
<labelWindowIndex><![CDATA[30]]></labelWindowIndex>
<objectComment><![CDATA[An ordered list of digit patterns in an LCR table. The patterns are tested in sequence until one matches]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
<uid><![CDATA[F283D572-F670-4571-91FD-A665A9D3E15D]]></uid>
@@ -2939,7 +3002,7 @@
<type><![CDATA[VARCHAR(255)]]></type>
<uid><![CDATA[FA39B463-61C7-4654-BE9C-D1AC39AB1B97]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[23]]></labelWindowIndex>
<labelWindowIndex><![CDATA[24]]></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>
@@ -3013,16 +3076,16 @@
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
<PageGridVisible><![CDATA[0]]></PageGridVisible>
<RightSidebarWidth><![CDATA[1235.000000]]></RightSidebarWidth>
<RightSidebarWidth><![CDATA[1405.000000]]></RightSidebarWidth>
<sidebarIndex><![CDATA[2]]></sidebarIndex>
<snapToGrid><![CDATA[0]]></snapToGrid>
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[1055.000000]]></windowHeight>
<windowLocationX><![CDATA[0.000000]]></windowLocationX>
<windowLocationY><![CDATA[24.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{90, 0}]]></windowScrollOrigin>
<windowLocationX><![CDATA[1728.000000]]></windowLocationX>
<windowLocationY><![CDATA[37.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{1397, 626}]]></windowScrollOrigin>
<windowWidth><![CDATA[1682.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>

View File

@@ -174,7 +174,20 @@ const sql = {
'ALTER TABLE applications ADD COLUMN fallback_speech_recognizer_language VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN fallback_speech_recognizer_label VARCHAR(64)',
'ALTER TABLE sip_gateways ADD COLUMN pad_crypto BOOLEAN NOT NULL DEFAULT 0',
'ALTER TABLE sip_gateways MODIFY port INTEGER'
'ALTER TABLE sip_gateways MODIFY port INTEGER',
`CREATE TABLE google_custom_voices
(
google_custom_voice_sid CHAR(36) NOT NULL UNIQUE ,
speech_credential_sid CHAR(36) NOT NULL,
model VARCHAR(512) NOT NULL,
reported_usage ENUM('REPORTED_USAGE_UNSPECIFIED','REALTIME','OFFLINE') DEFAULT 'REALTIME',
name VARCHAR(64) NOT NULL,
PRIMARY KEY (google_custom_voice_sid)
)
`,
'CREATE INDEX google_custom_voice_sid_idx ON google_custom_voices (google_custom_voice_sid)',
'CREATE INDEX speech_credential_sid_idx ON google_custom_voices (speech_credential_sid)',
'ALTER TABLE google_custom_voices ADD FOREIGN KEY speech_credential_sid_idxfk (speech_credential_sid) REFERENCES speech_credentials (speech_credential_sid) ON DELETE CASCADE'
]
};

View File

@@ -0,0 +1,61 @@
const Model = require('./model');
const {promisePool} = require('../db');
class GoogleCustomVoice extends Model {
constructor() {
super();
}
static async retrieveAllBySpeechCredentialSid(speech_credential_sid) {
const sql = `SELECT * FROM ${this.table} WHERE speech_credential_sid = ?`;
const [rows] = await promisePool.query(sql, speech_credential_sid);
return rows;
}
static async deleteAllBySpeechCredentialSid(speech_credential_sid) {
const sql = `DELETE FROM ${this.table} WHERE speech_credential_sid = ?`;
const [rows] = await promisePool.query(sql, speech_credential_sid);
return rows;
}
static async retrieveAllByLabel(service_provider_sid, account_sid, label) {
let sql;
if (account_sid) {
sql = `SELECT gcv.* FROM ${this.table} gcv
LEFT JOIN speech_credentials sc ON gcv.speech_credential_sid = sc.speech_credential_sid
WHERE sc.account_sid = ? OR (sc.account_sid is NULL && sc.service_provider_sid = ?)
${label ? 'AND label = ?' : 'AND label is NULL'}`;
} else {
sql = `SELECT gcv.* FROM ${this.table} gcv
LEFT JOIN speech_credentials sc ON gcv.speech_credential_sid = sc.speech_credential_sid
WHERE sc.service_provider_sid = ? ${label ? 'AND label = ?' : 'AND label is NULL'}`;
}
const [rows] = await promisePool.query(sql, [...(account_sid ?
[account_sid, service_provider_sid] : [service_provider_sid]), label]);
return rows;
}
}
GoogleCustomVoice.table = 'google_custom_voices';
GoogleCustomVoice.fields = [
{
name: 'google_custom_voice_sid',
type: 'string',
primaryKey: true
},
{
name: 'model',
type: 'string',
required: true
},
{
name: 'reported_usage',
type: 'number'
},
{
name: 'name',
type: 'string',
required: true
}
];
module.exports = GoogleCustomVoice;

View File

@@ -0,0 +1,77 @@
const router = require('express').Router();
const GoogleCustomVoice = require('../../models/google-custom-voice');
const SpeechCredential = require('../../models/speech-credential');
const decorate = require('./decorate');
const {DbErrorBadRequest, DbErrorForbidden} = require('../../utils/errors');
const sysError = require('../error');
const validateCredentialPermission = async(req) => {
const credential = await SpeechCredential.retrieve(req.body.speech_credential_sid);
if (!credential || credential.length === 0) {
throw new DbErrorBadRequest('Invalid speech_credential_sid');
}
const cred = credential[0];
if (req.user.hasServiceProviderAuth && cred.service_provider_sid !== req.user.service_provider_sid) {
throw new DbErrorForbidden('Insufficient privileges');
}
if (req.user.hasAccountAuth && cred.account_sid !== req.user.account_sid) {
throw new DbErrorForbidden('Insufficient privileges');
}
};
const validateAdd = async(req) => {
if (!req.body.speech_credential_sid) {
throw new DbErrorBadRequest('missing speech_credential_sid');
}
await validateCredentialPermission(req);
};
const validateUpdate = async(req) => {
if (req.body.speech_credential_sid) {
await validateCredentialPermission(req);
}
};
const preconditions = {
add: validateAdd,
update: validateUpdate,
};
decorate(router, GoogleCustomVoice, ['add', 'retrieve', 'update', 'delete'], preconditions);
router.get('/', async(req, res) => {
const logger = req.app.locals.logger;
const account_sid = req.user.account_sid || req.query.account_sid;
const service_provider_sid = req.user.service_provider_sid || req.query.service_provider_sid;
const speech_credential_sid = req.query.speech_credential_sid;
const label = req.query.label;
try {
let results = [];
if (speech_credential_sid) {
const [cred] = await SpeechCredential.retrieve(speech_credential_sid);
if (!cred) {
return res.sendStatus(404);
}
if (account_sid && cred.account_sid && cred.account_sid !== account_sid) {
throw new DbErrorForbidden('Insufficient privileges');
}
if (service_provider_sid && cred.service_provider_sid && cred.service_provider_sid !== service_provider_sid) {
throw new DbErrorForbidden('Insufficient privileges');
}
results = await GoogleCustomVoice.retrieveAllBySpeechCredentialSid(speech_credential_sid);
} else {
if (!account_sid && !service_provider_sid) {
throw new DbErrorBadRequest('missing account_sid or service_provider_sid in query parameters');
}
results = await GoogleCustomVoice.retrieveAllByLabel(service_provider_sid, account_sid, label);
}
res.status(200).json(results);
} catch (err) {
sysError(logger, res, err);
}
});
module.exports = router;

View File

@@ -52,6 +52,8 @@ api.use('/Lcrs', require('./lcrs'));
api.use('/LcrRoutes', require('./lcr-routes'));
api.use('/LcrCarrierSetEntries', require('./lcr-carrier-set-entries'));
api.use('/Clients', require('./clients'));
// Google Custom Voices
api.use('/GoogleCustomVoices', require('./google-custom-voices'));
// messaging
api.use('/Smpps', require('./smpps')); // our smpp server info

View File

@@ -276,7 +276,7 @@ function decryptCredential(obj, credential, logger) {
...o,
private_key: `${key_header}${obscureKey(o.private_key.slice(key_header.length, o.private_key.length))}`
};
obj.service_key = obscured;
obj.service_key = JSON.stringify(obscured);
}
else if ('aws' === obj.vendor) {
const o = JSON.parse(decrypt(credential));

View File

@@ -44,6 +44,8 @@ tags:
description: Least Cost Routing Routes operations
- name: LcrCarrierSetEntries
description: Least Cost Routing Carrier Set Entries operation
- name: GoogleCustomVOices
description: Google Custom voices operation
paths:
/BetaInviteCodes:
post:
@@ -4625,6 +4627,173 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
/GoogleCustomVoices:
post:
tags:
- GoogleCustomVoices
summary: create a Google custom voice
operationId: createGoogleCustomVoice
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/GoogleCustomVoice'
required:
- speech_credential_sid
- name
- reported_usage
- model
responses:
201:
description: Least Cost Routing Carrier Set Entry successfully created
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessfulAdd'
400:
description: bad request
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
422:
description: unprocessable entity
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
500:
description: system error
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
get:
tags:
- GoogleCustomVoices
parameters:
- in: query
name: service_provider_sid
required: false
schema:
type: string
description: return only the google voice custom operated belong to this service provider
- in: query
name: account_sid
required: false
schema:
type: string
description: return only the google voice custom operated belong to this account_sid
- in: query
name: speech_credential_sid
required: false
schema:
type: string
description: return only the google voice custom operated belong to this speech credential
summary: list google custom voices
operationId: listGoogleCustomVoices
responses:
200:
description: list oflist google custom voices
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/GoogleCustomVoice'
500:
description: system error
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
/GoogleCustomVoices/{GoogleCustomVoiceSid}:
parameters:
- name: GoogleCustomVoiceSid
in: path
required: true
style: simple
explode: false
schema:
type: string
delete:
tags:
- GoogleCustomVoices
summary: delete a google custom voice
operationId: deleteGoogleCustomVoice
responses:
204:
description: google custom voice successfully deleted
404:
description: google custom voice not found
422:
description: unprocessable entity
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
example:
msg: a service provider with active accounts can not be deleted
500:
description: system error
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
get:
tags:
- GoogleCustomVoices
summary: retrieve google custom voice
operationId: getGoogleCustomVoice
responses:
200:
description: google custom voice found
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleCustomVoice'
404:
description: google custom voice not found
500:
description: system error
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
put:
tags:
- GoogleCustomVoices
summary: update google custom voice
operationId: updateGoogleCustomVoice
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleCustomVoice'
responses:
204:
description: google custom voice updated
content:
application/json:
schema:
$ref: '#/components/schemas/GoogleCustomVoice'
400:
description: bad request
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
404:
description: least cost routing carrier set entry not found
500:
description: system error
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
components:
securitySchemes:
bearerAuth:
@@ -5583,6 +5752,26 @@ components:
- lcr_route_sid
- voip_carrier_sid
- priority
GoogleCustomVoice:
type: object
properties:
speech_credential_sid:
type: string
example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
name:
type: string
example: Sally
reported_usage:
type: string
example: REALTIME
model:
type: string
example: projects/12412312/locations/global/models/2134124123-2dbf-43be-9593-12314123
required:
- speech_credential_sid
- name
- reported_usage
- model
security:
- bearerAuth: []

View File

@@ -492,6 +492,51 @@ test('speech credentials tests', async(t) => {
});
t.ok(result.statusCode === 204, 'successfully deleted speech credential for Cobalt');
/* add a credential for custom voices google */
result = await request.post(`/Accounts/${account_sid}/SpeechCredentials`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
vendor: 'google',
use_for_stt: true,
use_for_tts: false,
service_key: jsonKey
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential for custom voice google');
const customvoice_google_speech_credential_sid = result.body.sid;
result = await request.post(`/GoogleCustomVoices`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
speech_credential_sid: customvoice_google_speech_credential_sid,
name: "Sally",
reported_usage: 'REALTIME',
model: "path/to/modelId"
}
});
t.ok(result.statusCode === 201, 'successfully added custom voice google');
const customvoice_google_sid = result.body.sid;
/* delete the credential */
result = await request.delete(`/GoogleCustomVoices/${customvoice_google_sid}`, {
auth: authUser,
resolveWithFullResponse: true,
});
t.ok(result.statusCode === 204, 'successfully deleted custom voice google');
/* delete the credential */
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/${customvoice_google_speech_credential_sid}`, {
auth: authUser,
resolveWithFullResponse: true,
});
t.ok(result.statusCode === 204, 'successfully deleted speech credential for custom voice google');
await deleteObjectBySid(request, '/Accounts', account_sid);
await deleteObjectBySid(request, '/ServiceProviders', service_provider_sid);
t.end();