Recording update (#229)

* new hasRecording flag on call info for setting recording URL in cdr

* lint

* use nullish coalescing for null response
This commit is contained in:
Sam Machin
2026-01-02 15:29:00 +00:00
committed by GitHub
parent 876cb393f9
commit 3f0fd794ce
2 changed files with 6 additions and 1 deletions

2
app.js
View File

@@ -70,6 +70,7 @@ const {
addKey,
deleteKey,
retrieveKey,
retrieveHash,
createSet,
retrieveSet,
addToSet,
@@ -117,6 +118,7 @@ srf.locals = {...srf.locals,
addKey,
deleteKey,
retrieveKey,
retrieveHash,
createSet,
incrKey,
decrKey,

View File

@@ -66,6 +66,7 @@ class CallSession extends Emitter {
this.decrKey = req.srf.locals.realtimeDbHelpers.decrKey;
this.addKey = req.srf.locals.realtimeDbHelpers.addKey;
this.retrieveKey = req.srf.locals.realtimeDbHelpers.retrieveKey;
this.retrieveHash = req.srf.locals.realtimeDbHelpers.retrieveHash;
this._mediaPath = MediaPath.FullMedia;
@@ -491,7 +492,9 @@ class CallSession extends Emitter {
this.req.locals.carrier :
this.req.locals.originator;
const application = await this.srf.locals.getApplicationBySid(application_sid);
const isRecording = this.req.locals.account.record_all_calls || (application && application.record_all_calls);
const {hasRecording} = await this.retrieveHash(`call:${this.account_sid}:${call_sid}`) ?? {};
const isRecording = this.req.locals.account.record_all_calls ||
(application && application.record_all_calls) || hasRecording;
const day = new Date();
let recording_url = `/Accounts/${this.account_sid}/RecentCalls/${call_sid}/record`;
recording_url += `/${day.getFullYear()}/${(day.getMonth() + 1).toString().padStart(2, '0')}`;