<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/2041/1/7/_/styles/combined.css?spaceKey=AST&forWysiwyg=true" type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="https://wiki.asterisk.org/wiki/display/AST/Exploring+Sound+Prompts">Exploring Sound Prompts</a></h2>
<h4>Page <b>edited</b> by <a href="https://wiki.asterisk.org/wiki/display/~lmadsen">Leif Madsen</a>
</h4>
<div id="versionComment">
<b>Comment:</b>
Make dialplan pretty.<br />
</div>
<br/>
<h4>Changes (2)</h4>
<div id="page-diffs">
<table class="diff" cellpadding="0" cellspacing="0">
<tr><td class="diff-snipped" >...<br></td></tr>
<tr><td class="diff-unchanged" > <br>Now let's put *Answer()*, *Playback()*, and *Hangup()* together to play a sample sound file. Place this extension in your *\[docs:users\]* context: <br></td></tr>
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code:lang=javascript}exten=>6000,1,Answer(500) <br>exten=>6000,2,Playback(hello-world) <br>exten=>6000,3,Hangup(){code} <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">{code:lang=javascript}exten => 6000,1,Answer(500) <br>exten => 6000,n,Playback(hello-world) <br>exten => 6000,n,Hangup(){code} <br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<p>Asterisk comes with a wide variety of pre-recorded sound prompts. When you install Asterisk, you can choose to install both core and extra sound packages in several different file formats. Prompts are also available in several languages. To explore the sound files on your system, simply find the sounds directory (this will be <b>/var/lib/asterisk/sounds</b> on most systems) and look at the filenames. You'll find useful prompts ("Please enter the extension of the person you are looking for..."), as well as as a number of off-the-wall prompts (such as "Weasels have eaten our phone system", "The office has been overrun with iguanas", and "Try to spend your time on hold not thinking about a blue-eyed polar bear") as well.</p>
<p></p>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Sound Prompt Formats</b><br />Sound prompts come in a variety of file formats, such as <b>.wav</b> and <b>.ulaw</b> files. When asked to play a sound prompt from disk, Asterisk plays the sound prompt with the file format that can most easily be converted to the CODEC of the current call. For example, if the inbound call is using the <b>alaw</b> CODEC and the sound prompt is available in <b>.gsm</b> and <b>.ulaw</b> format, Asterisk will play the <b>.ulaw</b> file because it requires fewer CPU cycles to transcode to the <b>alaw</b> CODEC.<br/>
You can type the command <b>core show translation</b> at the Asterisk CLI to see the transcoding times for various CODECs. The times reported (in Asterisk 1.6.0 and later releases) are the number of microseconds it takes Asterisk to transcode one second worth of audio. These times are calculated when Asterisk loads the codec modules, and often vary slightly from machine to machine. To perform a current calculation of translation times, you can type the command <b>core show translation recalc 60</b>.</td></tr></table></div>
<p><b>How Asterisk Searches for Sound Prompts Based on Channel Language</b></p>
<p>Each channel in Asterisk can be assigned a language by the channel driver. The channel's language code is split, piece by piece (separated by underscores), and used to build paths to look for sound prompts. Asterisk then uses the first file that is found.</p>
<p>This means that if we set the language to en_GB_female_BT, for example, Asterisk would search for files in:</p>
<p>.../sounds/en/GB/female/BT</p>
<p>.../sounds/en/GB/female</p>
<p>.../sounds/en/GB</p>
<p>.../sounds/en</p>
<p>.../sounds</p>
<p>This scheme makes it easy to add new sound prompts for various language variants, while falling back to a more general prompt if there is no prompt recorded in the more specific variant.</p>
<p>The <b>Hangup()</b> application hangs up the current call. While not strictly necessary due to auto-fallthrough (see the note on Priority numbers above), in general we recommend you add the <b>Hangup()</b> application as the last priority in any extension.</p>
<p>Now let's put <b>Answer()</b>, <b>Playback()</b>, and <b>Hangup()</b> together to play a sample sound file. Place this extension in your <b>[docs:users]</b> context:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<script type="syntaxhighlighter" class="toolbar: false; theme: Confluence; brush: javascript; gutter: false"><![CDATA[exten => 6000,1,Answer(500)
exten => 6000,n,Playback(hello-world)
exten => 6000,n,Hangup()]]></script>
</div></div>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;">
<a href="https://wiki.asterisk.org/wiki/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
</div>
<a href="https://wiki.asterisk.org/wiki/display/AST/Exploring+Sound+Prompts">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=4817435&revisedVersion=7&originalVersion=6">View Changes</a>
|
<a href="https://wiki.asterisk.org/wiki/display/AST/Exploring+Sound+Prompts?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>