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

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

  1. An outstanding share! I have just forwarded this onto a co-worker
    who was doing a little homework on this. And he actually bought me dinner because I stumbled upon it for him…

    lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanx for spending the time to talk about this topic
    here on your site.

  2. I’ve been browsing on-line greater than three hours today, yet I never discovered
    any attention-grabbing article like yours.
    It’s beautiful value enough for me. Personally, if all website owners
    and bloggers made excellent content material
    as you probably did, the web might be a lot
    more helpful than ever before.

Leave a Comment