Asterisk to Database

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.
Who is Participating?
grbladesConnect With a Mentor Commented:
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.
symonwebdevelopingAuthor Commented:
Would I add that to the extensions.conf?
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.
symonwebdevelopingAuthor Commented:
Thank you.
All Courses

From novice to tech pro — start learning today.