Pre-dial handlers allow you to execute a dialplan subroutine on a channel before a call is placed but after the application performing a dial action is invoked. This means that the handlers are executed after the creation of the caller/callee channels, but before any actions have been taken to actually dial the callee channels. You can execute a dialplan subroutine on the caller channel and on each callee channel dialed.
There are two ways in which a pre-dial handler can be invoked:
The 'B' option in an application executes a dialplan subroutine on the caller channel before any callee channels are created.
The 'b' option in an application executes a dialplan subroutine on each callee channel after it is created but before the call is placed to the end-device.
Pre-dial handlers are supported in the Dial application and the FollowMe application.
As pre-dial handlers are implemented using Gosub subroutines, they must be terminated with a call to Return.
Taking actions in pre-dial handlers that would put the caller/callee channels into other applications will result in undefined behaviour. Pre-dial handlers should be short routines that do not impact the state that the dialing application assumes the channel will be in.
For Dial or FollowMe, handlers are invoked using similar nomenclature as other options (such as M or U in Dial) that cause some portion of the dialplan to execute.