diff --git a/app.js b/app.js index ef28d5f..9d40f9b 100644 --- a/app.js +++ b/app.js @@ -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, diff --git a/lib/call-session.js b/lib/call-session.js index 8516d51..589b967 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -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')}`;