Permalink
Browse files

Initial project commit

  • Loading branch information...
0 parents commit 2ad622c1df176425788426c6436712909f760ad4 @jsgoecke jsgoecke committed Oct 1, 2010
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2010 Voxeo, Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,229 @@
+Tropo AGI
+=========
+
+Description
+-----------
+
+Provides a script to emulate the Fast Asterisk Gateway Interface [FastAGI]([http://www.voip-info.org/wiki/view/Asterisk+FastAGI "FastAGI") protocol on [Tropo](http://tropo.com "Tropo"). While most of the development and testing has been done using [Adhearsion](http://adhearsion.com "Adhearsion"), we stayed with the proper Asterisk AGI implementation. Therefore this script should work with any FastAGI server including [PHPAGI](http://phpagi.sourceforge.net/ "PHPAGI") and [Asterisk-Java](http://asterisk-java.org/ "Asterisk Java"). We will be doing more testing with alternative frameworks soon and reporting back.
+
+Installation
+-----------
+
+This project allows you to control the Tropo AGI via an Adhearsion dialplan context.
+
+* Create a free account at [Tropo](http://tropo.com "Tropo").
+
+* Install [Adhearsion 0.8.6+](http://adhearsion.com "Adhearsion"). You can install this on your local computer.
+
+<pre>
+ gem install adhearsion
+</pre>
+
+* Create a simple dialplan, or use some of the examples provided
+
+<pre>
+ tropo_agi {
+ play "Wow. My first app! Tropo really is this easy!"
+ }
+</pre>
+
+* Ensure your Adhearsion app is running and has a public IP. You may need to port forward 4573 on your firewall.
+
+* Create your Tropo application
+
+Instructions may be found [here](https://www.tropo.com/docs/scripting/quickstart.htm "Quick Start").
+
+* Set your Tropo app to use the [lib/tropo-agi.rb](https://github.com/tropo/tropo-agi/raw/master/lib/tropo-agi.rb) script
+
+ * Load the file directly to the Github file location [lib/tropo-agi.rb](https://github.com/tropo/tropo-agi/raw/master/lib/tropo-agi.rb)
+ * Host the 'tropo-agi.rb' yourself and provide a public URL for access
+ * Add it to your Tropo FTP/WebDAV account
+
+* Modify the configuration file and post it to your Tropo FTP/WebDAV account
+
+ * First set your configuration settings in the [tropo_agi_config/tropo_agi_config.yml](https://github.com/tropo/tropo-agi/raw/master/tropo_agi_config/tropo_agi_config.yml "tropo_agi_config.yml") file
+ * Then upload to your [Tropo FTP/WebDAV](https://www.tropo.com/docs/scripting/tropohosting.htm) account placing in root/www/tropo_agi_config
+
+* Use a SIP client (like Blink for Mac) and dial the SIP Voice account listed under your application, may use Skype too!
+
+* Happy Tropo-ing!
+
+Supported Adhearsion & AGI Methods
+----------------------------------
+
+Refer to the wiki [Supported Adhearsion and Asterisk Gateway Interface (AGI) Commands](https://github.com/tropo/tropo-agi/wiki/Supported-Adhearsion-and-Asterisk-Gateway-Interface-(AGI)-Commands) page.
+
+Asterisk Sound Files Available
+------------------------------
+
+Refer to the wiki [Asterisk Core Sounds Available](https://github.com/tropo/tropo-agi/wiki/Asterisk-Core-Sounds-Available) page.
+
+Adhearsion Dialplan Examples
+----------------------------
+
+These Adhearsion dialplan examples are also available in the 'examples' directory of this project.
+
+<pre>
+ # The main AGI entry point
+ tropo_agi {
+ answer
+ +hello_world
+ hangup
+ }
+
+
+ # Invokes the native Tropo ask for Speech Recognition / ASR
+ # Related Tropo method: https://www.tropo.com/docs/scripting/ask.htm
+ ask_example {
+ result = execute 'ask', { :prompt => 'Please enter your zip code',
+ :choices => 'zipcode([5 DIGITS])' }.to_json
+ # Get rid of the '200 result =' and then parse the JSON
+ response = JSON.parse(result[11..-1])
+ ahn_log.debug response
+ }
+
+ # We have lots of Asterisk sounds!
+ asterisk_sounds_example {
+ play 'tt-monkeys'
+ }
+
+ # You may dial other SIP addresses, or telephone numbers as you like
+ # Formats may be:
+ # SIP/
+ # sip:
+ # tel:+
+ # Related Tropo method: https://www.tropo.com/docs/scripting/transfer.htm
+ dial_example {
+ dial 'sip:9991443146@sip.tropo.com'
+ }
+
+ hello_world {
+ play 'tt-monkeys'
+ }
+
+ # Works as input should, only accepting DTMF
+ # Related Tropo method: https://www.tropo.com/docs/scripting/ask.htm
+ input_example {
+ postal_code = input 5, :play => 'Please enter your post code?',
+ :timeout => 2
+
+ ahn_log.postal_code.debug postal_code
+ play "You entered"
+ say_digits postal_code
+ }
+
+ # Find out if this is a Tropo session or an Asterisk one
+ is_tropo? {
+ if type == 'TROPO'
+ play "Yippeee! It is a Tropo call!"
+ else
+ play "No, this is a good old Asterisk call"
+ end
+ }
+
+ # Related Tropo method: https://www.tropo.com/docs/scripting/say.htm
+ say_digits_example {
+ say_digits '12345'
+ }
+
+ # Uses the native Tropo say method for Speech-Synthesis/TTS, will not play Asterisk sound files like play will
+ # Related Tropo method: https://www.tropo.com/docs/scripting/say.htm
+ say_example {
+ execute 'say', { :prompt => 'I like to have weasels in my cloud.', :voice => 'simon' }.to_json
+ }
+
+ # If this is a Tropo call, then all of the SIP headers for the session are available
+ show_call_data {
+ ahn_log.tropo_headers_str.debug tropo_headers
+ tropo_headers = JSON.parse self.tropo_headers
+ ahn_log.tropo_headers_hash.debug tropo_headers
+ play "The content type is " + tropo_headers['Content-Type']
+ +asterisk_sounds_example
+ }
+
+ # Monitor and Mixmonitor behave the same, may also be invoked as startCallRecording
+ # Related Tropo method: https://www.tropo.com/docs/scripting/startcallrecording.htm
+ monitor_example {
+ play 'About to start call recording'
+ execute 'monitor', { :uri => 'http://tropo-audiofiles-to-s3.heroku.com/post_audio_to_s3?filename=voicemail.mp3',
+ :format => 'mp3',
+ :method => 'POST',
+ :transcriptionOutURI => 'mailto:jsgoecke@voxeo.com' }.to_json
+ play 'Call recording started!'
+ play 'Thats it folks!'
+ execute 'monitor_stop', ''
+ play 'Recording stopped!'
+ }
+
+ # Related Tropo method: https://www.tropo.com/docs/scripting/record.htm
+ record_prompt_example {
+ play 'Please record after the beep'
+ record 'http://tropo-audiofiles-to-s3.heroku.com/post_audio_to_s3?filename=voicemail.mp3',
+ :silence => 5,
+ :maxduration => 120
+ }
+
+ # Allows you to set and retrieve variables on the session
+ # These also get passed as custom SIP headers, prepended with 'x-tropo' when you dial/transfer a call
+ variables_example {
+ set_variable('foobar', 'green')
+ ahn_log.debug get_variable('foobar')
+ }
+
+ # We have lots of Asterisk sounds!
+ asterisk_sounds_example {
+ play 'tt-monkeys'
+ }
+
+ # Allows you to send standard DTMF digits
+ send_dtmf_example {
+ dtmf '1234567890#*'
+ }
+
+ # Start menu example
+ # Related Tropo method: https://www.tropo.com/docs/scripting/ask.htm
+ menu_example {
+ menu 'welcome', 'for spanish press 4',
+ :timeout => 8.seconds, :tries => 3 do |link|
+ link.shipment_status 1
+ link.ordering 2
+ link.representative 3
+ link.spanish 4
+ link.employee 500..599
+
+ link.on_invalid { play 'invalid' }
+
+ link.on_premature_timeout do |str|
+ play 'sorry'
+ end
+
+ link.on_failure do
+ play 'goodbye'
+ hangup
+ end
+ end
+ }
+
+ shipment_status {
+ play 'I surely do not know your shipment status.'
+ }
+
+ ordering {
+ play 'Go somewhere else and order.'
+ }
+
+ representative {
+ play 'No representatives here.'
+ }
+
+ spanish {
+ play 'e 2 brutus?'
+ }
+
+ employee {
+ play "The person at"
+ say_digits extension
+ play "went home for the day."
+ }
+ # End menu example
+</pre>
@@ -0,0 +1 @@
+0.1.0
Oops, something went wrong.

0 comments on commit 2ad622c

Please sign in to comment.