support filtering for retrieve info endpoint (#153)

* support filtering for retrieve info endpoint

* bump realtimedb-helpers
This commit is contained in:
Anton Voylenko
2023-04-19 14:33:24 +03:00
committed by GitHub
parent 5b1b50c3a3
commit af3d03bef9
4 changed files with 53 additions and 10 deletions
+8 -2
View File
@@ -737,11 +737,17 @@ router.post('/:sid/Calls', async(req, res) => {
*/
router.get('/:sid/Calls', async(req, res) => {
const {logger, listCalls} = req.app.locals;
const {direction, from, to, callStatus} = req.query || {};
try {
const accountSid = parseAccountSid(req);
await validateRequest(req, accountSid);
const calls = await listCalls(accountSid);
const calls = await listCalls({
accountSid,
direction,
from,
to,
callStatus
});
logger.debug(`retrieved ${calls.length} calls for account sid ${accountSid}`);
res.status(200).json(coerceNumbers(snakeCase(calls)));
updateLastUsed(logger, accountSid, req).catch((err) => {});
+37
View File
@@ -3793,6 +3793,43 @@ paths:
required: true
schema:
type: string
- in: query
name: direction
required: false
schema:
type: string
enum:
- inbound
- outbound
description: call direction to retrieve
- in: query
name: from
required: false
schema:
type: string
description: calling number to retrieve
- in: query
name: to
required: false
schema:
type: string
description: called number to retrieve
- in: query
name: callStatus
required: false
schema:
type: string
enum:
- trying
- ringing
- early-media
- in-progress
- completed
- failed
- busy
- no-answer
- queued
description: call status to retrieve
responses:
200:
description: list of calls for a specified account
+7 -7
View File
@@ -13,7 +13,7 @@
"@deepgram/sdk": "^1.10.2",
"@google-cloud/speech": "^5.1.0",
"@jambonz/db-helpers": "^0.7.3",
"@jambonz/realtimedb-helpers": "^0.7.0",
"@jambonz/realtimedb-helpers": "^0.7.1",
"@jambonz/speech-utils": "^0.0.8",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.3",
@@ -1710,9 +1710,9 @@
}
},
"node_modules/@jambonz/realtimedb-helpers": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.7.0.tgz",
"integrity": "sha512-hu+CcV0jzQU6J4vW8bBEz52NqEroLHOB0wjVb/VmSL4N0+MAJ1wbPUNk8go5aMk809Vr/Od2z9nHInGnTiBHzA==",
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.7.1.tgz",
"integrity": "sha512-eL4bJG/b/CN7tuxWcmsHjbSEtcDzBIBw3Wzg8+mL6sXHl0bmCLhPu4xdRBkf+UFu3dPCzaRxBQfyGCB3z6aCXw==",
"dependencies": {
"@jambonz/promisify-redis": "^0.0.6",
"debug": "^4.3.4",
@@ -10224,9 +10224,9 @@
}
},
"@jambonz/realtimedb-helpers": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.7.0.tgz",
"integrity": "sha512-hu+CcV0jzQU6J4vW8bBEz52NqEroLHOB0wjVb/VmSL4N0+MAJ1wbPUNk8go5aMk809Vr/Od2z9nHInGnTiBHzA==",
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.7.1.tgz",
"integrity": "sha512-eL4bJG/b/CN7tuxWcmsHjbSEtcDzBIBw3Wzg8+mL6sXHl0bmCLhPu4xdRBkf+UFu3dPCzaRxBQfyGCB3z6aCXw==",
"requires": {
"@jambonz/promisify-redis": "^0.0.6",
"debug": "^4.3.4",
+1 -1
View File
@@ -23,7 +23,7 @@
"@deepgram/sdk": "^1.10.2",
"@google-cloud/speech": "^5.1.0",
"@jambonz/db-helpers": "^0.7.3",
"@jambonz/realtimedb-helpers": "^0.7.0",
"@jambonz/realtimedb-helpers": "^0.7.1",
"@jambonz/speech-utils": "^0.0.8",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.3",