Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a environment variable JAMBONES_OUTDIAL_TRUNK_FAILOVER to disab… #108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ class CallSession extends Emitter {
/* was a specific carrier requested */
let voip_carrier_sid = this.req.get('X-Requested-Carrier-Sid');
const account_sid = this.req.get('X-Account-Sid');
this.logger.info(`carrier requested ${voip_carrier_sid}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this info log was used for debugging and can be removed

if (!voip_carrier_sid) {
if(process.env.JAMBONES_OUTDIAL_TRUNK_FAILOVER==='false') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of returning a 603 response when the JAMBONES_OUTDIAL_TRUNK_FAILOVER env variable is false. You might want to invert the if and follow the default behaviour if JAMBONES_OUTDIAL_TRUNK_FAILOVER is undefined or true. This way if the variable is set to false it will just skip the lookupOutboundCarrierForAccount method and continue to the next step which will return the 603 response.

this.logger.info(`no outbound carriers found for account_sid ${account_sid}`);
this.res.send(603);
return this.srf.endSession(this.req);
}
}
if (!voip_carrier_sid && account_sid) {
/* search for an LCR table for this account or service provider */
voip_carrier_sid = await this.lookupCarrierByAccountLcr(account_sid, this.req.calledNumber);
Expand All @@ -247,7 +255,7 @@ class CallSession extends Emitter {
}
if (!voip_carrier_sid) {
/* no LCR/ inbound carrier for this account/SP - at this point its a random shuffle of outbound carriers */
voip_carrier_sid = await this.lookupOutboundCarrierForAccount(this.account_sid);
voip_carrier_sid = await this.lookupOutboundCarrierForAccount(this.account_sid);
}
if (!voip_carrier_sid) {
/* no outbound carriers exist for this account/SP */
Expand Down