mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 09:08:02 +00:00
fix customerdata should not be snakeCase
This commit is contained in:
@@ -144,7 +144,7 @@ class CallInfo {
|
|||||||
if (typeof this.duration === 'number') obj.duration = this.duration;
|
if (typeof this.duration === 'number') obj.duration = this.duration;
|
||||||
|
|
||||||
if (this._customerData) {
|
if (this._customerData) {
|
||||||
Object.assign(obj, {customerData: this._customerData});
|
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, ['sip']) : null;
|
const payload = params ? snakeCaseKeys(params, ['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 = '';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
"bugs": {},
|
"bugs": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app",
|
"start": "node app",
|
||||||
"test": "NODE_ENV=test JAMBONES_HOSTING=1 HTTP_POOL=1 JAMBONES_TTS_TRIM_SILENCE=1 ENCRYPTION_SECRET=foobar DRACHTIO_HOST=127.0.0.1 DRACHTIO_PORT=9060 DRACHTIO_SECRET=cymru JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=127.0.0.1 JAMBONES_REDIS_PORT=16379 JAMBONES_LOGLEVEL=error ENABLE_METRICS=0 HTTP_PORT=3000 JAMBONES_SBCS=172.38.0.10 JAMBONES_FREESWITCH=127.0.0.1:8022:JambonzR0ck$:docker-host JAMBONES_TIME_SERIES_HOST=127.0.0.1 JAMBONES_NETWORK_CIDR=172.38.0.0/16 node test/ ",
|
"test": "NODE_ENV=test JAMBONES_HOSTING=1 HTTP_POOL=1 JAMBONES_TTS_TRIM_SILENCE=1 ENCRYPTION_SECRET=foobar DRACHTIO_HOST=127.0.0.1 DRACHTIO_PORT=9060 DRACHTIO_SECRET=cymru JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=127.0.0.1 JAMBONES_REDIS_PORT=16379 JAMBONES_LOGLEVEL=debug ENABLE_METRICS=0 HTTP_PORT=3000 JAMBONES_SBCS=172.38.0.10 JAMBONES_FREESWITCH=127.0.0.1:8022:JambonzR0ck$:docker-host JAMBONES_TIME_SERIES_HOST=127.0.0.1 JAMBONES_NETWORK_CIDR=172.38.0.0/16 node test/ ",
|
||||||
"coverage": "./node_modules/.bin/nyc --reporter html --report-dir ./coverage npm run test",
|
"coverage": "./node_modules/.bin/nyc --reporter html --report-dir ./coverage npm run test",
|
||||||
"jslint": "eslint app.js tracer.js lib",
|
"jslint": "eslint app.js tracer.js lib",
|
||||||
"jslint:fix": "eslint app.js tracer.js lib --fix"
|
"jslint:fix": "eslint app.js tracer.js lib --fix"
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ 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": {
|
"tag": {
|
||||||
"callCount": 10,
|
"callCount": 10,
|
||||||
"env": "DEVELOPMENT",
|
"env": "DEVELOPMENT",
|
||||||
@@ -106,10 +110,13 @@ test('test create-call call-hook basic authentication', async(t) => {
|
|||||||
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}`);
|
||||||
console.log(obj);
|
|
||||||
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,
|
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: call-hook contains correct format for customerData');
|
'create-call: call-hook contains correct format for customerData');
|
||||||
disconnect();
|
disconnect();
|
||||||
} catch (err) {
|
} catch (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,10 @@ 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: call-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