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

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
  • 36
    ChannelRedirect : This is used to redirect the given channel to target dialplan. For example if you want to redirect the channel SIP/1222-09992 to wrap context at 2 priority. You can use this function/command to do so. This has been added in Asterisk 1.4 version. For Asterisk 1.4 version ChannelRedirect(channel|[[context|]extension|]priority)…
    Tags: asterisk, channel, exten, dialplan

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

  • December 25, 2014 at 4:34 am
    Permalink

    [default]
    exten => pre_dial_handler,1,NoOp()
    same => n,Verbose(1, Channel is ${CHANNEL})
    same => n,Return()

    exten => dial_example,1,NoOp()
    same => n,Dial(SIP/alice,,b(default^pre_dial_handler^1)

    Reply
  • February 9, 2015 at 10:52 pm
    Permalink

    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.

    Reply
  • February 9, 2015 at 10:55 pm
    Permalink

    It’s a shame you don’t have a donate button! I’d definitely donate to this brilliant blog!
    I suppose for now i’ll settle for bookmarking and adding your RSS feed to
    my Google account. I look forward to brand new
    updates and will share this website with my Facebook group.
    Talk soon!

    Reply
  • February 9, 2015 at 10:55 pm
    Permalink

    Heya i’m for the first time here. I found this board and I find It truly useful & it
    helped me out a lot. I’m hoping to provide something back and
    help others such as you aided me.

    Reply
  • February 9, 2015 at 11:32 pm
    Permalink

    Hello, all the time i used to check web site posts here early in the morning, as i enjoy to learn more
    and more.

    Reply
  • February 9, 2015 at 11:40 pm
    Permalink

    Hi there very cool website!! Guy .. Excellent ..
    Wonderful .. I’ll bookmark your site and take the feeds additionally?
    I am happy to seek out a lot of helpful information here within the put up, we’d like develop
    more strategies on this regard, thank you for sharing.
    . . . . .

    Reply
  • February 9, 2015 at 11:44 pm
    Permalink

    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.

    Reply
  • February 10, 2015 at 8:31 am
    Permalink

    Spot on with this write-up, I really believe this
    amazing site needs a great deal more attention. I’ll probably be back again to read
    through more, thanks for the information!

    Reply
  • February 10, 2015 at 8:41 am
    Permalink

    Amazing blog! Is your theme custom made or did you download it from somewhere?

    A theme like yours with a few simple tweeks would really make
    my blog jump out. Please let me know where you got your theme.
    Many thanks

    Reply
  • February 12, 2015 at 2:58 am
    Permalink

    I like the helpful information you provide in your articles.
    I will bookmark your blog and check again here frequently.
    I am quite certain I will learn a lot of new stuff right here!
    Good luck for the next!

    Reply
  • February 14, 2015 at 4:33 pm
    Permalink

    In a pledged deposition, Lewakowski asserts he took $15,
    000 of that to pay a down payment to Pinnacle, the house contractor
    of the modular home.

    Here is my website: site

    Reply
  • February 14, 2015 at 11:13 pm
    Permalink

    This is really interesting, You are a very skilled blogger.
    I have joined your feed and look forward to seeking
    more of your fantastic post. Also, I’ve shared your web site in my social networks!

    Reply
  • February 17, 2015 at 4:25 pm
    Permalink

    It’s actually a great and helpful piece of information. I’m happy that
    yoou shared this helpful info with us. Please keep us up to date like this.
    Thank you for sharing.

    Reply
  • February 17, 2015 at 10:57 pm
    Permalink

    Hello,I enjoy reading all of your article post.
    I wanted to write a little comment to support you.

    Reply
  • February 18, 2015 at 5:27 am
    Permalink

    I like the helpful information you provide in your articles.
    I’ll bookmark your weblog and check again here frequently.
    I am quite sure I’ll learn many new stuff right here!
    Good luck for the next!

    Reply
  • February 20, 2015 at 5:29 pm
    Permalink

    Howdy! I just would like to give you a big thumbs up
    for your great info you have got here on this
    post. I will be returning to your blog for more soon.

    Reply
  • February 21, 2015 at 12:39 am
    Permalink

    This program has actually been evaluated by OSHA
    as well as surpasses the minimum needs established by OSHA for the tower erection sector.

    Reply
  • February 22, 2015 at 6:53 am
    Permalink

    It’s very effortless to find out any matter on web as compared to books, as I found this piece of writing at this
    website.

    Reply

Leave a Reply

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

%d bloggers like this: