From 9b3be6c0b9a1adc3b8cddaccf7cf6589e5d6609b Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Wed, 6 Mar 2024 06:01:32 +0700 Subject: [PATCH] allow custom header on pause, resume recording (#670) * allow custom header on pause, resume recording * fix review comments --- lib/session/call-session.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/session/call-session.js b/lib/session/call-session.js index 38a8cc5d..788b55a7 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -622,8 +622,10 @@ class CallSession extends Emitter { const res = await this.dlg.request({ method: 'INFO', headers: { - 'X-Reason': 'pauseCallRecording' - } + 'X-Reason': 'pauseCallRecording', + ...(this.recordOptions.headers && {'Content-Type': 'application/json'}) + }, + ...(this.recordOptions.headers && {body: JSON.stringify(this.recordOptions.headers) + '\n'}) }); if (res.status === 200) { this._recordState = RecordState.RecordingPaused; @@ -644,8 +646,10 @@ class CallSession extends Emitter { const res = await this.dlg.request({ method: 'INFO', headers: { - 'X-Reason': 'resumeCallRecording' - } + 'X-Reason': 'resumeCallRecording', + ...(this.recordOptions.headers && {'Content-Type': 'application/json'}) + }, + ...(this.recordOptions.headers && {body: JSON.stringify(this.recordOptions.headers) + '\n'}) }); if (res.status === 200) { this._recordState = RecordState.RecordingOn;