Route by Zip Code

I’m planning a migration from our legacy PBX to Asterisk. I’m really interested in routing customers based on their zip code.

For example:
“Press 1 for Sales”
“Please enter your zip code so you can be routed to the sales rep for your area”

I’m a pretty experienced PHP/MySQL programmer. Are there currently any modules/extensions for Asterisk that do something like this? If not–where would one begin to program such a thing?


No need for PHP/MySQL. This should be quite easy with dial plan applications and AstDB. e.g.,

exten => s,1,Background(Press-1-for-Sales)
exten => 1,1,Read(ZIP,enter-your-zip-code-then-press-#,5)
exten => 1,n,Dial(SIP/${DB(sales/${ZIP})})

AstDB is a collection of hash tables stored as Berkeley DB. The application you described doesn’t really require relations afforded by MySQL. You’ll have to populate the sales ‘family’ in AstDB, of course. There are lots of fine tuning you can do. Not the least is to replace the last line to

And use only the first 3 digits in ZIP code as keys in AstDB. (I don’t assume you really have that many sales offices :smile: )

This illustrates how Asterisk makes seemingly complicated tasks extremely easy.