mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-07-23 12:32:06 +00:00
recent-calls single call record pull
This commit is contained in:
@@ -165,6 +165,31 @@ router.get('/:call_sid/record/:year/:month/:day/:format', async(req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/call/:call_sid', async(req, res) => {
|
||||
const { account_sid, call_sid } = req.params;
|
||||
const { logger, queryCdrs } = req.app.locals;
|
||||
|
||||
try {
|
||||
logger.debug('GET /call/:call_sid');
|
||||
const account_sid = parseAccountSid(req.originalUrl);
|
||||
const data = await queryCdrs({
|
||||
account_sid,
|
||||
filter: call_sid,
|
||||
page: 1,
|
||||
page_size: 1
|
||||
});
|
||||
|
||||
if (!data || data.data.length === 0) {
|
||||
return res.status(404).json({ message: 'Call not found' });
|
||||
}
|
||||
|
||||
res.status(200).json(data.data[0]);
|
||||
} catch (err) {
|
||||
logger.error({ err }, `Error retrieving call information for account_sid: ${account_sid}, call_sid: ${call_sid}`);
|
||||
res.sendStatus(500);
|
||||
}
|
||||
});
|
||||
|
||||
router.delete('/:call_sid/record/:year/:month/:day/:format', async(req, res) => {
|
||||
const {logger} = req.app.locals;
|
||||
const {call_sid, year, month, day, format} = req.params;
|
||||
|
||||
Reference in New Issue
Block a user