race condition: dial call killed just as called party picks up

This commit is contained in:
Dave Horton
2021-08-10 11:00:47 -04:00
parent 48fbbd48ad
commit 649b3d5715

View File

@@ -181,6 +181,15 @@ class SingleDialer extends Emitter {
this.logger.debug(`SingleDialer:exec call connected: ${this.callSid}`); this.logger.debug(`SingleDialer:exec call connected: ${this.callSid}`);
const connectTime = this.dlg.connectTime = moment(); const connectTime = this.dlg.connectTime = moment();
/* race condition: we were killed just as call was answered */
if (this.killed) {
this.logger.info(`SingleDialer:exec race condition - we were killed as call connected: ${this.callSid}`);
const duration = moment().diff(connectTime, 'seconds');
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
if (this.ep) this.ep.destroy();
return;
}
this.dlg this.dlg
.on('destroy', () => { .on('destroy', () => {
const duration = moment().diff(connectTime, 'seconds'); const duration = moment().diff(connectTime, 'seconds');