allow custom header on pause, resume recording (#670)

* allow custom header on pause, resume recording

* fix review comments
This commit is contained in:
Hoan Luu Huu
2024-03-06 06:01:32 +07:00
committed by GitHub
parent 4ae661daea
commit 9b3be6c0b9

View File

@@ -622,8 +622,10 @@ class CallSession extends Emitter {
const res = await this.dlg.request({ const res = await this.dlg.request({
method: 'INFO', method: 'INFO',
headers: { 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) { if (res.status === 200) {
this._recordState = RecordState.RecordingPaused; this._recordState = RecordState.RecordingPaused;
@@ -644,8 +646,10 @@ class CallSession extends Emitter {
const res = await this.dlg.request({ const res = await this.dlg.request({
method: 'INFO', method: 'INFO',
headers: { 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) { if (res.status === 200) {
this._recordState = RecordState.RecordingOn; this._recordState = RecordState.RecordingOn;