tags:

views:

1466

answers:

3

Can you someone please point in me in a direction, sample code or an online resource to accomplish the following:

Requirement: I would like to write a simple IVR menu option that will run a script (Bash or Python). For example, phone the Asterisk machine and request to restart a service on another Linux box. The 'other Linux box' details would be hard coded to the IVR menu option and not needed to be supplied as part of the IVR interaction - just restart service X on box Y. I am little worried and unsure how one would secure this with a password (even if it is hard coded in version).

Background: I am an Asterisk newbie and installed it from the AsteriskNow distribution and I am still learning the product. The basic PBX functionality is working and is administered through FreePBX. Asterisk is not our main focus of development work but rather a tool in the toolbox. We mostly do .NET work but have Unix skills.

If possible I would not like to spend days learning the integrate details of Asterisk to get the job done...

+1  A: 

The Asterisk AGI page holds links to applications in many programming languages. If you do mostly .NET, maybe nasterisk or the older MONO-TONE will help.

gimel
Exactly what I needed - Thank you!
Philip Fourie
You're welcome. Which library/language did the trick?
gimel
+2  A: 
Chochos
Thanks for the answer. I only saw it today, but still applicable. This is a nice and simple solution.
Philip Fourie
+5  A: 

Asterisk is not always waiting for user input. Only during the Background, WaitExten, Read commands. If you're using Playback(), Asterisk ignores any DTMF while it's playing the audio file.

You can replace Playback with Read() but you have to set the read timeout to a very low value or there will be a silence after every audio file you play with Read(). If you use Read() then you have to check the value input by the user to check for exit, something like this...

Instead of

exten => x,n,Playback(yourfile) exten => x,n,somethingelse...

you need

exten => x,n,Read(Exit,yourfile,1) exten => x,n,GotoIf($["${Exit}" = "0"]?0,1) exten => x,n,somethingelse...

shrikant.soni