Read a number from the caller and run an AGI script using it as parameter

From MiRTA PBX documentation
Jump to navigation Jump to search

Let's make the example of a service to verify if a code provided by the user is valid or not, by checking in a database.

As first step we'll create a media file to ask to the user the number.

Createmediafileentercode.png

Then we'll create a "Custom Destination" to read the number from the user

Readthecode.png

Let's define an AGI script to test if the code is good or not. We'll send the number entered as parameter. As an additional parameter, we'll send the callerid number of the caller

Createagiscriptcodenumberentered.png

Then we can create the custom destination to use the AGI script defined. As first parameter we'll use the variable holding the code entered ${USR-usercode} and as second parameter the callerid of the caller.

Runagiscriptcodenumberentered.png

The AGI script in this case will set the variable AGIRESULT to TRUE/FALSE, so this value can be evaluated in a condition