Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 503 lines (386 sloc) 22.228 kB
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=shift_jis">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="RAGI%20Overview_files/filelist.xml">
<link rel=Edit-Time-Data href="RAGI%20Overview_files/editdata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>RAGI OVERVIEW</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="date"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="stockticker"/>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Compatibility>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if !mso]><object
classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:宋体;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"MS Pゴシック";
panose-1:2 11 6 0 7 2 5 8 2 4;
mso-font-charset:128;
mso-generic-font-family:modern;
mso-font-pitch:variable;
mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
@font-face
{font-family:"\@MS Pゴシック";
panose-1:2 11 6 0 7 2 5 8 2 4;
mso-font-charset:128;
mso-generic-font-family:modern;
mso-font-pitch:variable;
mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:Arial;
mso-fareast-font-family:"MS Pゴシック";
mso-fareast-language:JA;}
p.MsoDate, li.MsoDate, div.MsoDate
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:Arial;
mso-fareast-font-family:"MS Pゴシック";
mso-fareast-language:JA;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"MS Pゴシック";
mso-fareast-language:JA;}
p
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"MS Pゴシック";
mso-bidi-font-family:"MS Pゴシック";
mso-fareast-language:JA;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 65.95pt 1.0in 65.95pt;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1031"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
<div class=Section1>
<p class=MsoPlainText><b><span style='font-size:20.0pt;font-family:Arial'>RAGI
OVERVIEW</span></b></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Ruby Asterisk Gateway
Interface (RAGI)</span></b><span style='font-family:Arial'> is a useful
open-source framework for bridging the Ruby on Rails web application server
environment and Asterisk, the open-source PBX. </span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>RAGI eases the
development of interactive automated telephony applications such as IVR, call
routing, automated call center, and extended IP-PBX functionality by leveraging
the productivity of the Ruby on Rails framework.&nbsp; RAGI simplifies the
process of creating rich telephony and web apps with a single common web
application framework, object model and database backend.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>RAGI is available under
the BSD license.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>To get RAGI, please visit
the <a href="http://rubyforge.org/projects/ragi/">RAGI pages on RubyForge</a>,
or use “gem install ragi”.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>Also, please reference the
SnapVine developer site at <a href="http://www.snapvine.com/code/ragi/">http://www.snapvine.com/code/ragi/</a>
or use “gem install ragi”.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-size:14.0pt;font-family:Arial'>Class
Overview<o:p></o:p></span></b></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><span style='font-family:Arial'>The most important
classes in RAGI to an application developer are callConnection, callHandler and
callInitiate.&nbsp; These three classes provide everything you need to create
interactive phone applications in Asterisk using Ruby.&nbsp; The other classes
provide runtime support and test facilities.&nbsp; </span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>This section provides a
high level overview of each class in RAGI.&nbsp; Detailed </span><st1:stockticker><span
style='font-family:Arial'>API</span></st1:stockticker><span style='font-family:
Arial'> documentation is (or will be) located in the source files for each
class.&nbsp; Usage examples are provided in other sections of this document and
in accompanying sample code.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>call_connection.rb </span></b><span
style='font-family:Arial'>&#8211; this class provides a Ruby </span><st1:stockticker><span
style='font-family:Arial'>API</span></st1:stockticker><span style='font-family:
Arial'> for controlling functions on the Asterisk server.&nbsp; Many, but not
all, of the Asterisk </span><st1:stockticker><span style='font-family:Arial'>AGI</span></st1:stockticker><span
style='font-family:Arial'> commands are implemented.&nbsp; The syntax of these </span><st1:stockticker><span
style='font-family:Arial'>API</span></st1:stockticker><span style='font-family:
Arial'> is designed to be convenient and familiar to a Ruby developer and thus
do not map exactly to the method name and parameterization of Asterisk </span><st1:stockticker><span
style='font-family:Arial'>AGI</span></st1:stockticker><span style='font-family:
Arial'>.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>call_handler.rb </span></b><span
style='font-family:Arial'>&#8211; each application using </span><st1:stockticker><span
style='font-family:Arial'>AGI</span></st1:stockticker><span style='font-family:
Arial'> must create a subclass of CallHandler in order to implement logic for
handling a call. There is one method on this object, processCall, which is
called when a call is passed through RAGI from Asterisk.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>call_initiate.rb </span></b><span
style='font-family:Arial'>&#8211; this class provides a convenient abstraction around
Asterisk’s call file facility for outbound dialing.&nbsp; In addition, CallInitiate
specifies some conventions for configuring Asterisk’s extensions.conf so that
calls, when answered, are handled in turn by RAGI.&nbsp; In summary, RAGI’s
callInitiate provides a mechanism to create interactive applications triggered
by a dial out.<span style='mso-spacerun:yes'>&nbsp; </span><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>Important note:<span
style='mso-spacerun:yes'>&nbsp; </span>CallInitiate relies on having an
Asterisk outgoing directory set up and an accompanying cron job.<span
style='mso-spacerun:yes'>&nbsp; </span>The setup for this is the same as the
wake up call configuration found on this page:<span
style='mso-spacerun:yes'>&nbsp; </span></span><a
href="http://www.voip-info.org/tiki-index.php?page=Asterisk+tips+wake-up">http://www.voip-info.org/tiki-index.php?page=Asterisk+tips+wake-up</a><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>call_server.rb </span></b><span
style='font-family:Arial'>&#8211; a server component that answers an </span><st1:stockticker><span
style='font-family:Arial'>AGI</span></st1:stockticker><span style='font-family:
Arial'> socket connection from Asterisk and spawns threads for each call
connection on a particular CallHandler.&nbsp; A “HandlerMap” facility provides
a means to map CallHandler implementations by class name to URIs.&nbsp; These
URIs are specified in the Asterisk extensions.conf to route to the appropriate
handler.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>start_ragi.rb </span></b><span
style='font-family:Arial'>&#8211; an example class that starts up a RAGI server with the
Simon Game CallHandler.<span style='mso-spacerun:yes'>&nbsp; </span>For
instructions on running RAGI within a Rails application, please see the README
file.</span></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>config.rb </span></b><span
style='font-family:Arial'>&#8211; the class provides default configuration values for
RAGI. In practice, developers will want to configure RAGI for their own
purposes (and with their own HandlerMap) by passing in parameters to the
initialize method of callServer.<span style='mso-spacerun:yes'>&nbsp; </span>In
addition, defaults for things like the path to the Asterisk sound directory and
wakeups are given here.<span style='mso-spacerun:yes'>&nbsp; </span>Note that
you can override these for your environment by changing system environment
variables.</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>&nbsp;</span></b></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>test.rb </span></b><span
style='font-family:Arial'>&#8211; a Ruby unit test class for testing RAGI
applications.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-size:14.0pt;font-family:Arial'>Configuration
and Getting Started<o:p></o:p></span></b></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><span style='font-family:Arial'>In order to understand
how to use RAGI in a real Ruby application, this section will guide you through
running any one of our sample apps.&nbsp; This section assumes you have Ruby
installed and path and environment variables set up properly for your
environment.</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>&nbsp;</span></b></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Obtain RAGI</span></b></p>
<p class=MsoPlainText><span style='font-family:Arial'>1.&nbsp; Type the
following to install RAGI as a gem:<span style='mso-spacerun:yes'>&nbsp;&nbsp;
</span></span>gem install ragi<span style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>In the directory “ragi”
you will find the core class files that make up RAGI and a helpful README file.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>In the directory
“sample-apps” you will find a subdirectory for the simon game sample
application.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Configure Asterisk</span></b></p>
<p class=MsoPlainText><span style='font-family:Arial'>Please see the README
file for examples on how to use RAGI in the context of a Rails application.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Run the Sample Application<o:p></o:p></span></b></p>
<p class=MsoPlainText><span style='font-family:Arial;mso-bidi-font-weight:bold'>The
class “start_ragi.rb” is used to bootstrap a server process to answer incoming
RAGI connections from your Asterisk server.<span
style='mso-spacerun:yes'>&nbsp;&nbsp; </span>This file is pre-configured to run
the simon game’s call handler.<span style='mso-spacerun:yes'>&nbsp; </span><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>1.&nbsp; cd to the director
that contains start_ragi.rb</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>2.&nbsp; type the
following to execute the app:<span style='mso-spacerun:yes'>&nbsp;&nbsp;
</span></span>ruby start_ragi</p>
<p class=MsoPlainText><b><span style='font-size:14.0pt;font-family:Arial'>&nbsp;</span></b></p>
<p class=MsoPlainText><b><span style='font-size:14.0pt;font-family:Arial'>Sample
Apps</span></b></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Simple Simon </span></b><span
style='font-family:Arial'>&#8211; a simple memory game.&nbsp; Test your memory by
punching the numbers you here on the phone.&nbsp; See how long of a number
string you can memorize as it grows longer and longer.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-size:14.0pt;font-family:Arial'>Development
Notes</span></b></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>Date:&nbsp; </span><st1:date
Year="2005" Day="20" Month="8" ls="trans"><span style='font-family:Arial'>8/20/2005</span></st1:date><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>+ RAGI released as a
SourceForge project</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>+ RAGI has not been tested
much outside of the context of apps developed in the Ruby on Rails framework.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;Date:&nbsp; </span><st1:date
Year="2005" Day="17" Month="12" ls="trans"><span style='font-family:Arial'>12/17/2005</span></st1:date></p>
<p class=MsoPlainText><span style='font-family:Arial'>+ RAGI has been
repackaged as a gem and now lives on RubyForge.<o:p></o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'>+ RAGI has been updated
to better adhere to Ruby and Rails naming conventions.<span
style='mso-spacerun:yes'>&nbsp; </span>See CHANGELOG for more information.<o:p></o:p></span></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;&nbsp;</span></p>
<p class=MsoPlainText><b><span style='font-size:14.0pt;font-family:Arial'>Sponsorship
and Involvement</span></b></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>RAGI was originally
developed by <a href="http://www.snapvine.com/">SNAPVINE, Inc</a> and is
released as open source under a BSD license.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>We welcome your feedback,
suggestions, bug reports and project sponsorship.</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>To get involved as a
direct contributor to the project, please contact us at the <a
href="http://rubyforge.org/projects/ragi/">RAGI pages on RubyForge</a>.&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><b><span style='font-size:14.0pt;font-family:Arial'>References</span></b></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>SnapVine Developer Site<o:p></o:p></span></b></p>
<p class=MsoPlainText><span style='mso-bidi-font-weight:bold'><a
href="http://www.snapvine.com/code/ragi/">http://<span style='mso-bidi-font-weight:normal'>www.snapvine.com/code/ragi</span></a></span><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Asterisk<o:p></o:p></span></b></p>
<p class=MsoPlainText><span style='mso-bidi-font-weight:bold'><a
href="http://www.asterisk.org/">http://<span style='mso-bidi-font-weight:normal'>www.asterisk.org</span></a></span><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></b></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Asterisk </span></b><st1:stockticker><b><span
style='font-family:Arial'>AGI</span></b></st1:stockticker><b><span
style='font-family:Arial'><o:p></o:p></span></b></p>
<p class=MsoPlainText><a href="http://www.voip-info.org/wiki-Asterisk+AGI">http://www.voip-info.org/wiki-Asterisk+AGI</a></p>
<p class=MsoPlainText><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Asterisk
extensions.conf<o:p></o:p></span></b></p>
<p class=MsoPlainText><a
href="http://www.voip-info.org/tiki-index.php?page=Asterisk%20config%20extensions.conf">http://www.voip-info.org/tiki-index.php?page=Asterisk%20config%20extensions.conf</a><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></b></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Asterisk Dial-Out Call
Files<o:p></o:p></span></b></p>
<p class=MsoPlainText><a
href="http://www.voip-info.org/tiki-index.php?page=Asterisk+auto-dial+out">http://www.voip-info.org/tiki-index.php?page=Asterisk+auto-dial+out</a><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></b></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Ruby<o:p></o:p></span></b></p>
<p class=MsoPlainText><a href="http://www.ruby-lang.org/">http://www.ruby-lang.org</a><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></b></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>Ruby on Rails<o:p></o:p></span></b></p>
<p class=MsoPlainText><a href="http://www.rubyonrails.org/">http://www.rubyonrails.org</a><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><b><span style='font-family:Arial'><o:p>&nbsp;</o:p></span></b></p>
<p class=MsoPlainText><b><span style='font-family:Arial'>SnapVine, Inc.</span></b><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><a href="http://www.snapvine.com/">http://www.snapvine.com</a><span
style='font-family:Arial'><o:p></o:p></span></p>
<p class=MsoPlainText><o:p>&nbsp;</o:p></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoPlainText><span style='font-family:Arial'>&nbsp;</span></p>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.