When I started using Voice over IP technology, I acquired a wholesale DID from Unlimitel for an extremely reasonable monthly cost. Shortly thereafter I created an Asterisk-friendly version of the dialplan information they provided and made it available for download. It was a very simplistic set of Dial() statements, one per areacode-exchange combination. This resulted in a large number of statements and as Unlimitel’s on-net service area grew, so did it. It also meant that it was easy for my dialplan to be out of date as new exchanges were added. If you wanted to do anything before the Dial() statement you had to either create another context with a pattern that caught what you wanted to do and then went to your outbound Unlimitel context or you had to take my dialplan and insert new statements.
Way too much work and also way too many statements.
I had thought about writing a small Perl program to parse the dialplan information and collapse it to match with broader patterns, but never found the time. And when I had the time, I really didn’t feel like it because, frankly, things were working for me so I didn’t feel like changing it.
When I upgraded my blog a few months ago, I dropped the dialplan from my website during the migration. I hadn’t updated it in months and I knew that Unlimitel had made whole sale changes. A reader looking for my dialplan asked me if I would put it back up.
Recently, I overhauled my dialplans and made things more efficient with macros rather than explicit Dial() statements for every combination of areacode and exchange. For various reasons, I use a couple of different providers to provide outbound paths. Since most of my calls are local, I first try to send the call out via Unlimitel. If Unlimitel doesn’t handle the destination, I then try to send it out via Link2Voip.
The result is that I have eliminated most of the lines being loaded while eliminating the need to maintain an unwieldy dialplan.
Here’s how I did it…