de-link Dialogs so they can be GC'ed at call end

This commit is contained in:
Dave Horton
2022-03-27 19:43:39 -04:00
parent 2dadde64f4
commit e067125974

View File

@@ -249,10 +249,11 @@ class CallSession extends Emitter {
this.uac = uac;
[uas, uac].forEach((dlg) => {
dlg.on('destroy', () => {
const other = dlg.other;
this.logger.info('call ended with normal termination');
this.rtpEngineResource.destroy().catch((err) => {});
this.activeCallIds.delete(this.req.get('Call-ID'));
dlg.other.destroy().catch((e) => {});
other.destroy().catch((e) => {});
this.unsubscribeDTMF(this.logger, this.req.get('Call-ID'), this.rtpEngineOpts.uas.tag);
if (process.env.JAMBONES_HOSTING) {
this.decrKey(this.callCountKey)
@@ -275,6 +276,9 @@ class CallSession extends Emitter {
trunk
}).catch((err) => this.logger.error({err}, 'Error writing cdr for completed call'));
}
/* de-link the 2 Dialogs for GC */
dlg.other = null;
other.other = null;
this.srf.endSession(this.req);
});
});