Asterisk dialplan applications

From 탱이의 잡동사니
Revision as of 10:57, 5 November 2018 by Pchero (talk | contribs) (→‎Stasis)
Jump to navigation Jump to search

Overview

Asterisk dialplan application 내용 정리

AddQueueMember

Queue 에 멤버를 추가한다(dynamically).

AddQueueMember(queuename,[interface,[penalty,[options,[membername,[stateinterface]]]]])
  • queuename : 멤버를 추가하고자 하는 Queue name.
  • interface : 추가하고자 하는 멤버의 interface
  • penalty : 추가하고자 하는 멤버의 penalty.
  • membername : 추가하고자 하는 멤버의 name.
  • stateinterface :

Channel variables

application 실행 이후, 실행 결과와 관련한 다음의 channel variable 을 설정한다.

  • AQMSTATUS : The status of the attempt to add a queue member as a text string.
ADDED : 추가됨.
MEMBERALREADY : 이미 멤버가 있음.
NOSUCHQUEUE : 큐를 찾을 수 없음.

Example

[QueueMemberFunctions]
exten => *54,1,Verbose(2,Logging In Queue Member)
  smae => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
  same => n,AddQueueMember(support,${MemberChannel})
  same => n,Verbose(1,${AQMSTATUS}) ; ADDED, MEMBERALREADY, NOSUCHQUEUE
  smae => n,Playback(agent-loginok)
  same => n,Hangup()

ADSIProg

지정한 ADSI 스크립트를 phone 으로 로드한다.

ADSIProg([script])
  • script : adsi script to use. If not given uses the default script asterisk.adsi

See also

AELSub

Launch subroutine build with AEL.

Execute the named subroutine, defined in AEL, from another dialplan language, such as extensions.conf, Relaltime extensions, or Lua. The purpose of this application is to provide a sane entry point into AEL subroutines, the implementation of which many change from time to time.

AELSub(routine,[args])
  • routine : Named subroutine to execute.
  • args

See also

AgentLogin

agent login 을 한다.

Login an agent to the system. Any agent authentication is assumed to already be done by dialplan. While logged in, the agent can receive calls and will hear the sound file specified by the config option custome_beep when a new call comes in for the agent. Login failure will continue in the dialplan with AGENT_STATUS set.

Before logging in, you can setup on the real agent channel the CHANNEL(dtmf-features) an agent will have when talking to a caller and you can setup on the channel running this application the CONNECTEDLINE() information the agent will se while waiting for a caller.

The Agents:AgentId device state is available to monitor the status of the agent.

AgentLogin(AgentId,[options])
  • AgentId
  • options
s : silent login. do not announce the login ok segment after agent logged on.

Channel variables

  • AGENT_STATUS : enumeration values.
INVALID : The specified agent is invalid.
ALREADY_LOGGED_IN : The agent is already logged in.

Example

[sample_agent]
exten => s,1,NoOp(sample_agent)
 same => n,AgentLogin(10001)

See also

AgentRequest

Request an agent to connect with the channel.

Request an agent to connect with the channel. Failure to find, alert the agent, or acknowledge the call will continue in the dialplan with AGENT_STATUS set.

AgentRequest(AgentId)
  • AgentId

Channel variables

  • AGENT_STATUS : enumeration values
INVALID : The specified agent is invalid.
NOT_LOGGED_IN : The agent is not available.
BUSY : The agent is on another call.
NOT_CONNECTED : The agent did not connect with the call. The agent most likely did not acknowledge the call.
ERROR : Alerting the agent failed.

See also

AGI

Executes an AGI compliant application.

Exectes an Asterisk Gateway Interface compliant program on a channel. AGI allows Asterisk to launch external programs written in any language to control a telephony channel, play audio, read DTMF digits, etc. by communicating with the AGI protocol.

AGI(command,arg1,[arg2[,...]])
  • command : How AGI should be invoked on the chaneel.
  • args: Arguments to pass to the AGI script or server.
arg1
arg2[,arg2...]

The following variants of AGI exist, and are chosen based on the value passed to command.

  • AGI : The classic variant of AGI, this will launch the script specified by command as a new process. Communication with the script occurs on stdin and stdout. If the full path to the script is not provided, the astagidir specified in asterisk.conf will be used.
  • FastAGIj : Connect Asterisk to a FastAGI server using a TCP connection. The URI to the FastAGI server should be given in the form [scheme]://host.domain[:port][/script/name], where scheme is either agi or hagi. In the case of hagi, an SRV lookup will be performed to try to connect to a list of FastAGI servers. The hostname in the URI must be prefixed with _agi._tcp. prior to the DNS resolution. For example, if you specify the URI hagi://agi.example.com/foo.agi the DNS query would be for _agi._tcp.agi.example.com. You will need to make sure this resolves correctly.
  • AsncAGI : Use AMI to control the channel in AGI. AGI commands can be invoked using the AMI action, with a variety of AGI specific events passed back over the AMI connection. AsyncAGI should be invoked by passing agi : async to the command parameter.

Channel variables

  • AGISTATUS : The status of the attempt to the run the AGI script text string.
SUCCESS
FAULURE
NOTFOUND
HANGUP

Example

  • AGI invocation examples
; Start the AGI script /tmp/my-cool-script.sh, passing it the contents
; of the channel variable FOO
same => n,AGI(/tmp/my-cool-script.sh,${FOO})
 
; Start the AGI script my-cool-script.sh located in the astagidir
; directory, specified in asterisk.conf
same => n,AGI(my-cool-script.sh)
 
; Connect to the FastAGI server located at 127.0.0.1 and start the script
; awesome-script
same => n,AGI(agi://127.0.0.1/awesome-script)
 
; Start AsyncAGI
same => n,AGI(agi:async)

See also

AlarmReceiver

Provide support for receiving alarm reports from a burglar or fire alarm panel.

This application should be called whenever there is an alarm calling int to dump its events. The application will handshake with the alarm panel, and receive events, validate them, handshake them, and store them until the panel hangs up. Once the panel hang up, the application will run the system command specified by the eventcmd setting in alarmreceiver.conf and pipe the events to the standard input of the application. The configuration file also contains settings for DTMF timing, and for the loudness of the acknowledgemnet tones.

AlarmReceiver()

Channel variables

  • ALARMRECEIVER_CALL_LIMIT : Maximum call time, in milliseconds.
If set, this variable causes application to exit after the specified time.
  • ALARMRECEIVER_RETRIES_LIMIT : Maximum number of retries per call.
If set, this variable causes application to exit after the specified number of messages.

Configuration

/etc/asterisk/alarmreceiver.conf

;
; alarmreceiver.conf
;
; Sample configuration file for the Asterisk alarm receiver application.
;


[general]

;
; Specify a timestamp format for the metadata section of the event files
; Default is %a %b %d, %Y @ %H:%M:%S %Z

timestampformat = %a %b %d, %Y @ %H:%M:%S %Z

;
; Specify a command to execute when the caller hangs up
;
; Default is none
;

;eventcmd = yourprogram -yourargs ...

;
; Specify a spool directory for the event files. This setting is required
; if you want the app to be useful. Event files written to the spool
; directory will be of the template event-XXXXXX, where XXXXXX is a random
; and unique alphanumeric string.
;
; Default is none, and the events will be dropped on the floor.
;

eventspooldir = /tmp

;
; The alarmreceiver app can either log the events one-at-a-time to individual
; files in the spool directory, or it can store them until the caller
; disconnects and write them all to one file.
;
; The default setting for logindividualevents is no.
;

logindividualevents = no

;
; The timeout for receiving the first DTMF digit is adjustable from 1000 msec.
; to 10000 msec. The default is 2000 msec. Note: if you wish to test the
; receiver by entering digits manually, set this to a reasonable time out
; like 10000 milliseconds.

fdtimeout = 2000

;
; The timeout for receiving subsequent DTMF digits is adjustable from
; 110 msec. to 4000 msec. The default is 200 msec. Note: if you wish to test
; the receiver by entering digits manually, set this to a reasonable time out
; like 4000 milliseconds.
;

sdtimeout = 200

;
; Wait for the connection to settle post-answer. Adjustable from 500 msec. to 10000 msec.
; The default is 1250 msec.
;

answait = 1250

; When logging individual events it may be desirable to skip grouping of metadata

;no_group_meta = yes

;
; The loudness of the ACK and Kissoff tones is adjustable from 100 to 8192.
; The default is 8192. This shouldn't need to be messed with, but is included
; just in case there are problems with signal levels.
;

loudness = 8192

;
; The db-family setting allows the user to capture statistics on the number of
; calls, and the errors the alarm receiver sees. The default is for no
; db-family name to be defined and the database logging to be turned off.
;

;db-family = yourfamily:

;
; End of alarmreceiver.conf
;

See also

AMD

연결된 콜의 Answering machine(자동 응답기)여부를 분석한다.

AMD([initialSilence,[greeting,[afterGreetingSilence,[totalAnalysis Time,[miniumWordLength,[betweenWordSilence,[maximumNumberOfWords,[silenceThreshold,[maximumWordLength]]]]]]]]])
  • initialSilence - Is maximum initial silence duration before greeting. If this is exceeded set as MACHINE
  • greeting - is the maximum length of a greeting. If this is exceeded set as MACHINE
  • afterGreetingSilence - Is the silence after detecting a greeting. If this is exceeded set as HUMAN
  • totalAnalysis Time - Is the maximum time allowed for the algorithm to decide HUMAN or MACHINE
  • miniumWordLength - Is the minimum duration of Voice considered to be a word
  • betweenWordSilence - Is the minimum duration of silence after a word to consider the audio that follows to be a new word
  • maximumNumberOfWords - Is the maximum number of words in a greeting. If this is exceeded set as MACHINE
  • silenceThreshold - How long do we consider silence
  • maximumWordLength - Is the maximum duration of a word to accept. If exceeded set as MACHINE

Channel variables

분석된 내용은 아래의 channel variable 에 설정된다.

  • AMDSTATUS - 자동응답기 분석 결과
MACHINE - 자동응답기
HUMAN - 사람
NOTSURE - 분석 불가
HANGUP - 콜 종료됨.
  • AMDCAUSE - 분석된 결과에 대한 자세한 사유를 설명한다.
TOOLONG - Total Time.
INITIALSILENCE - Silence Duration - Initial Silence.
HUMAN - Silence Duration - afterGreetingSilence.
LONGGREETING - Voice Duration - Greeting.
MAXWORDLENGTH - Word Count - maximum number of words.

Configuration

/etc/asterisk/amd.conf

;
; Answering Machine Detection Configuration
;

[general]
total_analysis_time = 5000	; Maximum time allowed for the algorithm to decide
				; on whether the audio represents a HUMAN, or a MACHINE
silence_threshold = 256		; If the average level of noise in a sample does not reach
				; this value, from a scale of 0 to 32767, then we will consider
				; it to be silence.

; Greeting ;
initial_silence = 2500		; Maximum silence duration before the greeting.
				; If exceeded, then the result is detection as a MACHINE.
after_greeting_silence = 800	; Silence after detecting a greeting.
				; If exceeded, then the result is detection as a HUMAN
greeting = 1500			; Maximum length of a greeting. If exceeded, then the
				; result is detection as a MACHINE.

; Word detection ;
min_word_length = 100		; Minimum duration of Voice to considered as a word
maximum_word_length = 5000  	; Maximum duration of a single Voice utterance allowed.
between_words_silence = 50	; Minimum duration of silence after a word to consider
				; the audio what follows as a new word

maximum_number_of_words = 3	; Maximum number of words in the greeting
				; If REACHED, then the result is detection as a MACHINE
				; WARNING: Releases prior to January 1 2016 documented
				; maximum_number_of_words as 'if exceeded, then MACHINE',
				; which did not reflect the true functionality.  In Asterisk 14,
				; this functionality will change to reflect the variables' name.

See also

Answer

Channel 이 Ringing 중일 경우, Answer 를 한다.

만약 이미 Answer 가 된 channel 이라면 아무 영향을 주지 않는다.

Answer([delay])
  • delay : 입력된 시간만큼 대기 후, answer 를 한다. (milliseconds)

Example

[PasswordGet]
 exten => s,1,Answer(${AnswerDelay})
  same => n,Set(TIMEOUT(digit)=3)
  same => n,Set(TimeOutRetry=1)
  same => n(Speak),Set(PasswordValue=)
  same => n,Background(pluto_sample/PassWordGet)
  same => n,WaitExten(5)

See also

Authenticate

Authenticate a user.

This application asks the caller to enter a given password in order to continue dialplan execution. If the password begins with the / character, it is interpreted as a file which contains a list of valid passwords, listed 1 password per line in the file.

When using a database key, the value associated with the key can be anything. Users have three attempts to authenticate before the channel is hung up.

Authenticate(password,[options,[maxdigits,[prompt]]])
  • password : 패스워드
  • options
a : Set the channel's account code to the password that is entered.
d : Interpret the given path as database key, not a literal file.
m : Interpret the given path as a file which contains a list of accout codes and password hashes delimited with :, listed one per line in the file. When one of the password is matched, the channel will have its account code set to the corresponding account code in the file.
r : Remove the database key upon successful entry(valid with d only).
  • maxdigits : maximum acceptable number of digits. Stop redaing after maxdigits have been entered(without requiring the user to press the # key). Default to 0 - no limit - wait for the user press the # key.
  • prompt : Override the agent-pass prompt file.

See also

BackGround

Play an audio file while waiting for digits of an extension to go to.

This application will play the given list of files (do not put extension) while waiting for an extension to be dialed by the calling channel. To continue waiting for digits after this application has finished playing files, the WaitExten application should be used.

If one of the requested sound files does not exist, call processing will be terminated.

BackGround(filename1&[filename2[&...]],[options,[langoverride,[context]]])
  • filenames :
filename1
filename2[,filename2...]
  • options
s : Causes the playback of the message to be skipped if the channel is not in the up state(i.e. it hasn't been answered yet). If this happens, the application will return immediately.
n : Don't answer the channel before playing the files.
m : Only break if a digit hit matches a one digit extension in the destination context.
  • langoverride : Explicitly specifies which language to attempt to use for the requested sound files.
  • context : This is the dialplan context that this application will use when exiting to a dialed extension.

Channel variables

  • BACKGROUNDSTATUS : The status of the background attempt as a text string.
SUCCESS
FAILED

See also

BackGroundDetect

Background a file with talk detect.

Plays back filename, waiting for interruption from a given digit (the digit must start the beginning of a valid extension, or it will be ignored). During the playback of the file, audio is monitored in the receive direction, and if a period of non-silence which is greater than min ms yet less than max ms is followed by silence for at least sil ms, which occurs during the first analysistime ms, then the audio playback is aborted and processing jumps to the talk extension, if available.

BackgroundDetect(filename,[sil,[min,[max,[analysistime]]]])
  • filename
  • sil : default : 1000
  • min : default : 100
  • max : default : infinity
  • analysistime : default : infinity

See also

Bridge

두 개의 채널을 서로 연결시킨다.

단순히 연결만 시키는 것이 아닌 dialplan 을 통해 여러가지 옵션들을 제공한다.

Bridge(channel,[options])
  • channel : 여기에 지정된 채널과 bridge 를 하게된다.
  • options
p : Play a courtesy tone to channel.
F(context^exten^priority) : When the bridger hangs up, transfer the gridged party to the specified destination and start execution at that location.
F : When the bridger hangs up, transfer the bridged party to the next priority of the current extension and start execution at that location.
h : Allow the called party to hang up by sending the * DTMF digit.
H : Allow the calling party to hang up by pressing the * DTMF digit.
k : Allow the called party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
K : Allow the calling party to enable parking of the call by sending the DTMF sequence defined fro call parking in features.conf.
L(xyz) : Limit the call to x ms. Play a warning when y ms are left. Repeat the warning every z ms. The following special variables can be used with below options.
LIMIT_PLAYAUDIO_CALLER : Play sounds to the caller. yes|no (default: yes)
LIMIT_PLAYAUDIO_CALLEE : Play sounds to the callee. yes|no (default: yes)
LIMIT_TIMEOUT_FILE : File to play when time is up.
LIMIT_CONNECT_FILE : File to play when call begins.
LIMIT_WARNING_FILE : File to play as warning if y is defined. The default is to say the time remaining.
S(x) : Hang up the call after x seconds after the called party has answered the call.
t : Allow the called party to transfer the calling party by sending DTMF sequence defined in features.conf.
T : Allow the calling party to transfer the called party by sending DTMF sequence defined in features.conf.
w : Allow the called party to enable recording of the call by sending the DTMF sequence defined for one-touch recording in features.conf.
W : Allow the calling party to enable recording of the call by sending the DTMF sequence defined for one-touch recording in features.conf.
x : Cause the called party to be hung up after the bridge, instead of being restarted in the dialplan.

Channel variables

  • BRIDGERESULT : bridge 를 시도한 결과가 string 으로 저장된다.
SUCCESS : 성공.
FAILURE : 실패.
LOOP
NONEXISTENT : 채널이 존재하지 않음.
INCOMPATIBLE : Bridge 가 서로 불가능한 채널임.

Example

[BridgeChannel]
 exten => s,1,NoOp(BridgeChannel)
  same => n,ExecIf(${EXISTS(${BridgeChan})}?Bridge(${BridgeChan}))
  same => n,Wait(1)
  same => n,EndWhile()
  same => n,NoOp(NoFound)

See also

BridgeAdd

Join a bridge that contains the specified channel.

This application places the incoming channel into the bridge containing the specified. The specified channel only needs o be the prfix of a full channel name IE. 'SIP/cisco0001'.

BridgeAdd([name])
  • name : Name of the channel in an exisiting bridge.

See also

BrdigeWait

Put a call into the holding bridge.

This application places the incoming channel into a holding bridge. The channel will then wait in the holding bridge until some event occurs which removes it from the holding bridge.

This application will answer calls which haven't already been answered.
BridgeWait([name,[role,[options]]])
  • name : Name of the holding bridge to join. This is a handle for BridgeWait only and does not affect the actual bridges that are created. If not provided, the reserved name default will be used.
  • role : Defines the channel's purpose for entering the holding bridge. Values are case sensitive.
participant : The channel will enter the holding bridge to be placed on hold until it is removed from the bridge for some reason. (default)
announcer : The channel will enter the holding bridge to make announcements to channels that are currently in the holding bridge. While an announcer is present, holding for the participants will be suspended.
  • options
m(class) : The specified MOH class will be used/suggested for music on hold operations. This option will only be useful for entertainment modes that use it(m and h).
e : Which entertainment mechanism should be used while on hold in the holding bridge. Only the first letter is read.
m : Play music on hold(default).
r : Ring without pause.
s : Generate silent audio.
h : Put the channel on hold.
n : No entertainment.
S(duration) : Automatically exit the bridge and return to the PBX after duration seconds.

See also

Busy

Busy 상태를 나타낸다.

This application will indicate the busy condition to the calling channel.

Busy([timeout])
  • timeout : 지정된 시간(초) 대기 후, 콜을 종료한다. 만약 값을 지정하지 않았을 경우, channel 이 hangup 될 때 까지 대기한다.

See also

CallCompletionCancel

Call completion 요청을 취소한다.

CallCompletionCancel()

Channel variables

  • CC_CANCEL_RESULT : Status of the cancel
SUCCESS
FAIL
  • CC_CANCEL_REASON : Reason the cancel failed.
NO_CORE_INSTANCE
NOT_GENERIC
UNSPECIFIED

See also

Dial

Attempt to connect to another device or endpoint and bridge the call.

This application will place calls to one or more specified channels. As soon as one of the requested channels answers, the originating channel will be answered, if it has not already been answered. These two channels will then be active in a bridged call. All other channels that were requested will then be hung up.

Unless there is a timeout specified, the Dial application will wait indefinitely until one of the called channels answers, the user hangs up, or if all of the called channels are busy or unavailable. Dialplan execution will continue if no requested channels can be called, or if the timeout expires. This application will report normal termination if he originating channel hangs up, or if the call is bridged and either of the parties in the bridge ends the call.

If the OUTBOUDN_GROUP variable is set, all peer channels created by this application will be put into that group (as in Set (GROUP()=...). If the OUTBOUND_GROUP_ONCE variable is set, all peer channels created by this application will be put into that group(as in Set(GROUP())=...). Unlike OUTBOUND_GROUP, however, the variable will be unset after use.

Dial(Technology/Resource&[Technology2/Resource2[&...]],[timeout,[options,[URL]]])
  • Technology/Resource
Technology/Resource : Specification of the device(s) to dial. These must be in the format of Technology/Resource, where Technology represents a particular channel driver, and Resource represents a resource available to that particular channel driver.
Technology2/Resource2[,Technology2/Resource2...] : Optional extra devices to dial in parallel. if you need more than one enter them as Technology2/Resource2&Technology3/Resource3&...
  • timeout : Specifies the number of seconds we attempt to dial the specified devices. If not specified, this default to 136 years.
  • options
A( x) : Play an announcement to the called party, where x is the prompt to be played.
x : The file to play to called party.
a : Immediately answer the calling channel when the called channel answers in all cases. Normally, the calling channel is answered when the called channel answers, but when options such as A() and M() are used, the calling channel is not answered until all actions on the called channel (such as playing an announcement) are completed. This option can be used to answer the calling channel before doing anything on the called channel. You will rarely need to use this option, the default behavior is adequate in most cases.
b(context^exten^priority) : Before initiating an outgoing call, Gosub to the specified location using the newly created channel. The Gosub will be executed for each destination channel.
context
exten
priority(params)
arg1[^arg1...]
argN
B(context^exten^priority) : Before initiating the outgoing call(s), Gosub to the specified location using the current channel.
context
exten
priority(params)
arg1[^arg1...]
argN
C : Reset the call detail record(CDR) for this call.
c : If the Dial() application cancels this call, always set HANGUPCAUSE to to "answered elsewhere".
d : Allow the calling user to dial a 1 digit extension while waiting for a call to be answered. Exit to that extension if it exists in the current context, or the context defined in the EXITCONTEXT variable, if it exists.
D(called:calling:progress) : Send the specified DTMF strings after the called party has answered, but before the call gets bridged. The called DTMF string is sent to the called party, and the calling DTMF string is sent to the calling party. Both arguments can be used alone. If progress is specified, its DTMF is sent to the called party immediately after receiving a PROGRESS message. See SendDTMF for valid digits.
called
calling
progress
e : Execute the h extension for peer after the call ends.
f( x ) : If x is not provided, force the CallerID sent on a call-forward or deflection to the dialplan extension of this Dial() using a dialplan hint. For example, some PSTNs do not allow CallerID to be set to anything other than the number assigned to you. If x is provided, force the CallerID sent to x.
x
F(context^exten^priority) : When the caller hangs up, transfer the called party to the specified destination and start execution at that location.
context
exten
priority
g : Proceed with dialplan execution at the next priority in the current extension if the destination channel hangs up.
G( context^exten^priority) : If the call is answered, transfer the calling party to the specified priority and the called party to the specified priority plus one.
context
exten
priority
h : Allow the called party to hang up by sending the DTMF sequence defined for disconnect in features.conf.
H : Allow the calling party to hang up by sending the DTMF sequence defined for disconnect in features.conf.
i : Asterisk will ignore any forwarding requests it may receive on this dial attempt.
I : Asterisk will ignore any connected line update requests or any redirecting party update requests it may receive on this dial attempt.
k : Allow the called party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
K : Allow the calling party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
L( x:y:z ) : Limit the call to x milliseconds. Play a warning when y milliseconds are left. Repeat the warning every z milliseconds until time expires. This option is affected by the following variables.
LIMIT_PLAYAUDIO_CALLER : If set, this variable causes Asterisk to play the prompts to the caller.
YES default: (true)
NO
LIMIT_PLAYAUDIO_CALLEE : If set, this variable causes Asterisk to play the prompts to the callee.
YES
NO default: (true)
LIMIT_TIMEOUT_FILE : If specified, filename specifies the sound prompt to play when the timeout is reached. If not set, the time remaining will be announced.
FILENAME
LIMIT_CONNECT_FILE : If specified, filename specifies the sound prompt to play when the call begins. If not set, the time remaining will be announced.
FILENAME
LIMIT_WARNING_FILE : If specified, filename specifies the sound prompt to play as a warning when time x is reached. If not set, the time remaining will be announded.
FILENAME
x : Maximum call time, in milliseconds.
y : Warning time, in milliseconds.
z : Repeat time, in milliseconds.
m( class ) : Provide hold music to the calling party until a requested channel answers. A specific music on hold class (as defined in musiconhold.conf) can be specified.
class
M( macro^arg ) : Execute the specified macro for the called channel before connecting to the calling channel. Arguments can be specified to the Macro using ^ as a delimeter. The macro can set the variable MACRO_RESULT to specify the following actions after the macro is finished executing.
MACRO_RESULT : If set, this action will be taken after the macro finished executing.
ABORT : Hangup both legs of the call.
CONGESTION : Behave as if line congestion was encountered.
BUSY : Behave as if a busy signal was encountered.
CONTINUE : Hangup the called party and allow the calling party to continue dialplan execution at the next priority.
GOTO:[[<CONTEXT>^]<EXTEN>^]<PRIORITY> : Transfer the call to the specified destination.
macro : Name of the macro that should be executed.
arg[^arg...] : Macro arguments.

Channel variables

  • DIALEDTIME : This is the time from dialing a channel until when it is disconnected.
  • ANSWEREDTIME : This is the time amount of time for actual call.
  • DIALEDPEERNAME : The name of the outbound channel that answered the call.
  • DIALEDPEERNUMBER : The number that was dialed for the answered outbound channel.
  • FORWARDERNAME : If a call forward occurred, the name of the forwarded channel.
  • DIALSTATUS
CHANUNAVAIL
CONGESTION
NOANSWER
BUSY
ANSWER
CANCEL
DONTCALL : For the Privacy and Screening Modes. Will be set if the called party chooses to send the calling party to the 'Go Away' script.
TORTURE : For the Privacy and Screening Modes. Will be set if the called party chooses to send the calling party to the 'torture' script.
INVALIDARGS

Example

  • Dial with 30 second timeout
same => n,Dial(PJSIP/alice,30)
  • Parallel dial with 45 second timeout
same => n,Dial(PJSIP/alice&PJSIP/bob,45)
  • Dial with 'g' continuation option
same => n,Dial(PJSIP/alice,,g)
same => n,Log(NOTICE, Alice call result: ${DIALSTATUS})
  • Dial with transfer/recording features for calling party
same => n,Dial(PJSIP/alice,,TX)
  • Dial with call length limit
same => n,Dial(PJSIP/alice,,L(60000:30000:10000))
  • Dial alice and bob and send NO_ANSWER to bob instead of ANSWERED_ELSEWHERE when alice answers
same => n,Dial(PJSIP/alice&PJSIP/bob,,Q(NO_ANSWER))
  • Dial with pre-dial subroutines
[default]

exten => callee_channel,1,NoOp()
 same => n,Log(NOTICE, I'm called on channel ${CHANNEL} prior to it starting the dial attempt)
 same => n,Return()

exten => called_channel,1,NoOp()
 same => n,Log(NOTICE, I'm called on outbound channel ${CHANNEL} prior to it being used to dial someone)
 same => n,Return()

exten => _X.,1,NoOp()
 same => n,Dial(PJSIP/alice,,b(default^called_channel^1)B(default^callee_channel^1))
 same => n,Hangup()
  • Dial into ConfBridge using 'G' option
same => n,Dial(PJSIP/alice,,G(jump_to_here))
same => n(jump_to_here),Goto(confbridge)
same => n,Goto(confbridge)
same => n(confbridge),ConfBridge(${EXTEN})

See also

Monitor

Channel 을 모니터링한다.

주로 channel 을 모니터링 시작하고자 할 때 사용한다. 지정된 채널의 input/output voice packet 들이 StopMonitor 혹은 hangup 이 될 때 까지 파일에 저장된다. 기본값으로 파일들은 /var/spool/asterisk/monitor 디렉토리에 저장된다.

이미 monitoring 중이거나 저장 파일을 열 수 없을 때 1, 나머지 경우 0 을 리턴한다.

Monitor(file_format:[urlbase],[fname_base,[options]]])
  • file_format
file_format: optional, if not set, defaults to wav
  • fname_base: 설정할 경우, 설정한 filename 으로 파일이 생성된다.
  • options
m : when the recording ends mix the two leg files into one and delete the two leg files. If the variable MONITOR_EXEC is set, the application referenced in it will be executed instead of soxmix/sox and the raw leg files will NOT be deleted automatically. soxmix/sox or MONITOR_EXEC is handed 3 arguments, the two leg files and a target mixed file name which is the same as the leg file names only without the in/out designator. If MONITOR_EXEC_ARGS is set, the contents will be passed on as additional arguments to MONITOR_EXEC. Both MONITOR_EXEC and the Mix flag can be set from the administrator interface.
b : Don't begin recording unless a call is bridged to another channel.
i : Skip recording of input stream (disables m option).
o : Skip recording of output stream (disables m option).

See also

MusicOnHold

Play Music On Hold indefinitely.

Plays hold music specified by class. If omitted, the default music source for the channel will be used. Change the default class with Set(CHANNEL(musicclass)=...). If duration is given, hold music will be played specified number of seconds. If duration is omitted, music plays indefinitely. Returns 0 when done, -1 on hangup.

This application does not automatically answer and should be proceeded by an application such as Answer() or Progress().

MusicOnHold(class,[duration])
  • class : class.
  • duration : time.

See also

NoOp

Do Nothing (No Operation).

This application does nothing. However, it is useful for debugging purposes.

This method can be used to see the evaluations of variables or functions without having any effect.

Syntax

NoOp([text])
  • text - Any text provided can be viewed at the Asterisk CLI.

Park

Call 을 Parking 한다.

Park([parking_lot_name][,options])
  • parking_lot_name - Call 이 parking 되는 parking lot 을 지정한다. parking lot 은 다음의 순서에 의해 지정된다.
parking_lot_name 에 지정된 값
${PARKINGLOT} variable
CHANNEL(parkinglot) function(channel driver 에 의해 미리 지정되어 있을 수도 있다).
Default parking lot.
  • options - parked 되는 콜에 대해 여러가지 옵션을 설정한다.
r: Parking 되는 콜에 MOH(Music on hold) 대신 Ringing 을 보낸다.
R: Parking 되는 장소(번호)를 Random 하게 지정한다.
s: Parking 되는 장소(번호)에 silence announcement 를 보낸다
c([[context,]extension,]priority): 만약 Parking 된 콜이 timeout 된 경우, 여기에 지정된 dialplan 으로 옮겨진다.
t(duration): 지정된 parking lot 에 설정된 timeout 대신, 여기에 설정된 duration 값을 timeout 으로 사용한다.

ParkedCall

Parked 된 콜을 가져온다.

ParkedCall([parking_lot_name,[parking_space]])
  • parking_lot_name - Parked 된 콜을 가져올 Parking lot name 을 지정한다. parking lot 은 다음의 순서에 의해 지정된다.
parking_lot_name 에 지정된 값.
${PARKINGLOT} variable
CHANNEL(parkinglot) function(channel driver 에 의해 미리 지정되어 있을 수도 있다).
Default parking lot.
  • parking_space - 지정된 parking lot 의 space 번호. 만약 지정하지 않는 다면, 가장 첫번째 parked call 을 가져온다.

ParkAndAnnounce

Call 을 parking 하고, default parking 메시지 대신, 지정된 안내 메시지를 play 한다.

ParkAndAnnounce([parking_lot_name,[options,announce:[announce1[:...]],]]dial)
  • parking_lot_name - Call 이 parking 되는 parking lot 을 지정한다. parking lot 은 다음의 순서에 의해 지정된다.
parking_lot_name 에 지정된 값.
${PARKINGLOT} variable
CHANNEL(parkinglot) function(channel driver 에 의해 미리 지정되어 있을 수도 있다).
Default parking lot.
  • options - parked 되는 콜에 대해 여러가지 옵션을 설정한다.
r: Parking 되는 콜에 MOH(Music on hold) 대신 Ringing 을 보낸다.
R: Parking 되는 장소(번호)를 Random 하게 지정한다.
s: Parking 되는 장소(번호)에 silence announcement 를 보낸다
c([[context,]extension,]priority): 만약 Parking 된 콜이 timeout 된 경우, 여기에 지정된 dialplan 으로 옮겨진다.
t(duration): 지정된 parking lot 에 설정된 timeout 대신, 여기에 설정된 duration 값을 timeout 으로 사용한다.
  • announce_template - 콜론(:)으로 나뉘어진 파일들 목록이다. 기본 콜이 parking 될 때 나오는 default parking lot announce message(say_digits) 를 대체한다.
announce1[,announce1...]
  • dial - The app_dial style resource to call to make the announcement. Console/dsp calls the console.

PauseQueueMember

지정한 멤버를 pause 한다.

PauseQueueMember([queuename,interface,[options,[reason]]])
  • queuename :
  • interface :
  • options :
  • reason : Is used to add extra information to the appropriate queue_log entries and manager events.

Channel variables

명령어 실행 후, 다음의 Channel variable 이 설정된다.

  • PQMSTATUS - The status of the attempt to pause a queue member as a text string.
PAUSED : Pause 성공.
NOTFOUND : 지정한 Queue/Member를 찾을 수 없음.

Example

exten => *72,1,Verbose(2,Pause Queue Member)
  same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
  same => n,PauseQueueMember(support,${MemberChannel})
  same => n,Verbose(1,${PQMSTATUS}); PAUSED, NOTFOUND
  same => n,Playback(dictate/paused)
  same => n,Hangup()

Playback

녹음된 파일을 재생한다.

별도의 옵션이 지정되어 있지 않다면, 자동적으로 Answer 를 수행한 후, 파일을 재생한다. 만약 지정된 파일에 문제가 있다면 실패한다.

Playback(filename&[filename2[&...]],[options])
  • filenames
filename
filename2[,filename2...]
  • options : 각각의 옵션들은 콤마(,) 로 구분된다.
skip : 콜이 Answer 되지 않았다면 play 하지 않는다.
noanswer : Answer 를 하지않고, play 한다. noanswer 옵션을 사용할 경우, playback 이전에 반드시 Answer 가 되어있어야 한다.

Channel variables

명령 실행 후, 다음의 Channel variable 이 설정된다.

  • PLAYBACKSTATUS : playback 시도에 대한 결과값이 저장된다.
SUCCESS: 성공
FAILED: 실패

See also

Progress

Indicate progress.

This application will request that in-band progress information be provided to the calling channel.

Progress()

See also

Queue

In addition to transferring the call, a call may be parked and then picked up by another user.

This application will return to the dialplan if the queue does not exist, or any of the join options cause the caller to not enter the queue.

This application does not automatically answer and should be preceeded by an application such as Answer(), Progress(), or Ringing().

Queue(queuename,[options,[URL,[announceoverride,[timeout,[AGI,[macro,[gosub,[rule,[position]]]]]]]]])
  • queuename
  • options
    • C - Mark all calls as "answered elsewhere" when cancelled.
    • c - Continue in the dialplan if the callee hangs up.
    • d - data-quality (modem) call (minimum delay).
    • F - When the caller hangs up, transfer the called member to the specified destination and start execution at that location.
      • context
      • exten
      • priority
    • F - When the caller hangs up, transfer the called member to the next priority of the current extension and start execution at that location.
    • h - Allow callee to hang up by pressing *.
    • H - Allow caller to hang up by pressing *.
    • n - No retries on the timeout; will exit this application and go to the next step.
    • i - Ignore call forward requests from queue members and do nothing when they are requested.
    • I - Asterisk will ignore any connected line update requests or any redirecting party update requests it may receive on this dial attempt.
    • r - Ring instead of playing MOH. Periodic Announcements are still made, if applicable.
    • R - Ring instead of playing MOH when a member channel is actually ringing.
    • t - Allow the called user to transfer the calling user.
    • T - Allow the calling user to transfer the call.
    • w - Allow the called user to write the conversation to disk via Monitor.
    • W - Allow the calling user to write the conversation to disk via Monitor.
    • k - Allow the called party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
    • K - Allow the calling party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
    • x - Allow the called user to write the conversation to disk via MixMonitor.
    • X - Allow the calling user to write the conversation to disk via MixMonitor.
  • URL - URL will be sent to the called party if the channel supports it.
  • announceoverride
  • timeout - Will cause the queue to fail out after a specified number of seconds, checked between each queues.conf timeout and retry cycle.
  • AGI - Will setup an AGI script to be executed on the calling party's channel once they are connected to a queue member.
  • macro - Will run a macro on the called party's channel (the queue member) once the parties are connected.
  • gosub - Will run a gosub on the called party's channel (the queue member) once the parties are connected.
Queued 된 채널이 called party(Queue member) 쪽의 채널과 연결될 경우, 지정된 context 를 gosub 로 실행한다.
  • rule - Will cause the queue's defaultrule to be overridden by the rule specified.
  • position - Attempt to enter the caller into the queue at the numerical position specified. 1 would attempt to enter the caller at the head of the queue, and 3 would attempt to place the caller third in the queue.

Channel variables

명령어 실행 후, 다음의 Channel variable 이 설정된다.

  • QUEUESTATUS - The status of the call as a text string.
TIMEOUT
FULL
JOINEMPTY
LEAVEEMPTY
JOINUNAVAIL
LEAVEUNAVAIL
CONTINUE

See also

RemoveQueueMeber

Queue 에서 멤버를 삭제한다(dynamically).

RemoveQueueMember(queuename,[interface])
  • queuename : Queue name.
  • interface : 삭제하고자 하는 멤버의 interface.

Channel variables

application 실행 이후, 실행 결과와 관련한 다음의 channel variable 을 설정한다.

  • RQMSTATUS - The status of the attempt to remove a queue member as a text string.
REMOVED : 삭제됨.
NOTINQUEUE : Queue 에 해당 멤버가 없음.
NOSUCHQUEUE : Queue 를 찾을 수 없음.
NOTDYNAMIC : Dynamic 멤버가 아님.

Example

exten => *56,1,Verbose(2,Logging Out Queue Member)
  same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
  same => n,RemoveQueueMember(support,${MemberChannel})
  same => n,Verbose(1,${RQMSTATUS}) ; REMOVED, NOTINQUEUE, NOSUCHQUEUE, NOTDYNAMIC
  same => n,Playback(agent-loggedoff)
  same => n,Hangup()

SIPAddHeader

outbound call 에 SIP header 를 추가한다.

Non-standard header 를 추가할 시, X-header 를 사용해야 한다. i.e X-Asterisk-Accountcode:contents

SIPAddHeader(Header:Content)
  • Header: Header 이름.
  • Content: Header 내용.

See also

Stasis

External stasis application 을 호출한다.

Invoke an external Stasis application.

Stasis(app_name,[args])
  • app_name: Name of the application to invoke.
  • args: Optional comma-delimmited arguments for the application invocation.

Channel variables

실행 이후, 다음의 Channel variable 을 설정한다.

  • STASISSTATUS: This indicate the status of the execution of the Stasis applicaiton.
SUCCESS: The channel has exited Stasis without any failures in Stasis.
FAILED: A failure occurred when executing the Stasis The app registry is not instantlated; The application. Some(not all) possible reasons for this: requested is no registered; The app requested is not active; Stasis couldn't send a start message.

See also

StopMonitor

Channel 의 모니터링을 중단한다.

만약 모니터링을 하지 않는 중이었어도 아무 영향을 주지 않는다.

StopMonitor()

See also

TIMEOUT

Gets or sets timeouts on the channel. Timeout values are in seconds.

The timeouts that can be manipulated are:

absolute : The absolute maximum amount of time permitted for a call. Setting of 0 disables the timeout.
digit : The maximum amount of time permitted between digits when the user is typing in an extension. When this timeout expires, after the user has started to tpe in an extension, the extension will be considered complete, and will be interpreted. Note that if an extension typed in is valid, it will not have to timeout to be tested, so typically at the expiry of this timeout, the extension will be considered invalid (and thus control would be passed to the i extension, or if it doesn't exit the call would be terminated). The default timeout is 5 seconds.
response : The maximum amount of the time permitted after falling through a series of priorities for a channel in which the user may begin typing an extension. If the user does not type an extension in this amount of time, control will pass to the extension if it exists, and if not the call would be terminated. The default timeout is 10 seconds.
TIMEOUT(timeouttype)
  • timeouttype : The timeout that will be manipulated. The possible timeout types(absolute, digit, response)

Example

[WaitsKeyPress]
 exten => s,1,Answer(${AnswerDelay})
  same => n,Set(TIMEOUT(digit)=2)

See also

UnpauseQueueMember

지정한 멤버를 unpause 한다.

UnpauseQueueMember([queuename,interface,[options,[reason]]])
  • queuename :
  • interface :
  • options :
  • reason : Is used to add extra information to the appropriate queue_log entries and manager events.

Channel variables

명령어 실행 후, 다음의 Channel variable 이 설정된다.

  • UPQMSTATUS : The status of the attempt to unpause a queue member as a text string.
UNPAUSED : unpaused 됨.
NOTFOUND : 지정한 Queue/Member 를 찾을 수 없음.

Example

exten => *87,1,Verbose(2,Unpause Queue Member)
  same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
  same => n,UnpauseQueueMember(support,${MemberChannel})
  same => n,Verbose(1,${UPQMSTATUS}); UNPAUSED, NOTFOUND
  same => n,Playback(agent-loginok)
  same => n,Hangup()

WaitExten

Waits for an extension to be entered.

This application watis for the user to enter a new extension for a specified of seconds.

Use of the applicatioin WaitExten within a macro will not function as expected. Please use the Read application in order to read DTMF from a channel currently executing a macro.

WaitExten([seconds, [options]])
  • seconds : Can be passed with fractions of a seconds. For example, 1.5 will ask the application to wait 1.5 seconds.
  • options
m(x) : Provide music on hold to the caller while waiting for an extension. x : Specify the class for music on hold. CHANNEL(musicclass) will be used instead if set.

Example

[NumberGet]
 exten => s,1,Set(TIMEOUT(digit)=2)
  same => n(Speak),Background(test/NumberGet)
  same => n,WaitExten(3)

See also

See also