Please Help regarding AGI>


#1

Dear friends,

I am new in Asterisk, It would be greatly appreciated if anybody could help me regarding my issue,

Just wanted asterisk play a random question sound file from my database or my sounds folder and waiting for user to enter correct answer
then asterisk check the right answer and go to next step

for example

Test.AGI should play a random question(sound file) from my database ( but I don’t have right Perl script)
Play this file for example
What is the CAPITAL city of united states of America.
1- New York
2- Washington
3- Los angles
4- Texas

The right answer is number 2 and user should enter 2 after WaitExten .
If user enter correct answer it will Goto (next step ) and if not it will Go to (Play-incorrect sound)

Now I want to know is it possible to do it ,?
How I can select random file from database with answer ?

Is there any simple way ?

[Q1]
exten => 1111,1,Answer
exten => 1111,n,AGI(TEST.agi)
exten => 1111,n,WaitExten(5)
Here how I can check that the answer is correct and how I can get right one from My database
if answer was correct
exten => 1111,n,Goto(next question)
if answer was not correct
exten => 1111,n,Goto(Play-incorrect sound)


#2

It’s of course possible to do so, but: You need to know the relation between the (randomly) selected soundfile(s) and the correct answers, thus there needs to be some more configuration on Your side, probably by holding soundfile(s) and realated answers in a database and make a random select to choose one pair of sound/answer from this source.

If You’re interested in further assistance on a consultancy base, pls PM me.


#3

Dear friend,

Thank you very much for your response , unfortunately I am new In asterisk and I don’t know this relations, what configuration I need ? can you help me what program I need?
please let me know clearer the scenario and let me know how it is possible ?

What I did now is holding a sound file into my database with blob and play it from my asterisk,

But I don’t know how I can get answer after playback and match into that dial plan


#4

You will have the question, now you have answers in another table which the question id and a field named as is_correct , Y or N. so while you play the question you should have the record of random answers along the correct number. so match with the input and good to go …

Let me know if you still need help, i can send you the database and AGI.