Asterisk to Database

Posted on 2006-05-02
Last Modified: 2010-04-12
Ok, this is a hard question, therefore, it is worth the maximum amount of points; it needs a multipart answer.

How can I configure Asterisk@Home to answer the phone when someone dials, allow the caller to enter an ID number, ask a few questions, hang up, then update a database with the answers to the questions based on the ID number that the caller provided?

I'm assuming that I will need some kind of script that updates the database(which I can write). If I DO need a script, I'm going to have to know where the output from the phone call went so I can extract the necessary information. This is just a guess as to how it's supposed to work, please correct me if I'm wrong and answer the question in the first paragraph.

Thank you very much in advance.
Question by:symonwebdeveloping
    LVL 36

    Accepted Solution

    The first stage is to create a macro so that you have an IVR menu which plays a message and accepts a number entered on the phone. For example :-

      exten => s,1,Wait(1)
      exten => s,2,Answer
      exten => s,3,Wait(1)
      exten => s,4,SetMusicOnHold(default)
      exten => s,5,Set(TIMEOUT(digit)=5)
      exten => s,6,Set(TIMEOUT(response)=10)
      exten => s,7,Background(custom/message1)

      exten => _XXXX,1,Set(ANSWER1=${MACRO_EXTEN})
      exten => _XXXX,2,Macro(menu2)
      exten => _XXXX,3,Macro(menu3)
      exten => _XXXX,4,Macro(menu4)
      exten => _XXXX,5,system(/usr/local/bin/updatedb ${ANSWER1} ${ANSWER2} ${ANSWER3} ${ANSWER4} ")
      exten => _XXXX,6,Hangup

      exten => t,1,Playback(custom/didnotunderstand)
      exten => t,2,Wait(1)
      exten => t,3,Goto(s,7)
      exten => i,1,Playback(invalid) ; "That's not valid, try again"
      exten => i,2,Wait(1)
      exten => i,3,Goto(s,7)

    This will play a message and wait for a 4 digit number to be entered. The number will be stored in a variable called ANSWER1 and then 3 more macros called to ask the additional questions. Then a system command is issued and the 4 answers supplied via commoand line arguments.

    Author Comment

    Would I add that to the extensions.conf?
    LVL 36

    Expert Comment

    Yes thats correct. It goes into extensions.conf. You will need to change it a little and add the other macros for the additional questions etc...
    You will need to record the audio for the questions aswell and save them into the custom subfolder where the other sounds are.

    Author Comment

    Thank you.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I recently purchased a Bluetooth headset called the Music Jogger (model BSH10). The control buttons on it look like this: One of my goals is to use it as the microphone and speakers for Skype calls. In that respect, it works well. However, I …
    Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now