• Default Trunk Route
    Choose the primary call handler
  • SQL Query
    Designate the query and Asterisk dialpan vars
  • Custom Destination
    Select your destination by types of matching parameters
  • Database Settings
    Track calls within a database

SmartRoutes

SmartRoutes is a module that allows you to control inbound call routing based on external database values.

Using SmartRoutes you can route incoming calls to the appropriate queue (skills based routing), you can automatically route calls from one trunk to another (sip->tdm gateway), you can set variables in the dial plan (like cdr, caller id name, etc), strip unnecessary caller-id and did prefixes from inbound calls, and much more based on the caller id, did called or other asterisk call values.

 

Download Latest

 

We’re using this on multiple Asterisk installs for various functions. In one case we’re using it to create a simple type of SBC or SIP->TDM gateway that receives SIP calls from various vendors and looks up the DID in our CRM database to figure out if the call should be routed out one of the TDM trunks to one of the Enhanced Services Platforms or down the MPLS (SIP) to our live call center (another Asterisk server). If the MPLS fails then the call is routed out over TDM to arrive at the call center via PSTN trunks.

In each of the call centers using this module, it will lookup the customer account based on DID and determine the “Priority” of that customer and route to the appropriate queue. At the same time it pulls the account number and assigns to the CDR(userfield) and sets the account name as the caller id prefix.

The module supports both MySQL and ODBC database access. MySQL is pre-installed with AsteriskNOW and is easy to use but unfortunately it is unreliable and causes asterisk restarts in our 1.4 and 1.6 versions. ODBC support is preferable and the module will auto-manage the func_odbc.conf entries.

Additionally there is support for a feature to reset the FROM_DID and the callerid(num) to strip unnecessary prefixes. Some SIP providers pad those numbers with prefixes that might be incompatible if the call is switched back out through another SIP provider (or to an Enhanced Services Platform).

Full support for standard inbound route features (including fax) is included.

This module has been tested with FreePBX 2.7 and 2.8 / Asterisk 1.4.26 and 1.6.2.7

Notes:

  • MySQL support appears to be installed in your Asterisk
  • ODBC support appears to be installed in your asterisk
  • Asterisk is more reliable using MySQL through ODBC than through the integrated MySQL commands. High volume platforms may experience Asterisk restarts when using native MySQL within Asterisk.
  • To access multiple databases, or for more advanced call routing you can have smartroutes that route to other smartroutes. Setting the variables in the dialplan will allow database lookup values to persist from one Smartroute to the next.
  • This module will set the FROM_DID variable in the catch-all section for inbound routes.
  • This module works best in FreePBX 2.8 or higher (destinations are condensed to a combobox). For FreePBX versions before 2.8, use custom destinations to route calls out a trunk but note that failover destinations won’t work.
  • If you don’t have your own database of telephone numbers to use for routing, the “Customer DB Module” in the FreePBX extended repository could work very well with SmartRoutes. The Account field would be a good one to use for routing classification. If you install that module, use the following settings:host: localhost
    database: asterisk
    table: customerdb
    search column: did
    return column: account
  • Asterisk is more reliable using MySQL through ODBC than through the integrated MySQL commands. High volume platforms may experience Asterisk restarts.
  • To access multiple databases, or for more advanced call routing and filtering you can have smartroutes that route to other smartroutes. Setting the variables in the dialplan will allow database lookup values to persist from one Smartroute to the next.

 

For documentation, tips, hints, and applications, visit help.

Submit a bug report at bugs.