Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd Playtones

Author image

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 Asterisk cmd 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


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.