Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* #361

* fix typo in db upgrade script

---------

Co-authored-by: Hoan Luu Huu <[email protected]>
  • Loading branch information
davehorton and xquanluu authored Nov 27, 2024
1 parent f9990da commit 843980c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
5 changes: 3 additions & 2 deletions db/jambones-sql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ regex VARCHAR(32) NOT NULL COMMENT 'regex-based pattern match against dialed num
description VARCHAR(1024),
priority INTEGER NOT NULL COMMENT 'lower priority routes are attempted first',
PRIMARY KEY (lcr_route_sid)
) COMMENT='An ordered list of digit patterns in an LCR table. The patterns are tested in sequence until one matches';
) COMMENT='An ordered list of digit patterns in an LCR table. The pat';

CREATE TABLE lcr
(
Expand All @@ -173,7 +173,7 @@ default_carrier_set_entry_sid CHAR(36) COMMENT 'default carrier/route to use whe
service_provider_sid CHAR(36),
account_sid CHAR(36),
PRIMARY KEY (lcr_sid)
) COMMENT='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.';
) COMMENT='An LCR (least cost routing) table that is used by a service ';

CREATE TABLE password_settings
(
Expand Down Expand Up @@ -416,6 +416,7 @@ register_from_user VARCHAR(128),
register_from_domain VARCHAR(255),
register_public_ip_in_contact BOOLEAN NOT NULL DEFAULT false,
register_status VARCHAR(4096),
dtmf_type ENUM('rfc2833','tones','info') NOT NULL DEFAULT 'rfc2833',
PRIMARY KEY (voip_carrier_sid)
) COMMENT='A Carrier or customer PBX that can send or receive calls';

Expand Down
27 changes: 17 additions & 10 deletions db/jambones.sqs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@
</location>
<size>
<width>293.00</width>
<height>540.00</height>
<height>560.00</height>
</size>
<zorder>6</zorder>
<SQLField>
Expand Down Expand Up @@ -737,6 +737,13 @@
<type><![CDATA[VARCHAR(4096)]]></type>
<uid><![CDATA[7C7DFE92-D7AC-4447-A1C2-E0F10C1EA26A]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[dtmf_type]]></name>
<type><![CDATA[ENUM('rfc2833','tones','info')]]></type>
<defaultValue><![CDATA[rfc2833]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[87355F68-CC01-4B7C-855A-976CE634634D]]></uid>
</SQLField>
<labelWindowIndex><![CDATA[28]]></labelWindowIndex>
<objectComment><![CDATA[A Carrier or customer PBX that can send or receive calls]]></objectComment>
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
Expand Down Expand Up @@ -1280,8 +1287,8 @@
<schema><![CDATA[]]></schema>
<comment><![CDATA[a regex-based pattern match for call routing]]></comment>
<location>
<x>31.00</x>
<y>983.00</y>
<x>25.00</x>
<y>997.00</y>
</location>
<size>
<width>254.00</width>
Expand Down Expand Up @@ -3144,17 +3151,17 @@
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
<PageGridVisible><![CDATA[0]]></PageGridVisible>
<RightSidebarWidth><![CDATA[1403.000000]]></RightSidebarWidth>
<RightSidebarWidth><![CDATA[1235.000000]]></RightSidebarWidth>
<sidebarIndex><![CDATA[2]]></sidebarIndex>
<snapToGrid><![CDATA[0]]></snapToGrid>
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth>
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[1079.000000]]></windowHeight>
<windowLocationX><![CDATA[48.000000]]></windowLocationX>
<windowLocationY><![CDATA[0.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{969, 523}]]></windowScrollOrigin>
<windowWidth><![CDATA[1680.000000]]></windowWidth>
<windowHeight><![CDATA[871.000000]]></windowHeight>
<windowLocationX><![CDATA[-1516.000000]]></windowLocationX>
<windowLocationY><![CDATA[1121.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{10, 338}]]></windowScrollOrigin>
<windowWidth><![CDATA[1512.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>
Expand Down
6 changes: 6 additions & 0 deletions db/upgrade-jambonz-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ const sql = {
'ALTER TABLE accounts ADD COLUMN enable_debug_log BOOLEAN NOT NULL DEFAULT false',
'ALTER TABLE google_custom_voices ADD COLUMN use_voice_cloning_key BOOLEAN DEFAULT false',
'ALTER TABLE google_custom_voices ADD COLUMN voice_cloning_key MEDIUMTEXT',
],
9003: [
'ALTER TABLE google_custom_voices ADD COLUMN voice_cloning_key MEDIUMTEXT',
'ALTER TABLE google_custom_voices ADD COLUMN use_voice_cloning_key BOOLEAN DEFAULT false',
'ALTER TABLE voip_carriers ADD COLUMN dtmf_type ENUM(\'rfc2833\',\'tones\',\'info\') NOT NULL DEFAULT \'rfc2833\'',
]
};

Expand Down Expand Up @@ -238,6 +243,7 @@ const doIt = async() => {
if (val < 8005) upgrades.push(...sql['8005']);
if (val < 9000) upgrades.push(...sql['9000']);
if (val < 9002) upgrades.push(...sql['9002']);
if (val < 9003) upgrades.push(...sql['9003']);

// perform all upgrades
logger.info({upgrades}, 'applying schema upgrades..');
Expand Down
4 changes: 4 additions & 0 deletions lib/models/voip-carrier.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ VoipCarrier.fields = [
{
name: 'register_status',
type: 'string'
},
{
name: 'dtmf_type',
type: 'string'
}
];

Expand Down
12 changes: 10 additions & 2 deletions test/tts-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,32 @@ function makeSynthKey({account_sid = '', vendor, language, voice, engine = '', t
test('tts-cache', async(t) => {
const app = require('../app');
try {
// clear cache to start
let result = await request.delete('/TtsCache', {
auth: authAdmin,
resolveWithFullResponse: true,
});
t.ok(result.statusCode === 204, 'successfully purged cache for start of test');

// create caches
const minRecords = 8;
for (const i in Array(minRecords).fill(0)) {
await client.set(makeSynthKey({vendor: i, language: i, voice: i, engine: i, text: i}), i);
}

let result = await request.get('/TtsCache', {
result = await request.get('/TtsCache', {
auth: authAdmin,
json: true,
});
//console.log(result);

t.ok(result.size === minRecords, 'get cache correctly');

result = await request.delete('/TtsCache', {
auth: authAdmin,
resolveWithFullResponse: true,
});
t.ok(result.statusCode === 204, 'successfully deleted application after removing phone number');
t.ok(result.statusCode === 204, 'successfully purged cache');

result = await request.get('/TtsCache', {
auth: authAdmin,
Expand Down
4 changes: 3 additions & 1 deletion test/voip-carriers.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ test('voip carrier tests', async(t) => {
json: true,
body: {
name: 'twilio',
e164_leading_plus: true
e164_leading_plus: true,
dtmf_type: 'tones'
}
});
t.ok(result.statusCode === 201, 'successfully created voip carrier for a service provider');
Expand All @@ -221,6 +222,7 @@ test('voip carrier tests', async(t) => {
});
//console.log(result.body);
t.ok(result.statusCode === 200, 'successfully retrieved voip carrier for a service provider');
//console.log(result.body);
sid = result.body[0].voip_carrier_sid;

await deleteObjectBySid(request, '/VoipCarriers', sid);
Expand Down

0 comments on commit 843980c

Please sign in to comment.