mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
prevent calling dlg.destroy twice
This commit is contained in:
@@ -567,10 +567,14 @@ class CallSession extends Emitter {
|
|||||||
dlg.connectTime = moment();
|
dlg.connectTime = moment();
|
||||||
const origDestroy = dlg.destroy.bind(dlg);
|
const origDestroy = dlg.destroy.bind(dlg);
|
||||||
dlg.destroy = () => {
|
dlg.destroy = () => {
|
||||||
const duration = moment().diff(this.dlg.connectTime, 'seconds');
|
if (dlg.connected) {
|
||||||
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
|
dlg.connected = false;
|
||||||
this.logger.debug('CallSession: call terminated by jambones');
|
dlg.destroy = origDestroy;
|
||||||
if (dlg.connected) origDestroy();
|
const duration = moment().diff(this.dlg.connectTime, 'seconds');
|
||||||
|
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
|
||||||
|
this.logger.debug('CallSession: call terminated by jambones');
|
||||||
|
origDestroy();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user