mirror of
https://github.com/jambonz/sbc-outbound.git
synced 2025-12-19 04:27:45 +00:00
* fix call count race condition #151 * logging fix
This commit is contained in:
@@ -677,12 +677,16 @@ class CallSession extends Emitter {
|
|||||||
|
|
||||||
if (process.env.JAMBONES_HOSTING || trackingOn) {
|
if (process.env.JAMBONES_HOSTING || trackingOn) {
|
||||||
const {writeCallCount, writeCallCountSP, writeCallCountApp} = this.req.srf.locals;
|
const {writeCallCount, writeCallCountSP, writeCallCountApp} = this.req.srf.locals;
|
||||||
await nudgeCallCounts(this.logger, {
|
if (!this.req.locals.callCountNudged) {
|
||||||
service_provider_sid: this.service_provider_sid,
|
this.req.locals.callCountNudged = true;
|
||||||
account_sid: this.account_sid,
|
this.logger.debug('decrementing call count at end of call');
|
||||||
application_sid: this.application_sid
|
await nudgeCallCounts(this.logger, {
|
||||||
}, this.decrKey, {writeCallCountSP, writeCallCount, writeCallCountApp})
|
service_provider_sid: this.service_provider_sid,
|
||||||
.catch((err) => this.logger.error(err, 'Error decrementing call counts'));
|
account_sid: this.account_sid,
|
||||||
|
application_sid: this.application_sid
|
||||||
|
}, this.decrKey, {writeCallCountSP, writeCallCount, writeCallCountApp})
|
||||||
|
.catch((err) => this.logger.error(err, 'Error decrementing call counts'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write cdr for connected call */
|
/* write cdr for connected call */
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ module.exports = (srf, logger, redisClient) => {
|
|||||||
try {
|
try {
|
||||||
/* decrement count if INVITE is later rejected */
|
/* decrement count if INVITE is later rejected */
|
||||||
res.once('end', async({status}) => {
|
res.once('end', async({status}) => {
|
||||||
if (status > 200) {
|
if (status > 200 && !req.locals.callCountNudged) {
|
||||||
|
req.locals.callCountNudged = true;
|
||||||
|
logger.debug('decrementing call count due to call rejection');
|
||||||
nudgeCallCounts(logger, {
|
nudgeCallCounts(logger, {
|
||||||
service_provider_sid,
|
service_provider_sid,
|
||||||
account_sid,
|
account_sid,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ services:
|
|||||||
ipv4_address: 172.39.0.2
|
ipv4_address: 172.39.0.2
|
||||||
|
|
||||||
sbc:
|
sbc:
|
||||||
image: drachtio/drachtio-server:latest
|
image: drachtio/drachtio-server:0.8.26
|
||||||
command: drachtio --contact "sip:*;transport=udp" --loglevel debug --sofia-loglevel 9
|
command: drachtio --contact "sip:*;transport=udp" --loglevel debug --sofia-loglevel 9
|
||||||
ports:
|
ports:
|
||||||
- "9060:9022/tcp"
|
- "9060:9022/tcp"
|
||||||
|
|||||||
Reference in New Issue
Block a user