mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
send callStatus completed event when REST call is ended with BYE generated from jambonz (#4)
This commit is contained in:
@@ -32,6 +32,14 @@ class RestCallSession extends CallSession {
|
|||||||
this.dlg = dlg;
|
this.dlg = dlg;
|
||||||
dlg.on('destroy', this._callerHungup.bind(this));
|
dlg.on('destroy', this._callerHungup.bind(this));
|
||||||
dlg.connectTime = moment();
|
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();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +48,7 @@ class RestCallSession extends CallSession {
|
|||||||
_callerHungup() {
|
_callerHungup() {
|
||||||
const duration = moment().diff(this.dlg.connectTime, 'seconds');
|
const duration = moment().diff(this.dlg.connectTime, 'seconds');
|
||||||
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
|
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
|
||||||
this.logger.debug('InboundCallSession: caller hung up');
|
this.logger.debug('RestCallSession: called party hung up');
|
||||||
this._callReleased();
|
this._callReleased();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user