Skip to content

Commit

Permalink
Merge branch 'main' into feat/cloud_version
Browse files Browse the repository at this point in the history
  • Loading branch information
xquanluu authored Jul 27, 2023
2 parents 233a430 + 8e20025 commit e4e8cc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 33 deletions.
12 changes: 4 additions & 8 deletions lib/logger.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const opts = Object.assign({
timestamp: () => {
return `, "time": "${new Date().toISOString()}"`;
}
}, {
const opts = {
level: process.env.JAMBONES_LOGLEVEL || 'info'
});

const logger = require('pino')(opts);
};
const pino = require('pino');
const logger = pino(opts, pino.destination(1, {sync: false}));

module.exports = logger;
36 changes: 11 additions & 25 deletions test/recent-calls.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,29 @@ test('recent calls tests', async(t) => {
auth: authUser,
json: true,
});
console.log(JSON.stringify(result));
t.ok(result.data.length === 5, 'retrieved 5 recent calls by account');

result = await request.get(`/Accounts/${account_sid}/RecentCalls?page=1&count=25&filter=16`, {
auth: authUser,
json: true,
});
t.ok(result.data.length === 0, 'retrieved 5 recent calls by account and from');

result = await request.get(`/Accounts/${account_sid}/RecentCalls?page=1&count=25&filter=15`, {
result = await request.get(`/Accounts/${account_sid}/RecentCalls?page=1&count=25&filter=1508`, {
auth: authUser,
json: true,
});
console.log(JSON.stringify(result));
t.ok(result.data.length === 5, 'retrieved 5 recent calls by account and from');

result = await request.get(`/Accounts/${account_sid}/RecentCalls?page=1&count=25&filter=19`, {
result = await request.get(`/Accounts/${account_sid}/RecentCalls?page=1&count=25&filter=15080`, {
auth: authUser,
json: true,
});
t.ok(result.data.length === 0, 'retrieved 5 recent calls by account and to');
console.log(JSON.stringify(result));
t.ok(result.data.length === 0, 'retrieved 0 recent calls by account and non-matching from');

result = await request.get(`/Accounts/${account_sid}/RecentCalls?page=1&count=25&filter=18`, {
result = await request.get(`/Accounts/${account_sid}/RecentCalls?page=1&count=25&filter=1888`, {
auth: authUser,
json: true,
});
console.log(JSON.stringify(result));
t.ok(result.data.length === 5, 'retrieved 5 recent calls by account and to');
//console.log({data: result.data}, 'Account recent calls');

/* query last 7 days by service provider */
result = await request.get(`/ServiceProviders/${service_provider_sid}/RecentCalls?page=1&count=25`, {
Expand All @@ -109,29 +106,18 @@ test('recent calls tests', async(t) => {
});
t.ok(result.data.length === 5, 'retrieved 5 recent calls by service provider');

result = await request.get(`/ServiceProviders/${service_provider_sid}/RecentCalls?page=1&count=25&filter=16`, {
auth: authAdmin,
json: true,
});
t.ok(result.data.length === 0, 'retrieved 5 recent calls by service provider and from');

result = await request.get(`/ServiceProviders/${service_provider_sid}/RecentCalls?page=1&count=25&filter=15`, {
result = await request.get(`/ServiceProviders/${service_provider_sid}/RecentCalls?page=1&count=25&filter=1508`, {
auth: authAdmin,
json: true,
});
t.ok(result.data.length === 5, 'retrieved 5 recent calls by service provider and from');

result = await request.get(`/ServiceProviders/${service_provider_sid}/RecentCalls?page=1&count=25&filter=19`, {
auth: authAdmin,
json: true,
});
t.ok(result.data.length === 0, 'retrieved 5 recent calls by service provider and to');

result = await request.get(`/ServiceProviders/${service_provider_sid}/RecentCalls?page=1&count=25&filter=18`, {
result = await request.get(`/ServiceProviders/${service_provider_sid}/RecentCalls?page=1&count=25&filter=1888`, {
auth: authAdmin,
json: true,
});
t.ok(result.data.length === 5, 'retrieved 5 recent calls by service provider and to');

//console.log({data: result.data}, 'SP recent calls');

/* pull sip traces and pcap from homer */
Expand Down

0 comments on commit e4e8cc2

Please sign in to comment.