Asterisk built-in cmd

Asterisk built-in cmd (function)

 


Answer([milliseconds ])

Answer a channel if ringing.

Some dial plan functions - mostly those that conceivably entail a two-way communication path
( imply Answer() and will execute it for you if you have not already done so. )

Usage:

Answer([delay])


NoOp()

No-operation; Does nothing. This application is often used as a debugging tool.
Asterisk’s core verbosity level is set to 3 or above

* Asterisk prints everything to the console if your verbosity level is three or higher

Usage:

NoOp(text)

 


Verbose()

 

the first parameter is the minimum verbosity level at which to print the message

the second parameter is the message to print.

exten=>6123,1,Verbose(2,The channel name is ${CHANNEL})

 


Answer() 及 NoOp() 一起的 Example

 

    exten => s,1,Answer
    ; This works with any variable, so NoOp(${any_var_name}) will print on the console.
    exten => s,2,NoOp(CallerID is ${CALLERID})

 


MusicOnHold()

musiconhold.conf

Remember to Answer before letting the music pour down the line.
Otherwise music on hold will not work correctly.

Usage

MusicOnHold(class[,duration])

Example

exten => 6000,1,Answer
exten => 6000,2,MusicOnHold()

Install

apt-get install asterisk-moh-opsound-wav

  • /usr/share/asterisk/moh/reno_project-system.wav
  • /usr/share/asterisk/moh/macroform-the_simplicity.wav
  • /usr/share/asterisk/moh/macroform-robot_dity.wav
  • /usr/share/asterisk/moh/macroform-cold_day.wav
  • .................
     

SayXXX

 

SayNumber(number, gender)

Gender is one of

- "f" female

- "m" male

- "c" common/neuter

Example:

SayNumber(123,f) ; Says "one hundred and twenty three"

SayDigits(digits)

 

Example

SayDigits(123) ; Says "one two three"

SayAlpha(string)

Examples

SayAlpha(abc123) ; Says "a b c one two three"

 


Hangup(<causecode>)

 

This application hangs up the calling channel unconditionally and returns -1
 


Playback(filename1[&filename2...][,options])

 

# you need to omit the filename extension
# Sound files are stored in the
# - /var/lib/asterisk/sounds
# - /usr/share/asterisk/sounds

Background command, which plays a sound file but returns control immediately, allowing Asterisk to perform other commands on this channel while the sound file is playing.

 


CALLERID(<item>)

 

item:

-name: alphanumeric string

i.e.

exten => _5XX,1,NoOp("Caller ID IS: ${CALLERID(number)}")

 


Busy([timeout])

 

; This command waits for the user to hang up unless the optional timeout