Feat/complete adult call (#563)

* feat client direct call from registration webhook (#562)

* feat client direct call from registration webhook

* feat client direct call from registration webhook

* wip

* fix cannot lcc complete adult call

* wip

* wip
This commit is contained in:
Hoan Luu Huu
2023-12-11 20:37:01 +07:00
committed by GitHub
parent 230fe9ea11
commit 353a9c1917

View File

@@ -1,4 +1,6 @@
const CallSession = require('./call-session');
const {CallStatus} = require('../utils/constants');
const moment = require('moment');
/**
* @classdesc Subclass of CallSession. Represents a CallSession
@@ -26,6 +28,7 @@ class AdultingCallSession extends CallSession {
this._callReleased();
});
this.sd.emit('adulting');
this.on('callStatusChange', this._notifyCallStatusChange.bind(this));
}
get dlg() {
@@ -50,6 +53,18 @@ class AdultingCallSession extends CallSession {
}
_callerHungup() {
if (this.dlg.connectTime) {
const duration = moment().diff(this.dlg.connectTime, 'seconds');
this.rootSpan.setAttributes({'call.termination': 'hangup by caller'});
this.callInfo.callTerminationBy = 'caller';
this.emit('callStatusChange', {
callStatus: CallStatus.Completed,
duration
});
}
this.logger.info('InboundCallSession: caller hung up');
this._callReleased();
this.req.removeAllListeners('cancel');
}
}