Any possible way to use agi(phpagi) in dialplan so that when the call comes in(under that dialplan) , the caller can input some numbers by pressing the numbers and then the numbers will be passed to a php script through post method? The inputs will be stored in a variable in diaplan and then the php file will call that variable to use the inputted numbers. And just to let the caller to confirm by himself that he has put all the numbers can there be added a special number or # key so that the variable will not store any more input number.
If you want to ‘get fancy,’ the AGI command ‘stream file’ allows you to pass an ‘escape digits’ string that can be used to terminate playback. The terminating digit is returned to your AGI. From there, you can use ‘wait for digit’ in a loop to process the caller’s input keystroke by keystroke. This allows you to do things like restart the playback and entry if they press ‘*’.
Once you have your digit string, you can use the cURL library to post your request.
I don’t really see why you would send a post request with the data, just to store it in “The dialplan” and then read it back from the AGI script.
If you only ever need the input during the call, you would do this:
- Read input from user either before your AGI call, or from the AGI script, and store it in a variable.
- Make the user verify the digits entered, either in AGI or before
- Do whatever you need with the input
I see no obvious way, or reason, to send the data to a webserver for storing in the dialplan, if it’s even possible, it’s over complicated, and not needed.
If you want the webserver to do some sort of validation of the data, you can do that. The only thing special about AGI is, that whatever you output to stdout, will be handled as commands for asterisk to act on, and whatever you receive from stdin, will be the result of previous commands.
Also there’s a number of AGI frameworks for PHP, if you don’t want to make it by yourself.
If, on the other hand, you ONLY want to get the input from the user, store it in a variable, make the user confirm or edit the data, it can be all done in the dialplan, no AGI needed.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.