Cascade dialplan for dialing emergency engineers as quick as possible

At the moment I’m trying to make the following solution with FreePBX:

There is an incoming call and we want to transfer this call to an available engineer. The system tries to call engineer1 on his cellphone (follow me with call confirmation). This engineer is give 20 sec. to answer the call. The system must ring Engineer2 earlier than the 20 sec. timeout of Engineer1 (for example 15 sec. after the incoming call). Engineer2 is given also 20 sec. to answer. Engineer3 is called earlier than the 20 sec. timeout of Engineer2 and so on.

How can I arrange this?

I can’t think of a way to do this. The ring strategies available to you for a queue are either ring all at once or one at a time.

Indeed, but maybe I can make a custom dialplan that will ring the engineers at the same time but with a delay?

An idea (not tested):

Create an Outbound Route that imposes a delay before calling the target number. For example (assuming North America), dialing 0001232125551234 would wait 123 seconds then call 2125551234. The Outbound Route itself would have a prefix of 000XXX and a match pattern of “X.” (without the quotes). You would then use a hook that for dialed numbers beginning with 000XXX, delays XXX seconds before exiting.

Then, set up your Ring Group to simultaneously dial the list of on-call people with appropriate staggered delays.

This simple scheme would ring each party for the remainder of the period (some calls would end up in mobile voicemail). If that is undesirable, configure a special trunk that aborts the dial after e.g. 25 seconds.

1 Like

You can do this with custom dialplan, using Local channels… it’s not pretty, but here’s the basic idea. Let’s say you want to call extension 301, then after 20 seconds, try calling extension 302 as well. Create two new extensions (401 and 402 in this example).

exten => 401,1,Dial(PJSIP/301&Local/[email protected],60)
exten => 402,1,Wait(20)
exten => 402,n,Dial(PJSIP/302,40)

Calling 401 rings PJSIP/301 and Local/[email protected], where Local/[email protected] simply waits 20 seconds before starting to ring PJSIP/302.

1 Like

Building on the excellent ideas presented already, you could create a feature code you can prefix extension numbers with that inserts the delay. Add this to extensions_custom.conf:

exten => _**XXX*XXXX,1,Noop(Entering user defined context from-internal-custom in extensions_custom.conf)
exten => _**XXX*XXXX,n,Noop(ext: ${EXTEN:-4} delay: ${EXTEN:2:3})
exten => _**XXX*XXXX,n,Wait(${EXTEN:2:3})
exten => _**XXX*XXXX,n,goto(from-internal,${EXTEN:-4},1)

If you want to dial extension 5002 with a leading 10 second delay, you would dial **010*5002

-- Executing [**010*[email protected]:1] NoOp("SIP/5002-00000004", "Entering user defined context from-internal-custom in extensions_custom.conf") in new stack
-- Executing [**010*[email protected]:2] NoOp("SIP/5002-00000004", "ext: 5002 delay: 010") in new stack
-- Executing [**010*[email protected]:3] Wait("SIP/5002-00000004", "010") in new stack
-- Executing [**010*[email protected]:4] Goto("SIP/5002-00000004", "from-internal,5002,1") in new stack


Now add the above dial string to your queues instead of a plain ext number. Delay must be 3 digits exactly in seconds, extension number must be 4 exactly. Edit to suit.

edit - Thinking further, you probably need a line to block local extension VM from picking up the call. Should prob have a line like this before the goto:

 exten => _**XXX*XXXX,n,Macro(blkvm-setifempty,)
1 Like

Thank you very much!

1 Like

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