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.

 

 

 

 

 

 

 

 

 

 

 

 

 

Then we’ll create a “Custom Destination” to read the number from the user

 

 

 

 

 

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

 

 

 

 

 

 

 

 

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.

 

 

 

 

 

 

 

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