{ |one, step, back| } http://www.onestepback.org/index.cgi Jim Weirich's Blog en-us { |one, step, back| } http://onestepback.org http://onestepback.org/images/jwface.gif The Adhearsion Demo From Mountain West Ruby Conf http://www.onestepback.org/index.cgi/Tech/Adhearsion/TheAdhearsionDemo.red <p style="padding-left:3em;"><em>Try Jay&#8217;s demo at home.</em></p> <h2>Jay Phillip&#8217;s Adhearsion Demo at the Moutain West Ruby Conf</h2> <p>Jay Phillip&#8217;s talk at <span class="caps">MWRC</span> attempted to get the audience involved in actually running an Adhearsion demo on their own laptops. Unfortunately, the demo at <span class="caps">MWRC</span> was plagued with firewall and network problems, but eventually I was able to get it working. Here are the steps needed.</p> <p>Go ahead, try this at home. It&#8217;s a lot of fun.</p> <h3>Step 1&#8212;Sign up for an Adhearsion account.</h3> <p>You can do that here: <a href="http://adhearsion.com/signup">http://adhearsion.com/signup</a></p> <p>You will need a skype account to complete the sign-up. After signing up, you should get an email with a link that you need to click before your account is activated. Go ahead and activate the account now.</p> <h3>Step 2&#8212;Install the Adhearsion Gem</h3> <p>Run:</p> <pre> gem install adhearsion </pre> <p>I&#8217;m running the 0.8.2 version of the gem.</p> <h3>Step 3&#8212;Create an Adhearsion project</h3> <p>Run:</p> <pre> ahn create project_name </pre> <h3>Step 4&#8212;Enable the Sandbox</h3> <p>Run:</p> <pre> cd project_name ahn enable component sandbox </pre> <h3>Step 5&#8212;Edit Your Credentials</h3> <p>Edit the file: <tt>components/sandbox/sandbox.yml</tt> and update the username and password you used when you created the Adhearsion account in step 1.</p> <h3>Step 6&#8212;Create a Dial Plan for the Sandbox</h3> <p>Edit the <tt>dialplan.rb</tt> file to contain the following:</p> <pre class="ruby-code"> adhearsion { simon_game } sandbox { play "hello-world" } </pre> <p>The adhearsion section should alread be in the file. You will be adding the sandbox section.</p> <h3>Step 7&#8212;Star the Adhearsion Server</h3> <p>Run:</p> <pre> cd .. ahn start project_name </pre> You should see: <pre> INFO ahn: Adhearsion initialized! </pre> <p>Errors at this stage might mean that your adhearsion account isn&#8217;t setup properly, you don&#8217;t have the right user name and password (in step 5), or that you have firewall issues preventing you from connecting to the Adhearsion server.</p> <h3>Step 8&#8212;Call The Sandbox</h3> <p>Using Skype, call the Skype user named <b>sandbox.adhearsion.com</b>. You should hear a hello world message.</p> <h3>Step 9&#8212;Change the Dial Plan</h3> <p>Just for fun, change the <tt>dialplan.rb</tt> file to contain:</p> <pre class="ruby-code"> adhearsion { simon_game } sandbox { play "hello-world" play "tt-monkeys" } </pre> <p>(Add the tt-monkeys line to the sandbox dial plan).</p> <p>Now call the sandbox again (skyping user sandbox.adhearsion.com) to hear the change in the dial plan. Monkeys <span class="caps">FTW</span>.</p> <h3>More Examples</h3> <p>Here&#8217;s a example of what can be done in a dial plan. I was just goofing around with my dial plan.</p> <pre> adhearsion { simon_game } sandbox { play "vm-enter-num-to-call" digits = input 1, :timeout =&gt; 10.seconds case digits when '1' play "hello-world" when '2' play "tt-monkeys" when '3' play "what-are-you-wearing" when '4' play 'conf-unmuted' when '5' play 'tt-weasels' when '6' play "pbx-invalidpark" when '7' play "1000", "dollars" when '8' play "followme/sorry" when '9' simon_game when '0' play Time.now else play "demo-nomatch" end sleep 1 play "demo-thanks" } </pre> <p>See <a href="http://adhearsion.com/examples">http://adhearsion.com/examples</a> for more dialplan examples.</p> <h2>That&#8217;s It</h2> <p>Think about what you are doing. You are calling the Adhearsion server and controlling how that remote server responds by the adhearsion program running on your own local box. That is wild.</p> <p>The adhearsion sandbox makes it easy to play around with telephony programming without any investment in the associated hardware.</p> <p>I hope this demo encourages you to give Adhearsion a try.</p>