Compare commits

...

25 Commits

Author SHA1 Message Date
Dave Horton
436c8e1861 0.0.17 2023-04-28 07:39:08 -04:00
Dave Horton
21214eb2ce Merge pull request #8 from jambonz/feat/deepgram_endpointing
deepgram: endpointing support number
2023-04-28 07:38:15 -04:00
Quan HL
017b8cd0c3 deepgram: endpointing support number 2023-04-28 11:32:15 +07:00
Dave Horton
8ae7419b7a 0.0.16 2023-04-13 13:13:53 -04:00
Dave Horton
11c34aa6fc dont restrict deepgram tier 2023-04-13 13:13:43 -04:00
Dave Horton
5548a67412 0.0.15 2023-04-13 13:05:09 -04:00
Dave Horton
8f89bac676 dont restrict deepgram models 2023-04-13 13:05:05 -04:00
Dave Horton
146f691890 bump version 2023-04-11 20:18:12 -04:00
Dave Horton
283512e765 Merge pull request #6 from jambonz/feat/dial_caller_name
feat: update callerName to dial
2023-04-11 20:17:27 -04:00
Quan HL
d7219b990b feat: update callerName to rest 2023-04-12 06:38:16 +07:00
Quan HL
68b3c7de01 feat: update callerName to dial 2023-04-12 06:30:29 +07:00
Dave Horton
dff94d3ac5 add anchorMedia option to dial verb 2023-04-07 14:05:37 -04:00
Dave Horton
70f7c5ab96 another fix for wakeupWord 2023-03-03 09:16:51 -05:00
Dave Horton
403766cd4d fix wakeupWord syntax 2023-03-03 09:08:50 -05:00
Dave Horton
10c7f60bad fix json error 2023-03-02 14:52:10 -05:00
Dave Horton
32f63759db add options for custom speech 2023-03-02 14:45:12 -05:00
Dave Horton
825130348b remove enum on speech vendor since we want to allow custom 2023-03-02 13:21:00 -05:00
Dave Horton
f99b94a405 add soniox storage options 2023-02-24 14:35:18 -05:00
Dave Horton
6c40dda566 add options for soniox 2023-02-23 14:19:34 -05:00
Dave Horton
899f55a272 remove logging statements 2023-02-23 10:54:46 -05:00
Dave Horton
22a6b30aa3 Merge pull request #4 from jambonz/fix/export
fix: module export to index.js file
2023-02-15 09:14:55 -05:00
Dave Horton
430a702752 update specs and change name to @jambonz/verb-specifications 2023-02-15 09:13:03 -05:00
Quan HL
8dbbe13c5f fix: module export to index.js file 2023-02-15 17:31:02 +07:00
Dave Horton
35e140f69e bump version 2023-02-13 21:37:12 -05:00
Dave Horton
0a85aae84f Merge pull request #3 from jambonz/fix/missing_utils
feat: export validate verb function
2023-02-13 21:34:33 -05:00
7 changed files with 106 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023 jambonz
Copyright (c) 2023 Drachtio Communications Services, LLC.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -0,0 +1,4 @@
module.exports = {
...require('./jambonz-app-json-validation'),
specs: require('./specs')
};

View File

@@ -1,4 +1,5 @@
const assert = require('assert');
const debug = require('debug')('jambonz:app-json-validation');
const _specData = require('./specs');
const specs = new Map();
for (const key in _specData) { specs.set(key, _specData[key]); }
@@ -30,7 +31,7 @@ function normalizeJambones(logger, obj) {
throw new Error('malformed jambonz payload: missing verb property');
}
}
logger.debug({ document }, `normalizeJambones: returning document with ${document.length} tasks`);
debug({ document }, `normalizeJambones: returning document with ${document.length} tasks`);
return document;
}
@@ -44,7 +45,7 @@ function validate(logger, obj) {
}
function validateVerb(name, data, logger) {
logger.debug(`validating ${name} with data ${JSON.stringify(data)}`);
debug(`validating ${name} with data ${JSON.stringify(data)}`);
// validate the instruction is supported
if (!specs.has(name)) throw new Error(`invalid instruction: ${name}`);
@@ -55,7 +56,7 @@ function validateVerb(name, data, logger) {
if (dKey in specData.properties) {
const dVal = data[dKey];
const dSpec = specData.properties[dKey];
logger.debug(`Task:validate validating property ${dKey} with value ${JSON.stringify(dVal)}`);
debug(`Task:validate validating property ${dKey} with value ${JSON.stringify(dVal)}`);
if (typeof dSpec === 'string' && dSpec === 'array') {
if (!Array.isArray(dVal)) throw new Error(`${name}: property ${dKey} is not an array`);

17
package-lock.json generated
View File

@@ -1,14 +1,15 @@
{
"name": "verb-specifications",
"version": "0.0.1",
"name": "@jambonz/verb-specifications",
"version": "0.0.17",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "verb-specifications",
"version": "0.0.1",
"name": "@jambonz/verb-specifications",
"version": "0.0.17",
"license": "MIT",
"dependencies": {
"debug": "^4.3.4",
"pino": "^8.8.0"
},
"devDependencies": {
@@ -435,7 +436,6 @@
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"dependencies": {
"ms": "2.1.2"
},
@@ -1671,8 +1671,7 @@
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/natural-compare": {
"version": "1.4.0",
@@ -2771,7 +2770,6 @@
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"requires": {
"ms": "2.1.2"
}
@@ -3671,8 +3669,7 @@
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"natural-compare": {
"version": "1.4.0",

View File

@@ -1,12 +1,11 @@
{
"name": "verb-specifications",
"version": "0.0.1",
"name": "@jambonz/verb-specifications",
"version": "0.0.17",
"description": "Jambonz Verb Specification Utilities",
"main": "index.js",
"scripts": {
"test": "node test/",
"jslint": "eslint index.js"
},
"repository": {
"type": "git",
@@ -24,6 +23,7 @@
"tape": "^5.6.1"
},
"dependencies": {
"debug": "^4.3.4",
"pino": "^8.8.0"
}
}

View File

@@ -196,12 +196,14 @@
"actionHook": "object|string",
"answerOnBridge": "boolean",
"callerId": "string",
"callerName": "string",
"confirmHook": "object|string",
"referHook": "object|string",
"dialMusic": "string",
"dtmfCapture": "object",
"dtmfHook": "object|string",
"headers": "object",
"anchorMedia": "boolean",
"listen": "#listen",
"target": ["#target"],
"timeLimit": "number",
@@ -382,6 +384,7 @@
"call_hook": "object|string",
"call_status_hook": "object|string",
"from": "string",
"callerName": "string",
"fromHost": "string",
"speech_synthesis_vendor": "string",
"speech_synthesis_voice": "string",
@@ -465,10 +468,7 @@
},
"synthesizer": {
"properties": {
"vendor": {
"type": "string",
"enum": ["google", "aws", "polly", "microsoft", "nuance", "ibm", "default"]
},
"vendor": "string",
"language": "string",
"voice": "string",
"engine": {
@@ -486,10 +486,7 @@
},
"recognizer": {
"properties": {
"vendor": {
"type": "string",
"enum": ["google", "aws", "microsoft", "nuance", "deepgram", "ibm", "default"]
},
"vendor": "string",
"language": "string",
"vad": "#vad",
"hints": "array",
@@ -555,12 +552,37 @@
"asrTimeout": "number",
"nuanceOptions": "#nuanceOptions",
"deepgramOptions": "#deepgramOptions",
"ibmOptions": "#ibmOptions"
"ibmOptions": "#ibmOptions",
"nvidiaOptions": "#nvidiaOptions",
"sonioxOptions": "#sonioxOptions",
"customOptions": "#customOptions"
},
"required": [
"vendor"
]
},
"customOptions": {
"properties": {
"authToken": "string",
"uri": "string",
"options": "object"
},
"required": [
]
},
"nvidiaOptions": {
"properties": {
"rivaUri": "string",
"maxAlternatives": "number",
"profanityFilter": "boolean",
"punctuation": "boolean",
"wordTimeOffsets": "boolean",
"verbatimTranscripts": "boolean",
"customConfiguration": "object"
},
"required": [
]
},
"ibmOptions": {
"properties": {
"sttApiKey": "string",
@@ -581,26 +603,8 @@
"deepgramOptions": {
"properties": {
"apiKey": "string",
"tier": {
"type": "string",
"enum": [
"enhanced",
"base"
]
},
"model": {
"type": "string",
"enum": [
"general",
"meeting",
"phonecall",
"voicemail",
"finance",
"conversationalai",
"video",
"custom"
]
},
"tier": "string",
"model": "string",
"customModel": "string",
"version": "string",
"punctuate": "boolean",
@@ -623,11 +627,36 @@
"search": "array",
"replace": "array",
"keywords": "array",
"endpointing": "boolean",
"endpointing": "boolean | number",
"vadTurnoff": "number",
"tag": "string"
}
},
"sonioxOptions": {
"properties": {
"apiKey": "string",
"model": "string",
"endpointDetection": "boolean",
"profanityFilter": "boolean",
"speechContext": "string",
"clientRequestReference": "string",
"storage": "#sonioxStorage"
},
"required": [
]
},
"sonioxStorage": {
"properties": {
"id": "string",
"title": "string",
"disableStoreAudio": "boolean",
"disableStoreTranscript": "boolean",
"disableSearch": "boolean",
"metadata": "object"
},
"required": [
]
},
"nuanceOptions": {
"properties": {
"clientId": "string",
@@ -679,7 +708,7 @@
"inlineWordset": "string",
"builtin": "string",
"inlineGrammar": "string",
"wakeupWord": "[string]",
"wakeupWord": "array",
"weightName": {
"type": "string",
"enum": [
@@ -774,4 +803,4 @@
"greetingCompletionTimeoutMs": "number"
}
}
}
}

View File

@@ -1,6 +1,6 @@
const test = require('tape');
const logger = require('pino')({level: process.env.JAMBONES_LOGLEVEL || 'error'});
const { validate } = require('../jambonz-app-json-validation');
const { validate } = require('..');
test("validate correct verbs", async (t) => {
@@ -46,6 +46,7 @@ test("validate correct verbs", async (t) => {
"verb": "dial",
"actionHook": "/outdial",
"callerId": "+16173331212",
"callerName": "Tom",
"answerOnBridge": true,
"dtmfCapture": ["*2", "*3"],
"dtmfHook": {
@@ -109,7 +110,10 @@ test("validate correct verbs", async (t) => {
"vendor": "google",
"language": "en-US",
"hints": ["sales", "support"],
"hintsBoost": 10
"hintsBoost": 10,
"deepgramOptions": {
"endpointing": 500
}
},
"say": {
"text": "To speak to Sales press 1 or say Sales. To speak to customer support press 2 or say Support",
@@ -119,6 +123,25 @@ test("validate correct verbs", async (t) => {
}
}
},
{
"verb": "gather",
"actionHook": "http://example.com/collect",
"input": ["digits", "speech"],
"bargein": true,
"dtmfBargein": true,
"finishOnKey": "#",
"numDigits": 5,
"timeout": 8,
"recognizer": {
"vendor": "google",
"language": "en-US",
"hints": ["sales", "support"],
"hintsBoost": 10,
"deepgramOptions": {
"endpointing": true
}
},
},
{
"verb": "hangup",
"headers": {
@@ -231,7 +254,7 @@ test("validate correct verbs", async (t) => {
"verb": "transcribe",
"transcriptionHook": "http://example.com/transcribe",
"recognizer": {
"vendor": "google",
"vendor": "nvidia",
"language" : "en-US",
"interim": true
}