Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat fallback speech vendors #220

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions db/jambones-sql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,14 @@ speech_synthesis_label VARCHAR(64),
speech_recognizer_vendor VARCHAR(64) NOT NULL DEFAULT 'google',
speech_recognizer_language VARCHAR(64) NOT NULL DEFAULT 'en-US',
speech_recognizer_label VARCHAR(64),
use_for_fallback_speech BOOLEAN DEFAULT false,
fallback_speech_synthesis_vendor VARCHAR(64) NOT NULL DEFAULT 'google',
fallback_speech_synthesis_language VARCHAR(12) NOT NULL DEFAULT 'en-US',
fallback_speech_synthesis_voice VARCHAR(64),
fallback_speech_synthesis_label VARCHAR(64),
fallback_speech_recognizer_vendor VARCHAR(64) NOT NULL DEFAULT 'google',
fallback_speech_recognizer_language VARCHAR(64) NOT NULL DEFAULT 'en-US',
fallback_speech_recognizer_label VARCHAR(64),
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
record_all_calls BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (application_sid)
Expand Down
69 changes: 61 additions & 8 deletions db/jambones.sqs
Original file line number Diff line number Diff line change
Expand Up @@ -2018,8 +2018,8 @@
<name><![CDATA[dns_records]]></name>
<schema><![CDATA[]]></schema>
<location>
<x>947.00</x>
<y>1303.00</y>
<x>1270.00</x>
<y>1425.00</y>
</location>
<size>
<width>262.00</width>
Expand Down Expand Up @@ -2184,8 +2184,8 @@
<name><![CDATA[clients]]></name>
<schema><![CDATA[]]></schema>
<location>
<x>916.00</x>
<y>1447.00</y>
<x>974.00</x>
<y>1496.00</y>
</location>
<size>
<width>228.00</width>
Expand Down Expand Up @@ -2354,8 +2354,8 @@
<y>917.00</y>
</location>
<size>
<width>345.00</width>
<height>380.00</height>
<width>363.00</width>
<height>540.00</height>
</size>
<zorder>0</zorder>
<SQLField>
Expand Down Expand Up @@ -2500,10 +2500,63 @@
<notNull><![CDATA[0]]></notNull>
<uid><![CDATA[A247A784-CCD6-40B4-9D0A-2F0EF8F8AFD2]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[use_for_fallback_speech]]></name>
<type><![CDATA[BOOLEAN]]></type>
<defaultValue><![CDATA[false]]></defaultValue>
<uid><![CDATA[DDA48DD6-4B0F-4AD5-9B32-D508BBA1A8EE]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[fallback_speech_synthesis_vendor]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
<defaultValue><![CDATA[google]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[26BBDEEF-E179-4280-9917-6F2BD6367459]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[fallback_speech_synthesis_language]]></name>
<type><![CDATA[VARCHAR(12)]]></type>
<defaultValue><![CDATA[en-US]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[E008D6D7-9BB7-4372-8B46-F92C0EB15082]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[fallback_speech_synthesis_voice]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
<notNull><![CDATA[0]]></notNull>
<uid><![CDATA[6A0E92C9-32B9-4179-A893-3DADF5DD7728]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[fallback_speech_synthesis_label]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
<notNull><![CDATA[0]]></notNull>
<uid><![CDATA[8576DEF6-D81A-4D4D-8980-00580779D164]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[fallback_speech_recognizer_vendor]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
<defaultValue><![CDATA[google]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[14ECF5EA-81C5-4EAE-9575-9785CEB672E6]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[fallback_speech_recognizer_language]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
<defaultValue><![CDATA[en-US]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[EC792500-6B2B-4E54-AA89-43E7A0FD8642]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[fallback_speech_recognizer_label]]></name>
<type><![CDATA[VARCHAR(64)]]></type>
<notNull><![CDATA[0]]></notNull>
<uid><![CDATA[65AA5173-6523-49F7-9D95-78C4B3A7C7E6]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[created_at]]></name>
<type><![CDATA[DATETIME]]></type>
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
<forcedUnique><![CDATA[0]]></forcedUnique>
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[C09B1BDB-8390-4B8A-B70A-642EC5E12899]]></uid>
Expand Down Expand Up @@ -2958,7 +3011,7 @@
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
<PageGridVisible><![CDATA[0]]></PageGridVisible>
<RightSidebarWidth><![CDATA[1681.000000]]></RightSidebarWidth>
<RightSidebarWidth><![CDATA[1405.000000]]></RightSidebarWidth>
<sidebarIndex><![CDATA[2]]></sidebarIndex>
<snapToGrid><![CDATA[0]]></snapToGrid>
<SourceSidebarWidth><![CDATA[0.000000]]></SourceSidebarWidth>
Expand All @@ -2967,7 +3020,7 @@
<windowHeight><![CDATA[1055.000000]]></windowHeight>
<windowLocationX><![CDATA[1728.000000]]></windowLocationX>
<windowLocationY><![CDATA[37.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{157, 830}]]></windowScrollOrigin>
<windowScrollOrigin><![CDATA[{0, 597}]]></windowScrollOrigin>
<windowWidth><![CDATA[1682.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
Expand Down
10 changes: 9 additions & 1 deletion db/upgrade-jambonz-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,15 @@ const sql = {
'DROP INDEX speech_credentials_idx_1 ON speech_credentials',
'ALTER TABLE speech_credentials ADD COLUMN label VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN speech_synthesis_label VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN speech_recognizer_label VARCHAR(64)'
'ALTER TABLE applications ADD COLUMN speech_recognizer_label VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN use_for_fallback_speech BOOLEAN DEFAULT false',
'ALTER TABLE applications ADD COLUMN fallback_speech_synthesis_vendor VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN fallback_speech_synthesis_language VARCHAR(12)',
'ALTER TABLE applications ADD COLUMN fallback_speech_synthesis_voice VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN fallback_speech_synthesis_label VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN fallback_speech_recognizer_vendor VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN fallback_speech_recognizer_language VARCHAR(64)',
'ALTER TABLE applications ADD COLUMN fallback_speech_recognizer_label VARCHAR(64)',
]
};

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@jambonz/realtimedb-helpers": "^0.8.6",
"@jambonz/speech-utils": "^0.0.15",
"@jambonz/time-series": "^0.2.8",
"@jambonz/verb-specifications": "^0.0.27",
"@jambonz/verb-specifications": "^0.0.29",
"@jambonz/lamejs": "^1.2.2",
"@soniox/soniox-node": "^1.1.1",
"argon2": "^0.30.3",
Expand Down
38 changes: 35 additions & 3 deletions test/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test('application tests', async(t) => {
]'
}
});
t.ok(result.statusCode === 400, 'Cant create application with invalid app_josn');
t.ok(result.statusCode === 400, 'Cant create application with invalid app_json');

/* add an application */
result = await request.post('/Applications', {
Expand Down Expand Up @@ -81,7 +81,15 @@ test('application tests', async(t) => {
"seekOffset": 8000,\
"actionHook": "/play/action"\
}\
]'
]',
use_for_fallback_speech: 1,
fallback_speech_synthesis_vendor: 'google',
fallback_speech_synthesis_language: 'en-US',
fallback_speech_synthesis_voice: 'man',
fallback_speech_synthesis_label: 'label1',
fallback_speech_recognizer_vendor: 'google',
fallback_speech_recognizer_language: 'en-US',
fallback_speech_recognizer_label: 'label1'
}
});
t.ok(result.statusCode === 201, 'successfully created application');
Expand All @@ -102,6 +110,14 @@ test('application tests', async(t) => {
});
t.ok(result.name === 'daveh' , 'successfully retrieved application by sid');
t.ok(result.messaging_hook.url === 'http://example.com/sms' , 'successfully retrieved messaging_hook from application');
t.ok(result.use_for_fallback_speech === 1, 'successfully create use_for_fallback_speech');
t.ok(result.fallback_speech_synthesis_vendor === 'google', 'successfully create fallback_speech_synthesis_vendor');
t.ok(result.fallback_speech_synthesis_language === 'en-US', 'successfully create fallback_speech_synthesis_language');
t.ok(result.fallback_speech_synthesis_voice === 'man', 'successfully create fallback_speech_synthesis_voice');
t.ok(result.fallback_speech_synthesis_label === 'label1', 'successfully create fallback_speech_synthesis_label');
t.ok(result.fallback_speech_recognizer_vendor === 'google', 'successfully create fallback_speech_recognizer_vendor');
t.ok(result.fallback_speech_recognizer_language === 'en-US', 'successfully create fallback_speech_recognizer_language');
t.ok(result.fallback_speech_recognizer_label === 'label1', 'successfully create fallback_speech_recognizer_label');
let app_json = JSON.parse(result.app_json);
t.ok(app_json[0].verb === 'play', 'successfully retrieved app_json from application')

Expand All @@ -126,7 +142,15 @@ test('application tests', async(t) => {
}\
}\
]',
record_all_calls: true
record_all_calls: true,
use_for_fallback_speech: 0,
fallback_speech_synthesis_vendor: 'microsoft',
fallback_speech_synthesis_language: 'en-US',
fallback_speech_synthesis_voice: 'woman',
fallback_speech_synthesis_label: 'label2',
fallback_speech_recognizer_vendor: 'microsoft',
fallback_speech_recognizer_language: 'en-US',
fallback_speech_recognizer_label: 'label2'
}
});
t.ok(result.statusCode === 204, 'successfully updated application');
Expand All @@ -140,6 +164,14 @@ test('application tests', async(t) => {
app_json = JSON.parse(result.app_json);
t.ok(app_json[0].verb === 'hangup', 'successfully updated app_json from application')
t.ok(result.record_all_calls === 1, 'successfully updated record_all_calls from application')
t.ok(result.use_for_fallback_speech === 0, 'successfully update use_for_fallback_speech');
t.ok(result.fallback_speech_synthesis_vendor === 'microsoft', 'successfully update fallback_speech_synthesis_vendor');
t.ok(result.fallback_speech_synthesis_language === 'en-US', 'successfully update fallback_speech_synthesis_language');
t.ok(result.fallback_speech_synthesis_voice === 'woman', 'successfully update fallback_speech_synthesis_voice');
t.ok(result.fallback_speech_synthesis_label === 'label2', 'successfully update fallback_speech_synthesis_label');
t.ok(result.fallback_speech_recognizer_vendor === 'microsoft', 'successfully update fallback_speech_recognizer_vendor');
t.ok(result.fallback_speech_recognizer_language === 'en-US', 'successfully update fallback_speech_recognizer_language');
t.ok(result.fallback_speech_recognizer_label === 'label2', 'successfully update fallback_speech_recognizer_label');

/* remove applications app_json*/
result = await request.put(`/Applications/${sid}`, {
Expand Down