Contact

Blogs

Take a look at the things that interest us.

Call handling applications in Asterisk dialplan

Wesley Wesley 3 years

In this tutorial, I would like to show you the main call handling applications that can be used in the Asterisk dialplan. I will also be showing you examples to give you an idea of how to use the applications.

Answer

Answer a call

Answer([delay])

Example

exten => 123,1,Answer()
exten => 123,n,Wait(1)
exten => 123,n,Playback(hello)
exten => 123,n,Hangup()

Busy

Signal busy to caller

Busy([timeout])

Example

exten => 123,1,Playback(vm-sorry)
exten => 123,n,Playtones(busy)
exten => 123,n,Busy()

ChanIsAvail

Check to see if a channel is available

ChanIsAvail(technology1/resource1[&technology2/resource2...][,options])

Example

The name of the accessible channel, including the session number of the call.

${AVAILCHAN}

The canonical channel name (i.e., the channel name without session number).

${AVAILORIGCHAN}

Status code of the channel:

${AVAILSTATUS}

Status code of the channel:

  • AST_DEVICE_UNKNOWN (0): Status of the channel is unknown. It is a valid channel, but we don't know about its state.
  • AST_DEVICE_NOT_INUSE (1): The channel is not in use.
  • AST_DEVICE_IN_USE (2): The channel is in use.
  • AST_DEVICE_BUSY (3): The channel is busy.
  • AST_DEVICE_INVALID (4): The channel is unknown.
  • AST_DEVICE_UNAVAILABLE (5): The channel is not available and not registered.
  • AST_DEVICE_RINGING (6): The channel is ringing.

ChannelRedirect

Redirect a channel to another extension and/or priority

ChannelRedirect(channel,[context,]extension,priority)

Redirects the specified channel to another extension and priority.

  • Channel: Name of the channel to be redirected.
  • Context: Context to which the channel should be redirected.
  • Extension: Extension to which the channel should be redirected.
  • priority: Priority in the new extension.

Congestion

Signal congestion to caller

Congestion([timeout])

Example

; for Caller ID is 888-555-8701, always signal congestion:
exten => 123,1,GotoIf($[${CALLERID(num)} = 8885558701]?10)
exten => 123,n,Playtones(congestion)
exten => 123,n,Congestion(5)
exten => 123,n,Hangup()
exten => 123,10,Dial(Zap/1)

Dial

Initiate a call to a channel / connect to a channel

Dial(technology/resource,timeout,options,URL)

Example

exten => s,1,Dial(SIP/a_SIP_friend)

DISA

DISA (Direct Inward System Access)

DISA(password[,context[,callerid[,mailbox[@voicemail-context]]]])

Example

; Allow outside callers to dial 800 numbers, provided they know the
; password (1234). Set the caller ID so that the call appears to be
; coming from inside the company:
[incoming]
exten => 123,1,DISA(1234,disa,Widgets Inc <212-555-3412>)
[disa]
exten => _0800XXXXXXXX,1,Dial(Zap/4/${EXTEN})

FollowMe

"follow me" function

FollowMe(followMeID,options)

Hangup

Hang up

Hangup()

Example

exten => 123,1,Answer()
exten => 123,n,Playback(vm-goodbye)
exten => 123,n,Hangup()

Page

Page multiple devices

Page(technology/resource[&technology2/resource2[&...]][,options])

Example

exten => 123,1,Page(SIP/2000&SIP/2001&SIP/2002)

Park

Park call

Park(extension)

Example

; park the call in parking space 701:
include => parkedcalls
exten => 123,1,Answer()
exten => 123,n,Park(701)

Pickup

Call pickup

Pickup(extension[@context][&extension2@context2[&...]])

Example

exten => 1234,1,Pickup(2000@sales)

RetryDial

Dial() application with auto-redial

RetryDial(announcement,sleep,retries,technology/resource[&technology2/resource2...][,timeout[,options[,URL]]])

Example

; Try to dial the number three times, repeat after 5 seconds:
exten => 123,1,RetryDial(trying-to-connect-you,5,3,IAX2/VOIP/18005554148,30)
; If the caller presses 4 while waiting, try the call on Zap/4:
exten => 0,1,RetryDial(trying-to-connect-you,5,3,Zap/4/18005554148,30)

Ringing

Signal ringing to caller

Ringing()

Example

; Fake ringing:
exten => 123,1,Ringing()
exten => 123,n,Wait(5)
exten => 123,n,Playback(tt-somethingwrong)
Call handling applications in Asterisk dialplan 2021-08-24 08:18:27

There are no comments.

4738

Have questions about our services?

Contact our Sales team to get answers.

Contact Us
gomibako@aska-ltd.jp