mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +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;
|
||||
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();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +48,7 @@ class RestCallSession extends CallSession {
|
||||
_callerHungup() {
|
||||
const duration = moment().diff(this.dlg.connectTime, 'seconds');
|
||||
this.emit('callStatusChange', {callStatus: CallStatus.Completed, duration});
|
||||
this.logger.debug('InboundCallSession: caller hung up');
|
||||
this.logger.debug('RestCallSession: called party hung up');
|
||||
this._callReleased();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user