Note, this is an example only at the moment as Ann Arbor, MI has recently closed public access to their parking data. Therefore this example will not work with that data set. For more information on the closure you may refer to this blog post.
Provides an example Adhearsion component that exposes the Ann Arbor, MI parking lot space availability via an IVR. This example was inspired by the folks @ VoIP Tech Chat and their Perl example.
In the ~ahn_project/components directory:
git clone git://github.com/jsgoecke/annarbor_parking.gitCreate a new directory, for the generated Text to Speech files, read/writeable by the user running Adhearsion, by default it is:
/var/lib/asterisk/sounds/surveysYou may change the location in the annarbor_parking.yml file, just keep in mind that the user running Asterisk must also have read access.
sandbox {
#Get an Array of Hashes that contains the parking availability details
#by location
parking_spaces = fetch_available_spaces
#Then build a soundfile from that data to playback to the user
menu_soundfile = lot_details(parking_spaces)``
#Now lets ask the user for their input
lot_selected = input 1,
:timeout => 30.seconds,
:play => menu_soundfile
#Now that we have the user selection, lets build the sound file of the
#available spaces and play it back to the user
if lot_selected != nil
spaces_soundfile = spaces_available(parking_spaces, lot_selected)
play spaces_soundfile
end
hangup
}
The MIT License
Copyright© 2009 Jason Goecke
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.
Jason Goecke (jason@goecke.net)
You can download this project in either zip or tar formats.
You can also clone the project with Git by running:
$ git clone git://github.com/jsgoecke/annarbor_parking