address general case of sending completed status when we hangup the call

This commit is contained in:
Dave Horton
2020-03-09 21:55:41 +00:00
parent d82e2254ab
commit 017b3a66a8
3 changed files with 20 additions and 10 deletions

View File

@@ -31,15 +31,7 @@ class RestCallSession extends CallSession {
setDialog(dlg) {
this.dlg = dlg;
dlg.on('destroy', this._callerHungup.bind(this));
dlg.connectTime = moment();
const origDestroy = dlg.destroy.bind(dlg);
dlg.destroy = () => {
const duration = moment().diff(this.dlg.connectTime, 'seconds');
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
this.logger.debug('RestCallSession: call terminated by jambones');
origDestroy();
};
this.wrapDialog(dlg);
}
/**