Compare commits

...

73 Commits

Author SHA1 Message Date
Dave Horton
873d8dc0c8 0.0.35 2023-09-20 07:31:02 -04:00
Hoan Luu Huu
992a5fe897 add support for dual streams in rest:dial (#25) 2023-09-20 07:30:23 -04:00
Dave Horton
6803a3e49d 0.0.34 2023-09-13 09:39:46 -04:00
Hoan Luu Huu
2d2145917e feat fast recognition (#22) 2023-09-13 09:39:17 -04:00
Anton Voylenko
4fa8d46fd8 missing config verbs for listen (#24) 2023-09-13 09:33:25 -04:00
Dave Horton
9690e14f64 0.0.33 2023-09-13 08:59:09 -04:00
Dave Horton
49752d16ea allow specification of token for cobalt speech when compiling contexts 2023-09-13 08:59:01 -04:00
Dave Horton
9e141cba6a 0.0.32 2023-09-12 20:48:02 -04:00
Dave Horton
82e2bc5239 Vendor/cobalt (#23)
* add support for cobalt

* more changes for cobalt

* 0.0.31

* more cobalt options
2023-09-12 20:47:30 -04:00
Dave Horton
3a5b053248 0.0.30 2023-08-19 09:45:46 -04:00
Dave Horton
d74364b1c2 Merge pull request #21 from avoylenko/main
endConferenceDuration for conference verb
2023-08-19 09:45:36 -04:00
Anton Voylenko
213d7596d2 endConferenceDuration for conference verb 2023-08-19 15:36:02 +03:00
Dave Horton
3d4df422e1 0.0.29 2023-08-17 07:53:39 -04:00
Dave Horton
3531711991 Merge pull request #20 from jambonz/feat/fallback_speech
feat fallback speech vendor
2023-08-17 07:53:07 -04:00
Quan HL
f860074a24 fix typo 2023-08-17 11:54:15 +07:00
Quan HL
65de44012a feat fallback speech vendor 2023-08-17 11:29:44 +07:00
Dave Horton
067a49bd2c 0.0.28 2023-08-15 18:17:33 -04:00
Dave Horton
4967efa745 Merge pull request #19 from jambonz/feat/moh_01
add onHoldHook to dial verb
2023-08-15 18:16:39 -04:00
Quan HL
61669e5574 add onHoldHook to dial verb 2023-08-16 05:01:34 +07:00
Dave Horton
e25ef7349e 0.0.27 2023-08-15 08:47:07 -04:00
Dave Horton
26f5609996 Merge pull request #18 from jambonz/fix/multi_speech_same_vendor
feat add label to synthesizer
2023-08-15 08:45:58 -04:00
Quan HL
1a1436b612 add label to recognizer 2023-08-15 09:14:33 +07:00
Quan HL
ba9a9f9b60 feat add label to synthesizer 2023-08-15 07:07:47 +07:00
Dave Horton
93c368e894 Merge pull request #17 from jambonz/feat/moh
feat: add onhold music to dial verb
2023-08-10 07:49:26 -04:00
Quan HL
185e4df06e obholdMusic for config verb 2023-08-10 13:56:10 +07:00
Quan HL
c22e8c9cf0 feat: add onhold music to dial verb 2023-07-25 17:56:28 +07:00
Dave Horton
1c3d86c807 0.0.26 2023-07-20 07:35:08 -04:00
Dave Horton
7e986acc17 Merge pull request #15 from jambonz/feat/siprec_custom_headers
feat confige record allow SIP custom headers
2023-07-20 07:34:29 -04:00
Quan HL
d5c535c02c feat confige record allow SIP custom headers 2023-07-20 15:12:10 +07:00
Dave Horton
6e819279d1 0.0.25 2023-06-19 06:45:03 +01:00
Dave Horton
24e73a4dc6 Merge pull request #13 from jambonz/feat/multi_srs
config with multiple siprecServerURL
2023-06-19 06:44:28 +01:00
Quan HL
cfd367f185 config with multiple siprecServerURL 2023-06-19 07:26:53 +07:00
Dave Horton
f472de9638 0.0.24 2023-06-02 12:53:12 -04:00
Dave Horton
45a2a039cd transcribe: recognizer is not required, but transcriptionHook is 2023-06-02 12:53:00 -04:00
Dave Horton
4a345633a3 0.0.23 2023-05-28 21:55:58 -04:00
Dave Horton
f14ff2e319 Merge pull request #12 from jambonz/feat/advanced_queue
feat: enqueue dequeue priority and callSid
2023-05-28 21:55:35 -04:00
Quan HL
c85cb7e67e feat: enqueue dequeue priority and callSid 2023-05-29 07:09:00 +07:00
Dave Horton
8ccb13f962 0.0.22 2023-05-09 11:48:09 -04:00
Dave Horton
044ce2d4bb add synthesizer.options 2023-05-09 11:48:00 -04:00
Dave Horton
b483e04611 0.0.21 2023-05-08 09:47:01 -04:00
Dave Horton
c1032638b2 config: add support for resetting recognizer and/or synthesizer to application defaults 2023-05-08 09:46:45 -04:00
Dave Horton
72225385ae 0.0.20 2023-05-07 08:41:52 -04:00
Dave Horton
6ad9d2bce0 Merge pull request #11 from jambonz/feat/rest_dial_amd
rest:dial amd
2023-05-07 08:41:37 -04:00
Quan HL
045df8a9fe rest:dial amd 2023-05-07 19:40:28 +07:00
Dave Horton
f3ede17b80 0.0.19 2023-05-07 08:31:16 -04:00
Dave Horton
2551dbe18e Merge pull request #10 from jambonz/feat/remove_metadata
fix: remove metadata in rest:dial
2023-05-07 08:31:02 -04:00
Quan HL
f4a887a67a fix: remove metadata in rest:dial 2023-05-07 19:30:17 +07:00
Dave Horton
874abac5e3 0.0.18 2023-05-06 21:12:49 -04:00
Dave Horton
827ddcebf0 Merge pull request #9 from jambonz/feat/metadata
feat: add rest:dial metadata
2023-05-06 21:11:56 -04:00
Quan HL
98043693be feat: add rest:dial metadata 2023-05-07 06:39:35 +07:00
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
7 changed files with 213 additions and 64 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.2",
"name": "@jambonz/verb-specifications",
"version": "0.0.35",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "verb-specifications",
"version": "0.0.2",
"name": "@jambonz/verb-specifications",
"version": "0.0.35",
"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.2",
"name": "@jambonz/verb-specifications",
"version": "0.0.35",
"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

@@ -44,7 +44,9 @@
"record": "#recordOptions",
"listen": "#listenOptions",
"amd": "#amd",
"notifyEvents": "boolean"
"notifyEvents": "boolean",
"reset": "string|array",
"onHoldMusic": "string"
},
"required": []
},
@@ -58,7 +60,12 @@
"type": "string",
"enum": ["mono", "stereo", "mixed"]
},
"metadata": "object"
"metadata": "object",
"maxLength": "number",
"passDtmf": "boolean",
"playBeep": "boolean",
"disableBidirectionalAudio": "boolean",
"timeout": "number"
},
"required": [
"enable"
@@ -88,7 +95,8 @@
"name": "string",
"actionHook": "object|string",
"timeout": "number",
"beep": "boolean"
"beep": "boolean",
"callSid": "string"
},
"required": [
"name"
@@ -100,6 +108,7 @@
"name": "string",
"actionHook": "object|string",
"waitHook": "object|string",
"priority": "number",
"_": "object"
},
"required": [
@@ -177,6 +186,7 @@
"beep": "boolean",
"startConferenceOnEnter": "boolean",
"endConferenceOnExit": "boolean",
"endConferenceDuration": "number",
"maxParticipants": "number",
"joinMuted": "boolean",
"actionHook": "object|string",
@@ -194,14 +204,17 @@
"properties": {
"id": "string",
"actionHook": "object|string",
"onHoldHook": "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",
@@ -359,7 +372,8 @@
"enum": ["startCallRecording", "stopCallRecording", "pauseCallRecording", "resumeCallRecording"]
},
"recordingID": "string",
"siprecServerURL": "string"
"siprecServerURL": "string|array",
"headers": "object"
},
"required": [
"action"
@@ -382,6 +396,7 @@
"call_hook": "object|string",
"call_status_hook": "object|string",
"from": "string",
"callerName": "string",
"fromHost": "string",
"speech_synthesis_vendor": "string",
"speech_synthesis_voice": "string",
@@ -391,7 +406,9 @@
"tag": "object",
"to": "#target",
"headers": "object",
"timeout": "number"
"timeout": "number",
"amd": "#amd",
"dual_streams" : "boolean"
},
"required": [
"call_hook",
@@ -416,7 +433,7 @@
"earlyMedia": "boolean"
},
"required": [
"recognizer"
"transcriptionHook"
]
},
"target": {
@@ -465,12 +482,14 @@
},
"synthesizer": {
"properties": {
"vendor": {
"type": "string",
"enum": ["google", "aws", "polly", "microsoft", "nuance", "ibm", "default"]
},
"vendor": "string",
"label": "string",
"language": "string",
"voice": "string",
"fallbackVendor": "string",
"fallbackLabel": "string",
"fallbackLanguage": "string",
"fallbackVoice": "string",
"engine": {
"type": "string",
"enum": ["standard", "neural"]
@@ -478,7 +497,8 @@
"gender": {
"type": "string",
"enum": ["MALE", "FEMALE", "NEUTRAL"]
}
},
"options": "object"
},
"required": [
"vendor"
@@ -486,11 +506,12 @@
},
"recognizer": {
"properties": {
"vendor": {
"type": "string",
"enum": ["google", "aws", "microsoft", "nuance", "deepgram", "ibm", "default"]
},
"vendor": "string",
"label": "string",
"language": "string",
"fallbackVendor": "string",
"fallbackLabel": "string",
"fallbackLanguage": "string",
"vad": "#vad",
"hints": "array",
"hintsBoost": "number",
@@ -553,14 +574,53 @@
"azureSttEndpointId": "string",
"asrDtmfTerminationDigit": "string",
"asrTimeout": "number",
"fastRecognitionTimeout": "number",
"nuanceOptions": "#nuanceOptions",
"deepgramOptions": "#deepgramOptions",
"ibmOptions": "#ibmOptions"
"ibmOptions": "#ibmOptions",
"nvidiaOptions": "#nvidiaOptions",
"sonioxOptions": "#sonioxOptions",
"cobaltOptions": "#cobaltOptions",
"customOptions": "#customOptions"
},
"required": [
"vendor"
]
},
"customOptions": {
"properties": {
"authToken": "string",
"uri": "string",
"options": "object"
},
"required": [
]
},
"cobaltOptions": {
"properties": {
"serverUri": "string",
"enableConfusionNetwork": "boolean",
"metadata": "string",
"compiledContextData": "string",
"wordTimeOffsets": "boolean",
"contextToken": "string"
},
"required": [
]
},
"nvidiaOptions": {
"properties": {
"rivaUri": "string",
"maxAlternatives": "number",
"profanityFilter": "boolean",
"punctuation": "boolean",
"wordTimeOffsets": "boolean",
"verbatimTranscripts": "boolean",
"customConfiguration": "object"
},
"required": [
]
},
"ibmOptions": {
"properties": {
"sttApiKey": "string",
@@ -581,26 +641,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 +665,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 +746,7 @@
"inlineWordset": "string",
"builtin": "string",
"inlineGrammar": "string",
"wakeupWord": "[string]",
"wakeupWord": "array",
"weightName": {
"type": "string",
"enum": [
@@ -774,4 +841,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) => {
@@ -24,28 +24,52 @@ test("validate correct verbs", async (t) => {
"verb": "config",
"synthesizer": {
"voice": "Jenny",
"vendor": "google"
"vendor": "google",
"label": "label1"
},
"recognizer": {
"vendor": "google",
"language": "de-DE"
"language": "de-DE",
"label": "label1"
},
"bargeIn": {
"enable": true,
"input" : ["speech"],
"actionHook": "/userInput"
},
"onHoldMusic": "http://server.com/hold"
},
{
"verb": "config",
"record": {
"action": "startCallRecording",
"siprecServerURL": ["sip:srs@recording.example.com","sip:srs@recording.example.com"],
"headers" : {
"X-Header1": "Value1",
"X-Header2": "Value2"
}
}
},
{
"verb": "config",
"record": {
"action": "startCallRecording",
"siprecServerURL": "sip:srs@recording.example.com"
}
},
{
"verb": "dequeue",
"name": "support",
"beep": true,
"timeout": 60
"timeout": 60,
"callSid": "call_sid1234"
},
{
"verb": "dial",
"actionHook": "/outdial",
"onHoldHook": "/onHoldHook",
"callerId": "+16173331212",
"callerName": "Tom",
"answerOnBridge": true,
"dtmfCapture": ["*2", "*3"],
"dtmfHook": {
@@ -94,7 +118,8 @@ test("validate correct verbs", async (t) => {
"verb": "enqueue",
"name": "support",
"actionHook": "/queue-action",
"waitHook": "/queue-wait"
"waitHook": "/queue-wait",
"priority": 50
},
{
"verb": "gather",
@@ -109,16 +134,47 @@ test("validate correct verbs", async (t) => {
"vendor": "google",
"language": "en-US",
"hints": ["sales", "support"],
"hintsBoost": 10
"hintsBoost": 10,
"fastRecognitionTimeout": 2000,
"deepgramOptions": {
"endpointing": 500
}
},
"say": {
"text": "To speak to Sales press 1 or say Sales. To speak to customer support press 2 or say Support",
"synthesizer": {
"vendor": "google",
"language": "en-US"
"language": "en-US",
"label": "label1",
"fallbackVendor": "google",
"fallbackLanguage": "en-US",
"fallbackLabel": "label1",
"fallbackVoice": "voice"
}
}
},
{
"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",
"fallbackVendor": "google",
"fallbackLanguage": "en-US",
"fallbackLabel": "label1",
"hints": ["sales", "support"],
"hintsBoost": 10,
"deepgramOptions": {
"endpointing": true
}
},
},
{
"verb": "hangup",
"headers": {
@@ -231,10 +287,34 @@ test("validate correct verbs", async (t) => {
"verb": "transcribe",
"transcriptionHook": "http://example.com/transcribe",
"recognizer": {
"vendor": "google",
"vendor": "nvidia",
"language" : "en-US",
"interim": true
}
},
{
"verb": "rest:dial",
"account_sid": "1291964182631236912836123912",
"call_hook": {
"url": "http://127.0.0.1:3100/",
"method": "POST",
"username": "username",
"password": "password",
},
"from": "15583084810",
"to": {
"type": "phone",
"number": "15583084809",
},
"tag": {
"customer": "acme",
"referenceId": "deadbeef",
},
"amd": {
"actionHook": "/answeringMachineDetection",
},
"dual_streams": true
}
];
try {