Added a environment variable JAMBONES_OUTDIAL_TRUNK_FAILOVER to disab…#108
Added a environment variable JAMBONES_OUTDIAL_TRUNK_FAILOVER to disab…#108Megamuch wants to merge 2 commits intojambonz:mainfrom
Conversation
…le random trunk selection
davehorton
left a comment
There was a problem hiding this comment.
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 |
| /* 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.
this info log was used for debugging and can be removed
| 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.
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.