This commit is contained in:
Dave Horton
2023-07-20 14:28:46 -04:00
parent 3cac6f654b
commit 756c9b61bc
3 changed files with 39 additions and 55 deletions

View File

@@ -11,23 +11,21 @@ const service = ({logger, makeService}) => {
.on('/interimTranscript', onInterim.bind(null, session)) .on('/interimTranscript', onInterim.bind(null, session))
.on('/echo', onSpeechEvent.bind(null, session)); .on('/echo', onSpeechEvent.bind(null, session));
session try {
.pause({length: 1.5}) session
.gather({ .pause({length: 1.5})
say: {text: 'Please say something and we will echo it back to you.'}, .gather({
input: ['speech'], say: {text: 'Please say something and we will echo it back to you.'},
actionHook: '/echo', input: ['speech'],
partialResultHook: '/interimTranscript', actionHook: '/echo',
timeout: 15, partialResultHook: '/interimTranscript',
recognizer: { timeout: 15,
vendor: 'nuance', })
language: 'en-US', .send();
nuanceOptions: {
kryptonEndpoint: '34.199.234.49:7021' } catch (err) {
} logger.error({err}, `error handling session ${session.call_sid}`);
} }
})
.send();
}); });
}; };
@@ -57,13 +55,6 @@ const echoSpeech = async(session, evt) => {
say: {text: 'Say something else.'}, say: {text: 'Say something else.'},
input: ['speech'], input: ['speech'],
actionHook: '/echo', actionHook: '/echo',
recognizer: {
vendor: 'nuance',
language: 'en-US',
nuanceOptions: {
kryptonEndpoint: '34.199.234.49:7021'
}
}
}) })
.reply(); .reply();
}; };
@@ -74,13 +65,6 @@ const reprompt = async(session, evt) => {
say: {text: 'Are you still there? I didn\'t hear anything.'}, say: {text: 'Are you still there? I didn\'t hear anything.'},
input: ['speech'], input: ['speech'],
actionHook: '/echo', actionHook: '/echo',
recognizer: {
vendor: 'nuance',
language: 'en-US',
nuanceOptions: {
kryptonEndpoint: '34.199.234.49:7021'
}
}
}) })
.reply(); .reply();
}; };

46
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "0.0.1", "version": "0.0.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jambonz/node-client-ws": "^0.1.11", "@jambonz/node-client-ws": "^0.1.13",
"pino": "^8.11.0" "pino": "^8.11.0"
}, },
"devDependencies": { "devDependencies": {
@@ -83,19 +83,19 @@
"dev": true "dev": true
}, },
"node_modules/@jambonz/node-client-ws": { "node_modules/@jambonz/node-client-ws": {
"version": "0.1.11", "version": "0.1.13",
"resolved": "https://registry.npmjs.org/@jambonz/node-client-ws/-/node-client-ws-0.1.11.tgz", "resolved": "https://registry.npmjs.org/@jambonz/node-client-ws/-/node-client-ws-0.1.13.tgz",
"integrity": "sha512-B+yGifcYLZk765E8P8JDmBOp5UvknoutIv/FaaWTRnY/br8YcEQZ2rehcOVTmOIAnod77QSkodAOTqo1VjZOCQ==", "integrity": "sha512-yAzcjGsNnNoxcUKNjvoaiwcp64dqFt/QrU0HYAxJcVeQNS0NaRBm8aWs6/BBMu4fd3uGCDNDH5Kby79CxoWljw==",
"dependencies": { "dependencies": {
"@jambonz/verb-specifications": "^0.0.6", "@jambonz/verb-specifications": "^0.0.17",
"parseurl": "^1.3.3", "parseurl": "^1.3.3",
"ws": "^8.12.0" "ws": "^8.13.0"
} }
}, },
"node_modules/@jambonz/verb-specifications": { "node_modules/@jambonz/verb-specifications": {
"version": "0.0.6", "version": "0.0.17",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.6.tgz", "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.17.tgz",
"integrity": "sha512-lb6bYENWr19KA4hDtQQJI/CM+MQOpBJqGusn7OXb2SWoVfPvW/VQcPo+TOEnmyA/H4vhLxo1LZpf4NbPdI4Isg==", "integrity": "sha512-tYi6rKShNhU/pXc/ZaEeTYfdv5LXmRaGWfdcN499IiGqMnAFZ/0p0HYgOoSsupn90hlquFsy4eyg+41hxherTw==",
"dependencies": { "dependencies": {
"debug": "^4.3.4", "debug": "^4.3.4",
"pino": "^8.8.0" "pino": "^8.8.0"
@@ -1377,9 +1377,9 @@
"dev": true "dev": true
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "8.12.1", "version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.12.1.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew==", "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"
}, },
@@ -1457,19 +1457,19 @@
"dev": true "dev": true
}, },
"@jambonz/node-client-ws": { "@jambonz/node-client-ws": {
"version": "0.1.11", "version": "0.1.13",
"resolved": "https://registry.npmjs.org/@jambonz/node-client-ws/-/node-client-ws-0.1.11.tgz", "resolved": "https://registry.npmjs.org/@jambonz/node-client-ws/-/node-client-ws-0.1.13.tgz",
"integrity": "sha512-B+yGifcYLZk765E8P8JDmBOp5UvknoutIv/FaaWTRnY/br8YcEQZ2rehcOVTmOIAnod77QSkodAOTqo1VjZOCQ==", "integrity": "sha512-yAzcjGsNnNoxcUKNjvoaiwcp64dqFt/QrU0HYAxJcVeQNS0NaRBm8aWs6/BBMu4fd3uGCDNDH5Kby79CxoWljw==",
"requires": { "requires": {
"@jambonz/verb-specifications": "^0.0.6", "@jambonz/verb-specifications": "^0.0.17",
"parseurl": "^1.3.3", "parseurl": "^1.3.3",
"ws": "^8.12.0" "ws": "^8.13.0"
} }
}, },
"@jambonz/verb-specifications": { "@jambonz/verb-specifications": {
"version": "0.0.6", "version": "0.0.17",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.6.tgz", "resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.17.tgz",
"integrity": "sha512-lb6bYENWr19KA4hDtQQJI/CM+MQOpBJqGusn7OXb2SWoVfPvW/VQcPo+TOEnmyA/H4vhLxo1LZpf4NbPdI4Isg==", "integrity": "sha512-tYi6rKShNhU/pXc/ZaEeTYfdv5LXmRaGWfdcN499IiGqMnAFZ/0p0HYgOoSsupn90hlquFsy4eyg+41hxherTw==",
"requires": { "requires": {
"debug": "^4.3.4", "debug": "^4.3.4",
"pino": "^8.8.0" "pino": "^8.8.0"
@@ -2377,9 +2377,9 @@
"dev": true "dev": true
}, },
"ws": { "ws": {
"version": "8.12.1", "version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.12.1.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew==", "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"requires": {} "requires": {}
}, },
"yocto-queue": { "yocto-queue": {

View File

@@ -10,7 +10,7 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jambonz/node-client-ws": "^0.1.11", "@jambonz/node-client-ws": "^0.1.13",
"pino": "^8.11.0" "pino": "^8.11.0"
}, },
"devDependencies": { "devDependencies": {