mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
execute status callback async (#394)
* execute status callback async * fix review comment * revert fix review comment
This commit is contained in:
@@ -1781,6 +1781,15 @@ class CallSession extends Emitter {
|
|||||||
|
|
||||||
this.callInfo.updateCallStatus(callStatus, sipStatus, sipReason);
|
this.callInfo.updateCallStatus(callStatus, sipStatus, sipReason);
|
||||||
if (typeof duration === 'number') this.callInfo.duration = duration;
|
if (typeof duration === 'number') this.callInfo.duration = duration;
|
||||||
|
this.executeStatusCallback(callStatus, sipStatus);
|
||||||
|
|
||||||
|
// update calls db
|
||||||
|
//this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
|
||||||
|
this.updateCallStatus(Object.assign({}, this.callInfo.toJSON()), this.serviceUrl)
|
||||||
|
.catch((err) => this.logger.error(err, 'redis error'));
|
||||||
|
}
|
||||||
|
|
||||||
|
async executeStatusCallback(callStatus, sipStatus) {
|
||||||
const {span} = this.rootSpan.startChildSpan(`call-status:${this.callInfo.callStatus}`);
|
const {span} = this.rootSpan.startChildSpan(`call-status:${this.callInfo.callStatus}`);
|
||||||
span.setAttributes(this.callInfo.toJSON());
|
span.setAttributes(this.callInfo.toJSON());
|
||||||
try {
|
try {
|
||||||
@@ -1792,11 +1801,6 @@ class CallSession extends Emitter {
|
|||||||
span.end();
|
span.end();
|
||||||
this.logger.info(err, `CallSession:_notifyCallStatusChange error sending ${callStatus} ${sipStatus}`);
|
this.logger.info(err, `CallSession:_notifyCallStatusChange error sending ${callStatus} ${sipStatus}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update calls db
|
|
||||||
//this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
|
|
||||||
this.updateCallStatus(Object.assign({}, this.callInfo.toJSON()), this.serviceUrl)
|
|
||||||
.catch((err) => this.logger.error(err, 'redis error'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async enableRecordAllCall() {
|
async enableRecordAllCall() {
|
||||||
|
|||||||
Reference in New Issue
Block a user