Chasing Staff with Trixbox

A popular request by Trixbox users is for a hunt group that calls extensions and external lines.

Trixbox provides a confirm option which prevents voice mail and answering machines from stopping the hunt process - unfortunately it only works with the ringall strategy not a hunt strategy.

This blog post describes how to implement a custom dial rule that provides a hunt group with confirm.
The first set of tasks for creating a custom dial plan in Trixbox (FreePBX) is to add:
  • A custom destination
  • A custom extension
These are configured under the PBX > PBX Settings > Tools Menu. In this example I will use extension 66 and the custom destination chase-staff. The only tricky part of this is specifying the custom destination. The specification must include the destination name, the extension and a priority.

Eg: chase-staff,66,1

The custom extension is created to prevent Trixbox (FreePBX) using the extension by accident.

The final step is to create the dial plan in the extensions_custom.conf file:

[from-internal-custom]
include => chase-mcr

;...

[chase-staff]
exten => 66,1,Set(CALLERID(all)=?Stafff? <0399999999>)
exten => 66,n,Dial(Local/4001&Local/4002,30)
exten => 66,n,Dial(IAX2/gw/0419999999,20,rM(ackcall^s^1))
exten => 66,n,Dial(IAX2/gw/0419999998,20,rM(ackcall^s^1))
exten => 66,n,Voicemail(4000,u)

[macro-ackcall]

exten => s,1,Wait(0.5)
exten => s,n,Background(followme/no-recording)
exten => s,n,Background(followme/options)
exten => s,n,WaitExten(5)
exten => s,n,Set(MACRO_RESULT=CONTINUE)

exten => 1,1,NoOp()

exten => 2,1,Set(MACRO_RESULT=CONTINUE)

exten => i,1,Set(MACRO_RESULT=CONTINUE)

How it works


The script rings the local extensions 4001 and 4002 for 30 seconds simultaneously. If there is no answer it falls through to the next line and calls the mobile number 0419999999 via the gateway IAX2/gw. This dial command invokes a macro when the mobile connects a message is played to the recipient. If the recipient presses 1 then the calls are connected and the process stops (Confusingly returning from the macro without a return status of CONTINUE connects the calls). Otherwise the next number is called, finally the caller is connected to a voicemail box.

References


This concept was based on an idea in chapter 2 of the Asterisk Cookbook by  Leif Madsen, Russell Bryant and published by O’Reilly Media Inc. The idea required significant modification to get it to work on Asterisk 1.4.