If you want to give adhearsion a try, here is a quick introduction in how to set it up and do your first tests.
This little howto was made on a Mac but it should be usable for linux without any problems, except for the Asterisk paths.
So, let’s get started. First we need asterisk for Mac OS, we can get this here: after installing asterisk, let’s get the adhearsion gem
1 2 3
after adhearsion was installed, you should install some softphone for testing. I recommend using blink on Mac OS.
Now let’s create a first project to play around.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Now we need to set up asterisk extensions.conf for our first adhearsion project. So let’s open /Library/Asterisk/conf/extensions.conf and search for the [default] section and add exten => _X.,1,AGI(agi://127.0.0.1) right at the beginning.
It should now look like this:
1 2 3 4 5 6
Why the default? For the purpose of testing, this is the fastest way. You can of course use something different, but keep in mind that this MUST match what you will have in your adhearsion dialplan.rb ! But more on that later.
Now open dialplan.rb from your freshly created adhearsion project in your favorite editor.
Remove the lines from the example
1 2 3
And replace them with our first example:
1 2 3
Note that the default here must match the section of your extensions.conf, so if you used [my_cool_ivr] then your dialplan.rb must look like this:
1 2 3
So now start asterisk
$ asterisk -cvvvvv
Start your ahn project
1 2 3
And start Blink and dial email@example.com, nothing exciting will happen, but if you check your session where you started adhearsion you will see
So with very little effort you now have connected Asterisk to ruby, pretty cool. Well, let’s do something more exciting now.
Open up dialplan.rb and add some code in it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
So if you dial firstname.lastname@example.org you will be asked to enter a pin, with the line login=input 4, :timeout => 1.minute you are telling asterisk that you want 4 digits, and there should be a timeout if nothing happens in one minute.
I did intend to show off some conference features … but it turns out the binary build of asterisk for mac os is missing app_meetme so until I figure that one out I’ll just leave this as it is.