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

Conversation

Megamuch
Copy link

…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.

Copy link
Collaborator

@davehorton davehorton left a 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

@Megamuch
Copy link
Author

I've adjusted based on your feedback @davehorton
I've moved the failure to the "random trunk selection" part to prevent that from happening.
All the other logic is unchanged.

@@ -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

@@ -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') {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants