* fix #655

* fix race condition
This commit is contained in:
Dave Horton
2024-02-22 07:46:53 -05:00
committed by GitHub
parent c2ae42a456
commit 51a379998f
3 changed files with 25 additions and 16 deletions

View File

@@ -67,6 +67,10 @@ class InboundCallSession extends CallSession {
* This is invoked when the caller hangs up, in order to calculate the call duration.
*/
_callerHungup() {
if (this.dlg === null) {
this.logger.info('InboundCallSession:_callerHungup - race condition, dlg cleared by app hangup');
return;
}
assert(this.dlg.connectTime);
const duration = moment().diff(this.dlg.connectTime, 'seconds');
this.rootSpan.setAttributes({'call.termination': 'hangup by caller'});