mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
fixes from testing pause/resume recording
This commit is contained in:
@@ -264,19 +264,23 @@ class CallSession extends Emitter {
|
||||
|
||||
/* check validity of request */
|
||||
if (action == 'startCallRecording' && this.recordState !== RecordState.RecordingOff) {
|
||||
this.logger.info('CallSession:notifyRecordOptions: recording is already started, ignoring request');
|
||||
this.logger.info({recordState: this.recordState},
|
||||
'CallSession:notifyRecordOptions: recording is already started, ignoring request');
|
||||
return false;
|
||||
}
|
||||
if (action == 'stopCallRecording' && this.recordState === RecordState.RecordingOff) {
|
||||
this.logger.info('CallSession:notifyRecordOptions: recording is already stopped, ignoring request');
|
||||
this.logger.info({recordState: this.recordState},
|
||||
'CallSession:notifyRecordOptions: recording is already stopped, ignoring request');
|
||||
return false;
|
||||
}
|
||||
if (action == 'pauseCallRecording' && this.recordState !== RecordState.RecordingOn) {
|
||||
this.logger.info('CallSession:notifyRecordOptions: cannot pause recording, ignoring request ');
|
||||
this.logger.info({recordState: this.recordState},
|
||||
'CallSession:notifyRecordOptions: cannot pause recording, ignoring request ');
|
||||
return false;
|
||||
}
|
||||
if (action == 'resumeCallRecording' && this.recordState !== RecordState.RecordingPaused) {
|
||||
this.logger.info('CallSession:notifyRecordOptions: cannot resume recording, ignoring request ');
|
||||
this.logger.info({recordState: this.recordState},
|
||||
'CallSession:notifyRecordOptions: cannot resume recording, ignoring request ');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -285,11 +289,11 @@ class CallSession extends Emitter {
|
||||
switch (action) {
|
||||
case 'startCallRecording':
|
||||
return await this.startRecording();
|
||||
case 'stopRecording':
|
||||
case 'stopCallRecording':
|
||||
return await this.stopRecording();
|
||||
case 'pauseRecording':
|
||||
case 'pauseCallRecording':
|
||||
return await this.pauseRecording();
|
||||
case 'resumeRecording':
|
||||
case 'resumeCallRecording':
|
||||
return await this.resumeRecording();
|
||||
default:
|
||||
throw new Error(`invalid record action ${action}`);
|
||||
@@ -312,7 +316,10 @@ class CallSession extends Emitter {
|
||||
'X-Application-Sid': this.applicationSid,
|
||||
}
|
||||
});
|
||||
if (res.status === 200) return true;
|
||||
if (res.status === 200) {
|
||||
this._recordState = RecordState.RecordingOn;
|
||||
return true;
|
||||
}
|
||||
this.logger.info(`CallSession:startRecording - ${res.status} failure sending to ${siprecServerURL}`);
|
||||
return false;
|
||||
} catch (err) {
|
||||
@@ -331,7 +338,10 @@ class CallSession extends Emitter {
|
||||
'X-Reason': 'stopCallRecording',
|
||||
}
|
||||
});
|
||||
if (res.status === 200) return true;
|
||||
if (res.status === 200) {
|
||||
this._recordState = RecordState.RecordingOff;
|
||||
return true;
|
||||
}
|
||||
this.logger.info(`CallSession:stopRecording - ${res.status} failure`);
|
||||
return false;
|
||||
} catch (err) {
|
||||
@@ -350,7 +360,10 @@ class CallSession extends Emitter {
|
||||
'X-Reason': 'pauseCallRecording',
|
||||
}
|
||||
});
|
||||
if (res.status === 200) return true;
|
||||
if (res.status === 200) {
|
||||
this._recordState = RecordState.RecordingPaused;
|
||||
return true;
|
||||
}
|
||||
this.logger.info(`CallSession:pauseRecording - ${res.status} failure`);
|
||||
return false;
|
||||
} catch (err) {
|
||||
@@ -369,7 +382,10 @@ class CallSession extends Emitter {
|
||||
'X-Reason': 'resumeCallRecording',
|
||||
}
|
||||
});
|
||||
if (res.status === 200) return true;
|
||||
if (res.status === 200) {
|
||||
this._recordState = RecordState.RecordingOn;
|
||||
return true;
|
||||
}
|
||||
this.logger.info(`CallSession:resumeRecording - ${res.status} failure`);
|
||||
return false;
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user