Compare commits

...

7 Commits

Author SHA1 Message Date
Quan HL
8fb5bb6848 fix failing testcase 2023-05-07 19:07:00 +07:00
Quan HL
2d7d84436a fix failing testcase 2023-05-07 17:33:29 +07:00
Quan HL
e99260acd0 fix failing testcase 2023-05-07 17:32:25 +07:00
Quan HL
522469ca89 fix failing testcase 2023-05-07 17:25:13 +07:00
Quan HL
4f486b2c0a fix type 2023-05-07 09:49:24 +07:00
Quan HL
906db6e340 fix: update verb specification version 2023-05-07 09:40:52 +07:00
Quan HL
252ad2d07f feat: add metadata to create call as tag 2023-05-07 06:59:35 +07:00
4 changed files with 32 additions and 13 deletions

View File

@@ -193,7 +193,7 @@ router.post('/', async(req, res) => {
direction: CallDirection.Outbound,
req: inviteReq,
to,
tag: app.tag,
tag: {...req.body.metadata, ...app.tag},
callSid,
accountSid: req.body.account_sid,
applicationSid: app.application_sid,

14
package-lock.json generated
View File

@@ -15,7 +15,7 @@
"@jambonz/speech-utils": "^0.0.12",
"@jambonz/stats-collector": "^0.1.8",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.17",
"@jambonz/verb-specifications": "^0.0.18",
"@opentelemetry/api": "^1.4.0",
"@opentelemetry/exporter-jaeger": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.35.0",
@@ -1664,9 +1664,9 @@
}
},
"node_modules/@jambonz/verb-specifications": {
"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==",
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.18.tgz",
"integrity": "sha512-/yIxd3qdFVCNiTnyGm/r0sChDHptDEt2oIJlcAcFuDFbh2xttQYCVeQ75B3d/FhLHlfB82xskmP6lolEAm9gNg==",
"dependencies": {
"debug": "^4.3.4",
"pino": "^8.8.0"
@@ -10011,9 +10011,9 @@
}
},
"@jambonz/verb-specifications": {
"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==",
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.18.tgz",
"integrity": "sha512-/yIxd3qdFVCNiTnyGm/r0sChDHptDEt2oIJlcAcFuDFbh2xttQYCVeQ75B3d/FhLHlfB82xskmP6lolEAm9gNg==",
"requires": {
"debug": "^4.3.4",
"pino": "^8.8.0"

View File

@@ -31,7 +31,7 @@
"@jambonz/speech-utils": "^0.0.12",
"@jambonz/stats-collector": "^0.1.8",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.17",
"@jambonz/verb-specifications": "^0.0.18",
"@opentelemetry/api": "^1.4.0",
"@opentelemetry/exporter-jaeger": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.35.0",

View File

@@ -80,10 +80,18 @@ test('test create-call call-hook basic authentication', async(t) => {
"username": "username",
"password": "password"
},
call_status_hook: {
url: "http://127.0.0.1:3100/callStatus",
method: "POST",
},
"from": from,
"to": {
"type": "phone",
"number": "15583084809"
},
metadata: {
customer: "acme",
referenceId: "deadbeef"
}});
let verbs = [
@@ -96,13 +104,24 @@ test('test create-call call-hook basic authentication', async(t) => {
//THEN
await p;
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}`)
t.ok(obj.headers.Authorization = 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=',
'create-call: call-hook contains basic authentication header');
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}`);
t.ok(
obj.headers.Authorization === "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
"create-call: call-hook contains basic authentication header"
);
t.ok(
obj.body.customerdata.customer === "acme",
"create-call: metadata is working"
);
obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}_callStatus`);
t.ok(
obj.body.customerData.customer === "acme",
"create-call: metadata is working"
);
disconnect();
} catch (err) {
console.log(`error received: ${err}`);
disconnect();
t.error(err);
}
});
});