mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-01-25 02:08:24 +00:00
support filtering for retrieve info endpoint (#153)
* support filtering for retrieve info endpoint * bump realtimedb-helpers
This commit is contained in:
@@ -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) => {});
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user