fix hangup headers (#583)

* fix hangup headers

* no need for callback

* fix test failure

---------

Co-authored-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
Hoan Luu Huu
2023-12-29 02:59:59 +07:00
committed by GitHub
parent 2c48083c26
commit 15829139c1
4 changed files with 59 additions and 5 deletions

View File

@@ -1883,7 +1883,7 @@ Duration=${duration} `
wrapDialog(dlg) {
dlg.connectTime = moment();
const origDestroy = dlg.destroy.bind(dlg);
dlg.destroy = () => {
dlg.destroy = (opts) => {
if (dlg.connected) {
dlg.connected = false;
dlg.destroy = origDestroy;
@@ -1892,7 +1892,7 @@ Duration=${duration} `
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
this.logger.debug('CallSession: call terminated by jambonz');
this.rootSpan.setAttributes({'call.termination': 'hangup by jambonz'});
origDestroy().catch((err) => this.logger.info({err}, 'CallSession - error destroying dialog'));
origDestroy(opts).catch((err) => this.logger.info({err}, 'CallSession - error destroying dialog'));
if (this.wakeupResolver) {
this.wakeupResolver({reason: 'session ended'});
this.wakeupResolver = null;