Asterisk cmd Playtones

Synopsis

Play a tone list

Description

Playtones(tonename)
Playtones(tonelist)

Plays a tone list, either the tone named tonename defined in the indications.conf file, or a directly specified tonelist of frequencies and durations. See indications.conf for a description of the specification of a tonelist.

Execution will continue with the next step immediately, while the tones continue to play. Use StopPlaytones to stop the tones playing. In this way, it is similar to the Background command, which plays a given sound file "in the background".
A leading exclamation point in front of each play-item causes it not to be repeated.

Like Background, if Playtones is active when execution reaches the highest-priority command defined in for the extension, then the sound will continue to play until either the user dials an extension, or ResponseTimeout seconds passes, triggering Asterisk to jump to the 't' extension, if there is one defined in this context, or to the h extension (hangup) if there isn't.

Playing tones while dialling


If you want tones to play when Dial()ing, make sure to use the & Dial() syntax — otherwise tones will stop as soon as the Dial() command is reached. If you only have one channel to dial to, make a dummy one, like so:

[dialout]
exten => _X.,1,Answer()
; play tones to give the caller some feedback
exten => _X.,n,Playtones(425/50,0/50)
; no-op here so that tones continue until we've actually reached the SIP peer
exten => _X.,n,Dial(SIP/${EXTEN}@sip.example.com&Local/s@no-op)

[no-op]
; just hang up
exten => s,1,Hangup(21)

Examples

;testing playtones
exten => 209,1,Answer
exten => 209,2,Playtones(congestion)
; Tones will play until timeout or user dials a different extension

exten => 264,1,Answer
exten => 264,2,Wait(1)
exten => 264,3,Playtones(!950/330,!1400/330,!1800/330,0)
exten => 264,4,Wait(5)
exten => 264,5,StopPlaytones
exten => 264,6,Wait(2)
exten => 264,7,Playback(beep)
exten => 264,8,Hangup

Example 2

Especially useful for the s extension:
exten => s,1,Answer
exten => s,2,Playtones(dial)
;use DigitTimeout previous to Asterisk 1.2
exten => s,3,Set(TIMEOUT(digit)=5)
exten => s,4,WaitExten(60)

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Synopsis

Play a tone list

Description

Playtones(tonename)
Playtones(tonelist)

Plays a tone list, either the tone named tonename defined in the indications.conf file, or a directly specified tonelist of frequencies and durations. See indications.conf for a description of the specification of a tonelist.

Execution will continue with the next step immediately, while the tones continue to play. Use StopPlaytones to stop the tones playing. In this way, it is similar to the Background command, which plays a given sound file "in the background".
A leading exclamation point in front of each play-item causes it not to be repeated.

Like Background, if Playtones is active when execution reaches the highest-priority command defined in for the extension, then the sound will continue to play until either the user dials an extension, or ResponseTimeout seconds passes, triggering Asterisk to jump to the 't' extension, if there is one defined in this context, or to the h extension (hangup) if there isn't.

Playing tones while dialling


If you want tones to play when Dial()ing, make sure to use the & Dial() syntax — otherwise tones will stop as soon as the Dial() command is reached. If you only have one channel to dial to, make a dummy one, like so:

[dialout]
exten => _X.,1,Answer()
; play tones to give the caller some feedback
exten => _X.,n,Playtones(425/50,0/50)
; no-op here so that tones continue until we've actually reached the SIP peer
exten => _X.,n,Dial(SIP/${EXTEN}@sip.example.com&Local/s@no-op)

[no-op]
; just hang up
exten => s,1,Hangup(21)

Examples

;testing playtones
exten => 209,1,Answer
exten => 209,2,Playtones(congestion)
; Tones will play until timeout or user dials a different extension

exten => 264,1,Answer
exten => 264,2,Wait(1)
exten => 264,3,Playtones(!950/330,!1400/330,!1800/330,0)
exten => 264,4,Wait(5)
exten => 264,5,StopPlaytones
exten => 264,6,Wait(2)
exten => 264,7,Playback(beep)
exten => 264,8,Hangup

Example 2

Especially useful for the s extension:
exten => s,1,Answer
exten => s,2,Playtones(dial)
;use DigitTimeout previous to Asterisk 1.2
exten => s,3,Set(TIMEOUT(digit)=5)
exten => s,4,WaitExten(60)

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: oej, Last modification: Tue 04 of Sep, 2012 (12:56 UTC) by JustRumours
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+