Replicating Call Routing in FreePBX as is current Mitel Intelligent Router

Hello, Currently we have a Mitel 5000, MiVoice Office 250 phone system. We have setup FreePBX , a few new SIP trunks for testing and a few Yealink phones.

We are now attempting to replicate in the FreePBX system, abilities and processes in use with the Mitel system. Currently we utilize the Mitel Intelligent Router application to route incoming calls, based upon the incoming caller-id value. Each evening, our SAP system generates a .csv file which contains two columns, a list of caller-id values and an extension number. If the caller-id value of an incoming call is found in this table, the call is automatically routed to the associated extension number.

Without any commercial modules, what is the best mechanism within FreePBX to replicate this functionality (i.e. Dynamic Routes, Bulk Handler, Inbound Routes or Extensions)?

The Dynamic Routes module allows you to provide this type of service. That module is free to download and use. This thread can be helpful: Using Dynamic Routes for Call Flow Control

Depending on the number of extensions, this might work well with Dynamic Routes. If you’re talking dozens of extensions, it would be more efficient to just use custom dialplan.

There’s another wrinkle tho. I’ve considered this use case in the past, where you attempt to anticipate who the caller wants to talk to, so you first route the call to a specific extension instead of bothering reception or making them nav an IVR. But IMO, you have to structure the call flow with the assumption that your guess is wrong and ensure the caller ends up somewhere useful on no-answer instead of a voicemail box for someone they’re not even looking for. If doing this myself, I would have a call flow like this:

Inbound route → specific extension based on query → on no answer go to normal reception

This can’t easily be done with Dynroutes, but there’s a snippet here that might get you started with custom dialplan

Just tossing out a concept here to see what you think: What if a spreadsheet is copied to the FreePBX server and a batch file runs periodically which creates a MySQL database and imports the spreadsheet? Then a quick MySQL dip into that database to route the call?

I guess it depends on how many records we’re talking about. A modestly busy system keeping track of CIDs could have many thousands of records, and in that case creating an SQL table to query would prob be worth the effort. That same effort put into an API of some sort on the SAP system so the PBX could just do a quick http query would be better.

The API would be a good choice, assuming the SAP system is always available (and not sluggish.) I generally prefer to have a local file which is not dependent on the remote server availability.

@Sharpy you can see there are likely many ways to accomplish your requirement. That is the beauty of FreePBX and Asterisk in that it gives you the flexibility to do just about anything a proprietary system can do either with custom dial plan code or with some of the GUI features available.

I neglected to mention this .csv file has 29,000 rows/records. So a Dialplan querying a local MySQL DB sounds like the solution. I don’t think we want to rely on a connection back to the SAP server via API for every incoming call.

Perhaps consider using asterisk’s sqlite3 ā€˜astdb’ built in database, my experience is it is much lower impact compared to a mysql query at about that size database.

The OP wants to bulk replace the table’s contents every day. I’ve not heard of people bulk loading AstDB.

He only needs the deltas and can apply those changes as

rasterisk -x "database put <family> <key> <value>"

or

rasterisk -x "database query \"update astdb set value='....' WHERE key='....\'"

On a i3 NUC about 15 secs per 1000 records , if you want you can stop asterisk, import directly into astdb.sqlite3; restart asterisk

Our ā€œin houseā€ developer has determined that using the API to write to the ā€œIncoming Routesā€ table to be the solution.

I don’t want to sound too negative here but let’s hope your SAP is not overloaded or down very often. I’ve worked with SAP systems (or the underlying database machines) that were dog slow during peak times. Be sure to build in a failover on the PBX if a lookup via API is not possible or fails. If calls quit coming in due to SAP issues, have documentation to protect yourself so if the ā€œHow could this happen? We’re not getting calls!ā€ is falling on you, you’ve got your derriĆØre covered. Usually, IT guys aren’t telecom guys and don’t always understand that telecom outages are not tolerated very well by executive management.

I raised the point concerning relying on the SAP server’s responsiveness. He indicated it will come from a local source on the FreePBX VM, which he will update on a regular basis programmatically .

I don’t know the mechanics of the application. I’m the network guy setting up FreePBX and the VM, he is doing the programming.

I was concerned that his approach wasn’t one of those suggested here. Neither of us have any experience with FreePBX and are attempting to replace the on prem Mitel phone system with a FreePBX solution. We have acquired some phones and alternate SIP trunks for establishing a ā€œtestā€ system that we have up and running.

Using an API to dip into a local file on the PBX itself should work just fine as it will not be interactively dependent on SAP.