mirror of
https://github.com/jambonz/jambonz-node.git
synced 2026-10-09 21:14:07 +00:00
add support for rasa verb, and support for providing multiple webhook secrets
This commit is contained in:
+24
-8
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"sip_decline": {
|
"sip:decline": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"status": "number",
|
"status": "number",
|
||||||
"reason": "string",
|
"reason": "string",
|
||||||
@@ -124,6 +124,10 @@
|
|||||||
"credentials": "object|string",
|
"credentials": "object|string",
|
||||||
"project": "string",
|
"project": "string",
|
||||||
"environment": "string",
|
"environment": "string",
|
||||||
|
"region": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["europe-west1", "europe-west2", "australia-southeast1", "asia-northeast1"]
|
||||||
|
},
|
||||||
"lang": "string",
|
"lang": "string",
|
||||||
"actionHook": "object|string",
|
"actionHook": "object|string",
|
||||||
"eventHook": "object|string",
|
"eventHook": "object|string",
|
||||||
@@ -166,17 +170,14 @@
|
|||||||
"passDtmf": "boolean",
|
"passDtmf": "boolean",
|
||||||
"actionHook": "object|string",
|
"actionHook": "object|string",
|
||||||
"eventHook": "object|string",
|
"eventHook": "object|string",
|
||||||
"prompt": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": ["lex", "tts"]
|
|
||||||
},
|
|
||||||
"noInputTimeout": "number",
|
"noInputTimeout": "number",
|
||||||
"tts": "#synthesizer"
|
"tts": "#synthesizer"
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"botId",
|
"botId",
|
||||||
"botAlias",
|
"botAlias",
|
||||||
"region"
|
"region",
|
||||||
|
"credentials"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"listen": {
|
"listen": {
|
||||||
@@ -205,7 +206,9 @@
|
|||||||
},
|
},
|
||||||
"message": {
|
"message": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"provider": "string",
|
"carrier": "string",
|
||||||
|
"account_sid": "string",
|
||||||
|
"message_sid": "string",
|
||||||
"to": "string",
|
"to": "string",
|
||||||
"from": "string",
|
"from": "string",
|
||||||
"text": "string",
|
"text": "string",
|
||||||
@@ -225,6 +228,19 @@
|
|||||||
"length"
|
"length"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"rasa": {
|
||||||
|
"properties": {
|
||||||
|
"url": "string",
|
||||||
|
"recognizer": "#recognizer",
|
||||||
|
"tts": "#synthesizer",
|
||||||
|
"prompt": "string",
|
||||||
|
"actionHook": "object|string",
|
||||||
|
"eventHook": "object|string"
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"url"
|
||||||
|
]
|
||||||
|
},
|
||||||
"redirect": {
|
"redirect": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"actionHook": "object|string"
|
"actionHook": "object|string"
|
||||||
@@ -233,7 +249,7 @@
|
|||||||
"actionHook"
|
"actionHook"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"rest_dial": {
|
"rest:dial": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"account_sid": "string",
|
"account_sid": "string",
|
||||||
"application_sid": "string",
|
"application_sid": "string",
|
||||||
|
|||||||
@@ -99,10 +99,15 @@ class WebhookResponse {
|
|||||||
if (!details.signatures.length) {
|
if (!details.signatures.length) {
|
||||||
throw new Error('no signatures found');
|
throw new Error('no signatures found');
|
||||||
}
|
}
|
||||||
const expectedSignature = computeSignature(req.body, details.timestamp, secret);
|
const secrets = Array.isArray(secret) ? secret : [secret];
|
||||||
const signatureFound = details.signatures.filter(
|
let signatureFound = false;
|
||||||
secureCompare.bind(null, expectedSignature)
|
for (const secret of secrets) {
|
||||||
).length > 0;
|
const expectedSignature = computeSignature(req.body, details.timestamp, secret);
|
||||||
|
signatureFound = details.signatures.filter(
|
||||||
|
secureCompare.bind(null, expectedSignature)
|
||||||
|
).length > 0;
|
||||||
|
if (signatureFound) break;
|
||||||
|
}
|
||||||
if (!signatureFound) {
|
if (!signatureFound) {
|
||||||
throw new Error('No matching signatures found');
|
throw new Error('No matching signatures found');
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jambonz/node-client",
|
"name": "@jambonz/node-client",
|
||||||
"version": "0.2.4",
|
"version": "0.2.5",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user