mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-11-08 20:43:46 +00:00
more rest-dial testing
This commit is contained in:
1 parent
2a974704fc
commit
578349506b
2 files changed
+32
-16
No files matched your search
@@ -27,7 +27,7 @@ function validateTo(to) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw new DbErrorBadRequest(`missing or invalid to property: ${to}`);
|
||||
throw new DbErrorBadRequest(`missing or invalid to property: ${JSON.stringify(to)}`);
|
||||
}
|
||||
async function validateCreateCall(logger, sid, req) {
|
||||
const {lookupApplicationBySid} = require('jambonz-db-helpers')(config.get('mysql'), logger);
|
||||
@@ -35,6 +35,7 @@ async function validateCreateCall(logger, sid, req) {
|
||||
|
||||
if (req.user.account_sid !== sid) throw new DbErrorBadRequest(`unauthorized createCall request for account ${sid}`);
|
||||
|
||||
obj.account_sid = sid;
|
||||
if (!obj.from) throw new DbErrorBadRequest('missing from parameter');
|
||||
validateTo(obj.to);
|
||||
|
||||
@@ -57,8 +58,18 @@ async function validateCreateCall(logger, sid, req) {
|
||||
throw new DbErrorBadRequest(`application_sid not found ${obj.application_sid}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Object.assign(obj, {
|
||||
speech_synthesis_vendor: 'google',
|
||||
speech_synthesis_voice: 'en-US-Wavenet-C',
|
||||
speech_recognizer_vendor: 'google',
|
||||
speech_recognizer_language: 'en-US'
|
||||
});
|
||||
}
|
||||
|
||||
if (!obj.call_hook || (obj.call_hook && !obj.call_hook.url)) throw new DbErrorBadRequest('either url or application_sid required');
|
||||
if (!obj.call_hook || (obj.call_hook && !obj.call_hook.url)) {
|
||||
throw new DbErrorBadRequest('either url or application_sid required');
|
||||
}
|
||||
}
|
||||
|
||||
async function validateAdd(req) {
|
||||
|
||||
Reference in new issue
Block a user