{"componentChunkName":"component---src-templates-page-js","path":"/notes/intro-to-the-asterisk-dialplan-phoneoke/","result":{"data":{"markdownRemark":{"html":"<p>In <a href=\"http://www.itp-redial.com/class/\">Redial</a>, we’ve started working with Asterisk to create our own phone systems. In class, we share a common phone number and each have our own extension, which, when dialed, runs our code. After looking through the <a href=\"http://www.voip-info.org/wiki/view/Asterisk+-+documentation+of+application+commands\">available Asterisk commands</a>, I decided I wanted to have the caller record their voice and have Asterisk play it back, except mixed with a backing track (in this case, the chorus to <a href=\"https://www.youtube.com/watch?v=8WEtxJ4-sh4\">TLC’s Waterfalls</a>). Here’s what that sounds like (with apologies to TLC):</p>\n<p><audio id=\"wp\\_mep\\_1\" src=\"/img/uploads/2013/02/documentation.mp3\" controls=\"controls\" preload=\"none\" > </audio></p>\n<p>After the caller records his voice, I use Asterisk’s <code class=\"codecolorer text default\">&#x3C;span class=\"text\">System</code> command to run <a href=\"http://sox.sourceforge.net/\">SoX</a>, a command line tool that mixes the caller’s voice with the backing track and converts it to the correct format for playback. A few issues I ran in to concerning playback:</p>\n<ul>\n<li>Asterisk’s <code>Playback</code> command requires no file extension on the end. I was adding .wav and this caused errors.</li>\n<li>Despite both the caller’s recording and my backing track being in the correct format for playback, the mixed file wasn’t and playback would fail. After mixing the files with <code>sox -m /path/to/file1.wav /path/to/file2.wav /path/to/mix.wav</code>, I then had to run <code>sox /path/to/mix.wav -t raw -r 8000 -e signed-integer -b 16 -c 1 /path/to/remix.sln</code> to ensure that the audio file’s properties met Asterisk’s requirements (8000 Hz, 16 bit, etc). Those two commands could probably be combined into one and I will look in to that as this project continues.</li>\n</ul>\n<p>Since the application will probably be short-lived as I continue to experiment with it, I’m going to leave the phone number and extension out of this post and save it for later (though you can probably find it by following the right links…).</p>","frontmatter":{"path":"/notes/intro-to-the-asterisk-dialplan-phoneoke/","title":"Intro to the Asterisk dialplan: Phoneoke","date":"2013-02-11T17:46:25.000Z","categories":["Redial","Asterisk","ITP"],"churl":null,"uses":null}}},"pageContext":{"post":true,"prev":{"url":"/notes/video-feedback-with-skype-screen-sharing/","title":"Video feedback with Skype screen sharing"},"next":{"url":"/notes/data-rep-pineapples/","title":"Data Rep: Pineapples"}}}}