I have configured asterisk but i could not understand the audio files it supports like gsm which is not playing in any player.
i have sounds installed at /usr/share/asterisk/sounds directory all of them are *.gsm . I have added few sounds at /usr/share/asterisk/sounds/tts and given path in extensions.conf as shown below
gsm is supported by sox, the standard command line player for LInux! It is also supported by Windows Media Player, but only if wrapped up as as wav file (Asterisk wav49 or WAV). sox considers slin and slin16 as raw, but can play them, if you provide the right parameters. They have to be wrapped as wav for Media Player, but both are very standard when that is done.
Although there is support for exernal MP3 feeds, for music on hold, MP3 so far exceeds telephone sound quality (which is optimised for speech only) that it is not sensible to use it for static sound files or recording calls. For patent reasons, mp3 needs to be handled by an external program or pre-converted.
Most people should have their sound files in slin (or wav - 16 bit, linear, 8kHz, mono), together with any low bit rate codecs that they actually use (e.g. g.729, and gsm). The latter because converting these from other formats is expensive in CPU time.
au is also supported by SOX and has in built support in the kernel sound card drivers. However, as it is G.711 mu-law with minimal headers, and linear to mu-law is a low cost conversion, it is probably not worth storing in that format.
NB The extension should never be given in commands like Playback; Asterisk selects the extension so as to minimise the cost of converting the file to a codec in use by the call.
Knowing which codecs are available for use is a rather important part of configuring a VoIP system.
You stated you added sounds in /usr/share/asterisk/sounds/tts, yet in the Background() call, you reference /var/lib/asterisk/sounds/tts/demo. If you specify the absolute pathname (starts with a /), then Asterisk will always look in the specified directory. As David55 said, never put the file extension on the command, Aserisk will search for the best file to play of all available files.
By default, Asterisk will look for sound files in /var/lib/asterisk/sounds//. If you call for a sound file with a relative pathname (does not start with a /), Asterisk will look in it’s default directory. In the case of your example Playback(digits/1), Asterisk found a the under /var/lib/asterisk/sounds//digits/ and probably played 1.gsm.
If you are adding your own sounds, you could create a sub-directory under /var/lib/asterisk/sounds/ or another common practice would be to create a sounds directory under a different directory structures, perhaps /usr/local/asterisk/sounds/yourapp. Then within the dialplan, you can make a call like…