Asterisk拨号方案常用函数说明 (1)Answer()
应用于接听正在响铃通道,它不需要任何参数.
(2)Playback()
应用在通道上播放事先录制好的语音文件.指定一个文件名(不带扩展名),可以使用绝对路径与相对路径.
(3)Hangup()
应用在于挂断一个正在活动的通道.
(4)Background()
它也播放事先录制好的语音文件,但它等待按键,然后执行对应extension.防止Background()后超出按键范围,使用i来解决问题.防止Background长时间没有选择,使用t来决解问题.
(5)Goto()
Goto应用使得在拨号方案的不同部分有序的转移非常容易. Goto()应用有三个参量分别是context,extension,和priority.即Goto(context,extension,priority)
(6)Dial() Dial()有4个参数.
(a)第一个是:呼叫的被叫地.如:SIP/50000或Zap/1.可以同时拨打多个通道如: exten => 601,1,Dial(Zap/1&SIP/50000&IAX/60000)
(b)第二个是:超时,单位\秒\给定超时参量Dial会一直对被叫地进行呼叫,直到超时后才放弃,如果没有给定,将直到接听或主叫挂机,如果呼叫在超时前接听,通道就被桥接,拨号完。成补充:如果超时后被叫地没有应答,则会继续Dial()的extension下一个priority.如果被叫地通道忙,Dial()将转到priority n+101(n是Dial()被调用的priority),如果存在的话,将能够处理被叫地忙的方式接叫未接电话. (c)第三个是:可选择参量,它会可以影响到Dial()的行为,如: exten =>
601,1,Dial(SIP/50000,30,Ttwr) 其中T表示允许主叫用户按\转接呼叫;t表示允许被叫用户按\转接呼叫;r表示为被叫用户产生振铃声;w用户按\键开始录音 (d)最后一个是:URL参量.如: exten =>
601,1,Dial([email=SIP/60000@asterisk.voip.org]SIP/60000@asterisk.voip.org[/email]) exten => 602,1,Dial(Zap/1/5732381) 任何参量都可以为空如: exten => 601,1,Dial(SIP/60000,,T) 或 exten => 601,1,Dial(SIP/60000)
AddQueueMember: Dynamically adds queue members
ADSIProg: Load Asterisk ADSI Scripts into phone AGI: Executes an AGI compliant application AMD: Attempts to detect answering machines Answer: Answer a channel if ringing AppendCDRUserField: Append to the CDR user field Authenticate: Authenticate a user
BackGround: Play an audio file while waiting for digits of an extension to go to. BackgroundDetect: Background a file with talk detect Busy: Indicate the Busy condition
ChangeMonitor: Change monitoring filename of a channel ChanIsAvail: Check channel availability
ChannelRedirect: Redirects given channel to a dialplan target.
ChanSpy: Listen to a channel, and optionally whisper into it Congestion: Indicate the Congestion condition ContinueWhile: Restart a While loop
ControlPlayback: Play a file with fast forward and rewind DAHDIBarge: Barge in (monitor) DAHDI channel DAHDIRAS: Executes DAHDI ISDN RAS application DAHDIScan: Scan Zap channels to monitor calls
DAHDISendKeypadFacility: Send digits out of band over a PRI
DateTime: Says a specified time in a custom format DBdel: Delete a key from the database
DBdeltree: Delete a family or keytree from the database DeadAGI: Executes AGI on a hungup channel
Dial: Place a call and connect to the current channel Dictate: Virtual Dictation Machine
Directory: Provide directory of voicemail extensions DISA: DISA (Direct Inward System Access) DumpChan: Dump Info About The Calling Channel EAGI: Executes an EAGI compliant application
Echo: Echo audio, video, or DTMF back to the calling party EndWhile: End a while loop
Exec: Executes dialplan application
ExecIf: Executes dialplan application, conditionally
ExecIfTime: Conditional application execution based on the current time ExitWhile: End a While loop
ExtenSpy: Listen to a channel, and optionally whisper into it ExternalIVR: Interfaces with an external IVR application Flash: Flashes a DAHDI trunk ForkCDR: Forks the Call Data Record GetCPEID: Get ADSI CPE ID
Gosub: Jump to label, saving return address
GosubIf: Conditionally jump to label, saving return address Goto: Jump to a particular priority, extension, or context GotoIf: Conditional goto
GotoIfTime: Conditional Goto based on the current time Hangup: Hang up the calling channel
HasNewVoicemail: Conditionally branches to priority + 101 with the right options set HasVoicemail: Conditionally branches to priority + 101 with the right options set IAX2Provision: Provision a calling IAXy with a given template ICES: Encode and stream using 'ices'
ImportVar: Import a variable from a channel into a new variable Log: Send arbitrary text to a selected log level
LookupBlacklist: Look up Caller*ID name/number from blacklist database LookupCIDName: Look up CallerID Name from local database Macro: Macro Implementation
MacroExclusive: Exclusive Macro Implementation MacroExit: Exit From Macro
MacroIf: Conditional Macro Implementation MailboxExists: Check to see if Voicemail mailbox exists MeetMe: MeetMe conference bridge
MeetMeAdmin: MeetMe conference Administration MeetMeCount: MeetMe participant count
Milliwatt: Generate a Constant 1004Hz tone at 0dbm (mu-law) MixMonitor: Record a call and mix the audio during the recording Monitor: Monitor a channel Morsecode: Plays morse code
MP3Player: Play an MP3 file or stream
MusicOnHold: Play Music On Hold indefinitely NBScat: Play an NBS local stream
NoCDR: Tell Asterisk to not maintain a CDR for the current call NoOp: Do Nothing Page: Pages phones Park: Park yourself
ParkAndAnnounce: Park and Announce ParkedCall: Answer a parked call
PauseMonitor: Pause monitoring of a channel PauseQueueMember: Pauses a queue member Pickup: Directed Call Pickup Playback: Play a file PlayTones: Play a tone list
PrivacyManager: Require phone number to be entered, if no CallerID sent Progress: Indicate progress
Queue: Queue a call for a call queue QueueLog: Writes to the queue_log
Random: Conditionally branches, based upon a probability Read: Read a variable
ReadFile: ReadFile(varname=file,length) RealTime: Realtime Data Lookup RealTimeUpdate: Realtime Data Rewrite Record: Record to a file
RemoveQueueMember: Dynamically removes queue members ResetCDR: Resets the Call Data Record
RetryDial: Place a call, retrying on failure allowing optional exit extension. Return: Return from gosub routine Ringing: Indicate ringing tone SayAlpha: Say Alpha SayDigits: Say Digits
SayNumber: Say Number SayPhonetic: Say Phonetic
SayUnixTime: Says a specified time in a custom format SendDTMF: Sends arbitrary DTMF digits SendImage: Send an image file SendText: Send a Text Message SendURL: Send a URL
Set: Set channel variable(s) or function value(s) SetAMAFlags: Set the AMA Flags
SetCallerID: Set CallerID
SetCallerPres: Set CallerID Presentation SetCDRUserField: Set the CDR user field
SetGlobalVar: Set a global variable to a given value SetMusicOnHold: Set default Music On Hold class SetTransferCapability: Set ISDN Transfer Capability
SIPAddHeader: Add a SIP header to the outbound call SIPDtmfMode: Change the dtmfmode for a SIP call SLAStation: Shared Line Appearance Station SLATrunk: Shared Line Appearance Trunk
SMS: Communicates with SMS service centres and SMS capable analogue phones
SoftHangup: Soft Hangup Application SpeechActivateGrammar: Activate a Grammar
SpeechBackground: Play a sound file and wait for speech to be recognized SpeechCreate: Create a Speech Structure SpeechDeactivateGrammar: Deactivate a Grammar SpeechDestroy: End speech recognition SpeechLoadGrammar: Load a Grammar
SpeechProcessingSound: Change background processing sound SpeechStart: Start recognizing voice in the audio stream SpeechUnloadGrammar: Unload a Grammar
StackPop: Remove one address from gosub stack StartMusicOnHold: Play Music On Hold
StopMixMonitor: Stop recording a call through MixMonitor StopMonitor: Stop monitoring a channel StopMusicOnHold: Stop Playing Music On Hold StopPlayTones: Stop playing a tone list
System: Execute a system command TestClient: Execute Interface Test Client TestServer: Execute Interface Test Server
Transfer: Transfer caller to remote extension
TryExec: Executes dialplan application, always returning TrySystem: Try executing a system command UnpauseMonitor: Unpause monitoring of a channel UnpauseQueueMember: Unpauses a queue member
UserEvent: Send an arbitrary event to the manager interface Verbose: Send arbitrary text to verbose output VMAuthenticate: Authenticate with Voicemail passwords VoiceMail: Leave a Voicemail message VoiceMailMain: Check Voicemail messages Wait: Waits for some time
WaitExten: Waits for an extension to be entered WaitForRing: Wait for Ring Application