Bugfix/mem leak (#29)

* wait for 200 OK to BYE before closing connection to drachtio

* minor logging
This commit is contained in:
Dave Horton
2022-03-27 21:50:09 -04:00
committed by GitHub
parent 0af8bcc348
commit f1e2f192b7

View File

@@ -248,12 +248,13 @@ class CallSession extends Emitter {
this.uas = uas;
this.uac = uac;
[uas, uac].forEach((dlg) => {
dlg.on('destroy', () => {
dlg.on('destroy', async() => {
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'));
other.destroy().catch((e) => {});
try {
await other.destroy();
} catch (err) {}
this.unsubscribeDTMF(this.logger, this.req.get('Call-ID'), this.rtpEngineOpts.uas.tag);
if (process.env.JAMBONES_HOSTING) {
this.decrKey(this.callCountKey)
@@ -281,6 +282,8 @@ class CallSession extends Emitter {
other.removeAllListeners();
dlg.other = null;
other.other = null;
this.logger.info(`call ended with normal termination, there are ${this.activeCallIds.size} active`);
this.srf.endSession(this.req);
});
});