mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-14 10:19:07 +00:00
Compare commits
7 Commits
v0.9.6-rc2
...
fix/406
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a4cb11dff | ||
|
|
4fcc8d23f0 | ||
|
|
b5efb7351b | ||
|
|
ad57931222 | ||
|
|
702948715d | ||
|
|
7e3911d786 | ||
|
|
4119864a35 |
@@ -145,6 +145,9 @@ class CallInfo {
|
|||||||
|
|
||||||
if (this._customerData) {
|
if (this._customerData) {
|
||||||
Object.assign(obj, {customerData: this._customerData});
|
Object.assign(obj, {customerData: this._customerData});
|
||||||
|
// Duplicate customer data here to respect API contract that was created by bug
|
||||||
|
//https://github.com/jambonz/jambonz-feature-server/issues/406
|
||||||
|
Object.assign(obj, {customerdata: this._customerData});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JAMBONES_API_BASE_URL) {
|
if (JAMBONES_API_BASE_URL) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class TaskRestDial extends Task {
|
|||||||
const b3 = this.getTracingPropagation();
|
const b3 = this.getTracingPropagation();
|
||||||
const httpHeaders = b3 && {b3};
|
const httpHeaders = b3 && {b3};
|
||||||
const params = {
|
const params = {
|
||||||
...cs.callInfo,
|
...cs.callInfo.toJSON(),
|
||||||
defaults: {
|
defaults: {
|
||||||
synthesizer: {
|
synthesizer: {
|
||||||
vendor: cs.speechSynthesisVendor,
|
vendor: cs.speechSynthesisVendor,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class HttpRequestor extends BaseRequestor {
|
|||||||
|
|
||||||
assert(HookMsgTypes.includes(type));
|
assert(HookMsgTypes.includes(type));
|
||||||
|
|
||||||
const payload = params ? snakeCaseKeys(params, ['customerData', 'sip']) : null;
|
const payload = params ? snakeCaseKeys(params, ['customerdata', 'customerData', 'sip']) : null;
|
||||||
const url = hook.url || hook;
|
const url = hook.url || hook;
|
||||||
const method = hook.method || 'POST';
|
const method = hook.method || 'POST';
|
||||||
let buf = '';
|
let buf = '';
|
||||||
|
|||||||
@@ -80,6 +80,19 @@ test('test create-call call-hook basic authentication', async(t) => {
|
|||||||
"username": "username",
|
"username": "username",
|
||||||
"password": "password"
|
"password": "password"
|
||||||
},
|
},
|
||||||
|
"call_status_hook": {
|
||||||
|
"url": "http://127.0.0.1:3100/callStatus",
|
||||||
|
"method": "POST"
|
||||||
|
},
|
||||||
|
"tag": {
|
||||||
|
"callCount": 10,
|
||||||
|
"env": "DEVELOPMENT",
|
||||||
|
"processId": "processId",
|
||||||
|
"Customer": "Customer",
|
||||||
|
"Vehicle": "Vehicle",
|
||||||
|
"Event_Camel": "Event_Camel",
|
||||||
|
"CamelCase": "CamelCase"
|
||||||
|
},
|
||||||
"from": from,
|
"from": from,
|
||||||
"to": {
|
"to": {
|
||||||
"type": "phone",
|
"type": "phone",
|
||||||
@@ -96,9 +109,19 @@ test('test create-call call-hook basic authentication', async(t) => {
|
|||||||
//THEN
|
//THEN
|
||||||
await p;
|
await p;
|
||||||
|
|
||||||
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}`)
|
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}`);
|
||||||
t.ok(obj.headers.Authorization = 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=',
|
t.ok(obj.headers.Authorization = 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=',
|
||||||
'create-call: call-hook contains basic authentication header');
|
'create-call: call-hook contains basic authentication header');
|
||||||
|
t.ok(obj.body.customerdata.callCount === 10,
|
||||||
|
'create-call: call-hook contains correct format for customerData');
|
||||||
|
t.ok(obj.body.customerData.callCount === 10,
|
||||||
|
'create-call: call-hook contains correct format for customerData');
|
||||||
|
|
||||||
|
obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}_callStatus`);
|
||||||
|
t.ok(obj.body.customerdata.callCount === 10,
|
||||||
|
'create-call: status-hook contains correct format for customerData');
|
||||||
|
t.ok(obj.body.customerData.callCount === 10,
|
||||||
|
'create-call: status-hook contains correct format for customerData');
|
||||||
disconnect();
|
disconnect();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`error received: ${err}`);
|
console.log(`error received: ${err}`);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ const test = require('tape');
|
|||||||
const { sippUac } = require('./sipp')('test_fs');
|
const { sippUac } = require('./sipp')('test_fs');
|
||||||
const clearModule = require('clear-module');
|
const clearModule = require('clear-module');
|
||||||
const {provisionCallHook} = require('./utils')
|
const {provisionCallHook} = require('./utils')
|
||||||
|
const bent = require('bent');
|
||||||
|
const getJSON = bent('json')
|
||||||
|
|
||||||
process.on('unhandledRejection', (reason, p) => {
|
process.on('unhandledRejection', (reason, p) => {
|
||||||
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||||
@@ -27,6 +29,18 @@ test('\'say\' tests', async(t) => {
|
|||||||
{
|
{
|
||||||
verb: 'say',
|
verb: 'say',
|
||||||
text: 'hello'
|
text: 'hello'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: "tag",
|
||||||
|
data: {
|
||||||
|
callCount: 10,
|
||||||
|
env: "DEVELOPMENT",
|
||||||
|
processId: "processId",
|
||||||
|
Customer: "Customer",
|
||||||
|
Vehicle: "Vehicle",
|
||||||
|
Event_Camel: "Event_Camel",
|
||||||
|
CamelCase: "CamelCase"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -36,6 +50,12 @@ test('\'say\' tests', async(t) => {
|
|||||||
// THEN
|
// THEN
|
||||||
await sippUac('uac-success-received-bye.xml', '172.38.0.10', from);
|
await sippUac('uac-success-received-bye.xml', '172.38.0.10', from);
|
||||||
t.pass('say: succeeds when using using account credentials');
|
t.pass('say: succeeds when using using account credentials');
|
||||||
|
let obj = await getJSON(`http:127.0.0.1:3100/lastRequest/${from}_callStatus`);
|
||||||
|
console.log(obj);
|
||||||
|
t.ok(obj.body.customerdata.callCount === 10,
|
||||||
|
'create-call: status-hook contains correct format for customerData');
|
||||||
|
t.ok(obj.body.customerData.callCount === 10,
|
||||||
|
'create-call: status-hook contains correct format for customerData');
|
||||||
disconnect();
|
disconnect();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`error received: ${err}`);
|
console.log(`error received: ${err}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user