| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

DatabaseAccess

Page history last edited by justin@... 16 years, 7 months ago

One of the many strengths of Adhearsion is its ability to easily integrate your dialplan logic with a relational database. Making calls out to a database from a dailplan has been been possible using other methods and languages, but using ActiveRecord makes the task of getting data from a database fun! And if not fun, atleast much more enjoyable than previous methods.

 

To add database access to your application, you have to somehow let it know where your data is located and the credentials to access the database. You have two methods in that you can specify this information directly config/startup.rb file or in a custom .yml file that lives in the config directory.

 

To specify using the first method, look in your setup.rb and uncomment the lines that talk about ActiveRecord.

 

# Configure a database to use ActiveRecord-backed models.

# config.enable_database :adapter  => 'mysql',

#                        :username => 'joe',

#                        :password => 'secret',

#                        :host     => 'db.example.org'

 

uncomment and put in the correct valus for each of these properties. When adhearsion is restarted for your application, it will create a connection to the database.

 

Another option is to specify your settings in a .yml file. Instead of specifying the configuration in the file, remove the configuration from the setup.rb and replace it with simply.

 

config.enable_database YAML.load_file("config/active_record.yml")

 

You then will need to create an active_record.yml file in the config directory with the the same properties.

 

adapter: mysql

database: my_database

username:  joe

password: secret

 

When your adhearsion process is started, it will connect to the database and allow you to build your models using data from the database specificed in the active_record.yml file.

 

Adding database access and being able to drive a dialplan based on dymaic data is a very powerful features of Adhearsion and provides great flexabiliy to yourself as a programer to create some very sophisticated and rich internet applications. And the fact you can use ActiveRecord makes accessing your data a breeze!

 

Comments (0)

You don't have permission to comment on this page.