POSSA / freepbx-trunk-balancing

Restrict outbound calls or balance calls over multiple trunks based on user specified parameters
http://pbxossa.org/files/trunkbalance/
37 stars 30 forks source link

REQUEST: Trunk Balancing based on URL results #21

Closed trymes closed 9 years ago

trymes commented 9 years ago

My apologies for being brief, but I am typing with one hand due to an injury,

Anyhow, as suggested in this thread: http://community.freepbx.org/t/wireless-carrier-lookup/25468 , I am filing a request to be able to balance/choose trunks based on URL results.While this would allow other things, my interest is in allowing a user to route calls to a mobile gateway based on carrier results from Data24-7's Carrier24-7 service (or similar), which would allow us to take advantage of free mobile-to-mobile minutes in our plan.

Please let me know if any more information is required, and my apologies again for brevity.

Many thanks,

Tom

lgaetz commented 9 years ago

@trymes, This is the current way Trunk Balancing works:

  1. A user creates a virtual balanced trunk for a single normal trunk already set on the system
  2. the user creates a number of conditions that must match before the call goes thru the normal trunk. If the conditions are not satisfied, the trunk rejects the call.
  3. In an outbound route the user configures multiple balanced trunks in whatever priority desired, the outbound call steps thru each balanced trunk in order until the conditions are satisfied for one of the trunks and the call proceeds. If every trunk rejects the call then it fails.

So knowing the above, I assume this project will still work for you. The module logic is not "look up this URL and choose from a list of trunks based on the result". The logic is "look up this URL and choose whether to proceed with this one specific trunk." which would be done repeatedly for each trunk.

In order to make a feature that would be usable to as wide a user base as possible, I am thinking that the module will load the contents of a URL and then allow users to define one or more regex's. If any regex matches, the conditions are satisfied and the call proceeds. In order to be usable the URL (and maybe the regex too) will have to accept asterisk channel variables such as the outbound number.

Also note that there are no active devs for this module at the moment and I work on things in my spare time only as my mood strikes. I may jump on this in a week or I may never do this. I will post any progress to this ticket so you will get notified provided you are watching it. I also will provide whatever guidance I can to anyone who wishes to code it themselves provided the results are contributed back.

trymes commented 9 years ago

@lgaetz, that sounds like it would do the trick for my needs. Basically, I presume one would need to parse the carrier from the response from Carrier24-7 (see: http://www.data24-7.com/solutions.php) and then configure trunk 'A' to only be used if carrier="Verizon Wireless", and then add trunk 'B' after that to handle all other calls and function as failover if the CDMA gateway is unavailable or all channels are in use.

lgaetz commented 9 years ago

@trymes

First attempt can be downloaded from here: https://github.com/POSSA/freepbx-trunk-balancing/raw/working/trunkbalance-1.3.3.tgz

I have tested on two 2.11 servers, and it appears to be working.