Skip to content

Commit

Permalink
Merge branch 'main' into feat/opus_pcmu_transcode
Browse files Browse the repository at this point in the history
  • Loading branch information
xquanluu authored Nov 13, 2024
2 parents d5d0d5f + 41528db commit f538d85
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
16 changes: 10 additions & 6 deletions lib/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,16 @@ class CallSession extends Emitter {

if (process.env.JAMBONES_HOSTING || trackingOn) {
const {writeCallCount, writeCallCountSP, writeCallCountApp} = this.req.srf.locals;
await nudgeCallCounts(this.logger, {
service_provider_sid: this.service_provider_sid,
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'));
if (!this.req.locals.callCountNudged) {
this.req.locals.callCountNudged = true;
this.logger.debug('decrementing call count at end of call');
await nudgeCallCounts(this.logger, {
service_provider_sid: this.service_provider_sid,
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 */
Expand Down
4 changes: 3 additions & 1 deletion lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ module.exports = (srf, logger, redisClient) => {
try {
/* decrement count if INVITE is later rejected */
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, {
service_provider_sid,
account_sid,
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-testbed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
ipv4_address: 172.39.0.2

sbc:
image: drachtio/drachtio-server:latest
image: drachtio/drachtio-server:0.8.26
command: drachtio --contact "sip:*;transport=udp" --loglevel debug --sofia-loglevel 9
ports:
- "9060:9022/tcp"
Expand Down

0 comments on commit f538d85

Please sign in to comment.