mirror of
https://github.com/jambonz/sbc-outbound.git
synced 2026-07-04 19:32:04 +00:00
decrement count on abandoned call (#228)
fix typo so correct error message is logged
This commit is contained in:
+15
-1
@@ -665,7 +665,21 @@ class CallSession extends Emitter {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if ('abandonded' !== err.message) this.logger.error({err}, `Error setting up outbound call to: ${uris}`);
|
||||
if ('abandoned' !== err.message) this.logger.error({err}, `Error setting up outbound call to: ${uris}`);
|
||||
|
||||
/* the call count was incremented on 'init' but we bailed out before connecting (e.g. caller
|
||||
hung up before the B leg answered), so we must decrement it here - no failure response is
|
||||
sent on this path, so the res.once('end') safety net in middleware would not fire.
|
||||
nudgeCallCounts is a no-op if the count was already decremented elsewhere. */
|
||||
const {writeCallCount, writeCallCountSP, writeCallCountApp} = this.req.srf.locals;
|
||||
nudgeCallCounts(this.req, 'failure', {
|
||||
service_provider_sid: this.service_provider_sid,
|
||||
account_sid: this.account_sid,
|
||||
application_sid: this.application_sid,
|
||||
callId: this.req.locals.callId
|
||||
}, this.decrKey, {writeCallCountSP, writeCallCount, writeCallCountApp})
|
||||
.catch((err) => this.logger.error(err, 'Error decrementing call counts'));
|
||||
|
||||
this.emit('failed');
|
||||
this.srf.endSession(this.req);
|
||||
this.rtpEngineResource.destroy();
|
||||
|
||||
Reference in New Issue
Block a user