Asterisk Project : Pre-Dial Handlers
This page last changed on Aug 08, 2012 by mjordan.
OverviewPre-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:
Pre-dial handlers are supported in the Dial application and the FollowMe application.
SyntaxHandlers are invoked using similar nomenclature as other options (such as M or U) in Dial or FollowMe that cause some portion of the dialplan to execute. b([[context^]exten^]priority[(arg1[^...][^argN])]) B([[context^]exten^]priority[(arg1[^...][^argN])])
ExamplesThe examples illustrated below use the following channels:
Example 1 - Executing a pre-dial handler on the caller channel[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() Example 1 CLI Output <SIP/foo-123> Dial(SIP/bar,,B(default^caller_handler^1)) <SIP/foo-123> Executing default,caller_handler,1 <SIP/foo-123> In caller pre-dial handler! <SIP/foo-123> calling SIP/bar-124 Example 2 - Executing a pre-dial handler on a callee channel[default] exten => s,1,NoOp() same => n,Dial(SIP/bar,,b(default^callee_handler^1)) same => n,Hangup() exten => callee_handler,1,NoOp() same => n,Verbose(0, In callee pre-dial handler!) same => n,Return() Example 2 CLI Output <SIP/foo-123> Dial(SIP/bar,,b(default^callee_handler^1)) <SIP/bar-124> Executing default,callee_handler,1 <SIP/bar-124> In callee pre-dial handler! <SIP/foo-123> calling SIP/bar-124 Example 3 - Executing a pre-dial handler on multiple callee channels[default] exten => s,1,NoOp() same => n,Dial(SIP/bar&SIP/baz,,b(default^callee_handler^1)) same => n,Hangup() exten => callee_handler,1,NoOp() same => n,Verbose(0, In callee pre-dial handler!) same => n,Return() Example 3 CLI Output <SIP/foo-123> Dial(SIP/bar&SIP/baz,,b(default^callee_handler^1)) <SIP/bar-124> Executing default,callee_handler,1 <SIP/bar-124> In callee pre-dial handler! <SIP/baz-125> Executing default,callee_handler,1 <SIP/baz-125> In callee pre-dial handler! <SIP/foo-123> calling SIP/bar-124 <SIP/foo-123> calling SIP/baz-125 |
![]() |
Document generated by Confluence on Nov 02, 2012 17:42 |