• News
  • Idefisk
  • Tools
  • Tutorials
  • Forum
  • Reviews
  • VoIP Providers
  • Archives
  • Gallery
ZOIPER SIP softphone
Back to Tutorials

6.1.2.58. Playback (dialplan application)

1. Playback - this application allows you to play a sound file.

NOTE: This application is valid for Asterisk version 1.0.9 and above.

 


Syntax:

Playback(filename[|option])

 


List with the possible options

skip - with this option the sound file will be played only if the channel has already been answered. In other words this option will turn off the built-in Answer application
noanswer - This option is the opposite of the skip one. With this option the sound file will be played before the channel is answered. First play the sound file then answers.

 


Purpose and usage

With this application you can play a sound file.

We will show you a simple example below.

 


Prerequisites

To use this application you need a working Asterisk PBX with registered users in iax.conf, sip.conf or mgcp.conf(It depends on which protocol you would like to use) and made extensions.

To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.

 


Asterisk PBX configurations

NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.

We need two registered users in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.



So, we have registered the users anatoliy and user1

Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.



On the picture above you can see our extensions.conf file.

We want to show you the Playback application with its option skip. So, as we have mentioned before, this option will turn off the built-in Answer application. In this case if we want to hear our sound file, we have to add an extension for answering the call. If we do not use the option skip, we can omit the extension for answering.

About the sound files - the directory where the application will try to find the files by default is /var/lib/asterisk/sounds. It cannot be changed.

So, in our example when somebody dials 222, the call will be answered by the Answer application. Then the caller will hear the sound file. In our example the caller will hear trading desk. Then the call will be connected to the user user1 through the IAX2 channel.

NOTE: Please, pay attention that the name of the sound file is written without the extension. For example: You have to write trading-desk, not trading-desk.gsm

If you use the skip option and do not add an extension for answering, then when somebody dials 222 the call will be directly connected to the user anatoliy through the IAX2 channel, but the caller won’t hear the message trading desk.

If the caller enters an invalid or non-existing extension then the next executed extension will be the special extension i (invalid extension). If such one does not exist - the line will be hung up.

 


2. Screenshots of what you can see on the CLI of the Asterisk PBX



 


3. Additional information

For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.

This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.

If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX

 


4. Similar dialplan applications

BackgroundDetect()
Background()
Playtones()
Playtones()
MP3Player()

 

 
User Comments
Tom Silver (xsilver at skynet dot cz)
17 March 2006 10:48:08
I have a problem with awful sound quality.
When I use Playback or Backround with a same file as I'm using for music-on-hold, the quality of sound is very very different .. almost terrible. Instead of situation when its played wia MoH .. where the same file is played ok.
Q: where is the problem ?
Q: I'm using chan_oos, helps me using chan_alsa ??
Jessie (jesster at jesster dot org)
05 January 2006 20:08:02
I don't think Playback on a Zap/PRI channel is correctly setup to send audio with the noanswer bit set. I've tried noanswer and skip but I still show answer being set on the PRI.

 
Add Comment
Name:
Email:
Comment:
In order to prevent automatic posting on our website, we kindly request you to type in the number you see in the picture below.
Image Verification:
 

Latest Headlines:

  • T.38 faxing with Zoiper 2.15 is now easier than ever
    section: voip software
  • Asterisk 1.4.21 Released
    section: Asterisk
  • Asterisk 1.4.20 Released
    section: Asterisk
  • Asterisk 1.4.20-rc2 Released
    section: Asterisk
  • Asterisk 1.4.20-rc1 Now Available
    section: Asterisk
  • News Archives (older news)

Latest Tutorials:

  • VMAuthenticate (dialplan application)
    added 01/Mar/2008 15:57
  • Siptronic ST-530
    added 06/Nov/2007 17:57
  • Siemens C455 IP hardphone
    added 05/Nov/2007 10:24
  • Zoiper
    added 22/Oct/2007 17:53
  • Grandstream GXP-2020
    added 15/Oct/2007 18:17

Latest Comments:

  • I have download X-LITE but strangely , w...
    tutorial: X-Lite - SIP softphone
  • Hello i can receive a call from outside ...
    tutorial: X-Lite - SIP softphone
  • Hello, we are Howking Technology Co. Ltd...
    section: technology
  • msneyi açmak istiyorum...
    tutorial: Microsoft Windows Messenger 5.1
  • i just install X lit and i dont know how...
    tutorial: X-Lite - SIP softphone
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™