On Mon, 4 May 2009, James A. Shigley wrote: > I'm just trying to make a real simple Survey via php. Just want it to > play the Question Files, wait for a response, save the response into the > correct variable and then email it all.
If it's "real simple," maybe AGI is overkill. Any particular reason you can't do it in the dialplan? > I have no issue playing the audio or emailing. But I can't get it to > wait for digits or to properly capture those digits into the variables. > I know the code is technically right since the emails have this in place > of what Q1 should be "200 result=35 endpos=2400" instead of whatever > digit I pressed during testing. The code is not "technically right" since you don't understand the AGI protocol. See your code snippet below. > A. How to have it play the whole audio file before it goes to the next > command, without having to use the sleep function preferably. Use "stream file" with the appropriate escape digits. > B. How to make it actually wait for digits Use "wait for digits" with the appropriate timeout. Accumulate digits for the desired effect. > C. How to get it to actually capture the digits (I think it would if it > wasn't streaming thru the whole file without waiting for a response.) An alternative is to use the background, playback, and read dialplan applications from your AGI. > // Q1 > fwrite(STDOUT, "STREAM FILE /var/lib/asterisk/sounds/1 ###\n"); > fwrite(STDOUT, "wait for digit 10\n"); You don't understand the AGI protocol. For every request (the bit you send to Asterisk) you need to read the response (the bit Asterisk sends to you). Issuing 2 requests breaks the protocol. Please use an established library to handle all the little details of AGI for you. You will live longer :) Using an established library will take care of all these seemingly insignificant details and save you a lot of time. Thanks in advance, ------------------------------------------------------------------------ Steve Edwards [email protected] Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
