-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: main
Are you sure you want to change the base?
Conversation
…le random trunk selection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this would reject the call even in the case where no carrier exists in the dial verb target (what you intended) but also in the case where there is an outbound calling set of rules created to determine the outbound carrier. That doesn't seem right
I've adjusted based on your feedback @davehorton |
lib/call-session.js
Outdated
@@ -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}`); |
There was a problem hiding this comment.
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
lib/call-session.js
Outdated
@@ -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}`); | |||
if (!voip_carrier_sid) { | |||
if(process.env.JAMBONES_OUTDIAL_TRUNK_FAILOVER==='false') { |
There was a problem hiding this comment.
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.
…le random trunk selection
Changed the way outbound trunk selection is done by checking for environment variable (default undefined) and to reject the call if no valid trunk is given on the Dial verb.
This is done to prevent the system choosing a random trunk.