mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-10-18 17:34:21 +00:00
prevent calling dlg.destroy twice
This commit is contained in:
1 parent
ff8b6c6b18
commit
7581eca524
1 file changed
+8
-4
@@ -543,10 +543,14 @@ class CallSession extends Emitter {
|
||||
dlg.connectTime = moment();
|
||||
const origDestroy = dlg.destroy.bind(dlg);
|
||||
dlg.destroy = () => {
|
||||
const duration = moment().diff(this.dlg.connectTime, 'seconds');
|
||||
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
|
||||
this.logger.debug('CallSession: call terminated by jambones');
|
||||
if (dlg.connected) origDestroy();
|
||||
if (dlg.connected) {
|
||||
dlg.connected = false;
|
||||
dlg.destroy = 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