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:


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()

Related Posts

  • 74
    Dialplan Introduction:  
    Tags: dialplan, asterisk
  • 44
    What is Asterisk? Asterisk is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server. Asterisk powers IP PBX systems, VoIP gateways, conference servers and other custom solutions. It is used by small businesses, large businesses, call centers, carriers and government agencies, worldwide.…
    Tags: asterisk
  • 40
    Dial() is perhaps the most important application in Asterisk. Dial() accepts every valid channel type (e.g. SIP, IAX2, H.323, MGCP, Local, Zap, Dahdi), The allowable parameters are channel-specific; i.e., what parameters a channel requires or will accept depends on the nature of the channel technology. For example, a SIP channel will require an IP address…
    Tags: call, channel, dial, caller, asterisk, exten, allow
  • 36
    SIP Configuration - general The [general] section of sip.conf includes the following variables: allowsubscribe = yes|no : Allow or Ignore Subscribe requests allow = <codec> : Allow codecs in order of preference (Use DISALLOW=ALL first, before allowing other codecs) disallow = all : Disallow all codecs (global configuration) Asterisk sip allowexternaldomains = yes|no :…
    Tags: default, asterisk, allow
  • 35
    Contexts Dialplans are broken into sections called contexts. Contexts are named groups of extensions, which serve several purposes. 1. Contexts keep different parts of the dialplan from interacting with one another. 2. An extension that is defined in one context is completely isolated from extensions in any other context, unless interaction is specifically…
    Tags: dialplan, asterisk

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: