Asterisk Subroutine Call : Pre-Dial Handlers

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 dialled.

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.

Uses of pre Dial handler:

[default]

exten => s,1,NoOp()
same => n,Dial(SIP/bar,,B(default^caller_handler^1))
same => n,Hangup()
exten => caller_handler,1,NoOp()
same => n,Verbose(0, In caller pre-dial handler!)
same => n,Return()

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

22 thoughts on “Asterisk Subroutine Call : Pre-Dial Handlers

Leave a Reply