Who was I talking to? New sample dialplan for boomerang


(Lorne Gaetz) #1

Dreary day here today. I got some yard work done before the drizzle started, but now I need a rainy Saturday project. I am calling this boomerang, but need a better name I think.

From time to time we get queries in the forum here asking for some way to automatically route an inbound call to the last person they were speaking with. Until yesterday, my thinking was that a sufficiently complex SQL query to figure out the extension from CDR/CEL database, would be the only way to make that happen. But what if instead of using the CDR/CEL database, we keep track of the extension/CID vales independently in a simple format. Here is a pretty rough proof of concept: https://gist.github.com/lgaetz/e7dbbcd6004559c5b467a146a8b14cfc

What it does at the moment:

  • Inbound and outbound calls get a hangup handler added to the channel
  • when the channel terminates, the hangup handler attempts to figure out the trunk PSTN number and the most recent extension they were talking to, and writes it to the ASTDB as
    boomerang/<PSTN CID> = <Extension Number>

With the above in place, you could route an inbound call to a Dynamic Route and query the astdb using the Asterisk Variable option with

${DB(boomerang/${CALLERID(number):-10})}

The returned result will either be null or an extension number. You can then branch the call based on the result.

I’ve built in some assumptions for 10 digit NANP number format and it’s a bit rough at the moment. I think this would be most useful if the inbound call first rings the looked up extension for a short while before going to a reception destination. There is no elegant way to do that at the moment, which gives me an idea for another project, a dynamic ring group. Works the same as a conventional ring group except you pass the extensions to ring as a variable instead of pre-defining them in the GUI.


Customize Inbound Calls
#2


(Lorne Gaetz) #3

Nice. I’m tempted, except for the inevitable cease and desist that would follow.


#4

just call it “re-call”


#5

This would be great to have on FreePBX.

I’ve always heard this referred to as “Last Agent Routing”.

In two different system brands I use they have this ability in their ACD suites and it’s set on the queue level. Each queue has an option to turn last agent routing on or off and how far the calls look back for the last agent so if it’s the same day (or whatever timeframe is set) then it will look for the last agent that number had. If it is not within the predetermined timeline then the call proceeds to route to the next available agent as of that number had never called into the system.

I’ve used this feature on those other systems a couple of times, both also in conjunction with a call routing database that looks to see if the caller ID is a VIP caller based on the phone numbers from their CRM, if it’s a VIP they go to the VIP queue, the last agent routing time is set to look back two weeks. Because the VIPs for the organizations using this call so often, they almost always get the same agent.


(Lorne Gaetz) closed #6

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.