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

46
package-lock.json generated
View File

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

View File

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