[asterisk-users] PHP/AGI/SetVar Issue

Steve Edwards asterisk.org at sedwards.com
Fri Jun 5 14:13:25 CDT 2009


On Fri, 5 Jun 2009, Philipp Kempgen wrote:

> Steve Edwards schrieb:
>>
>> One of my AGIs sets almost 600 channel variables.
>
> Wow that's a lot. Why would you do that?

Why? That's always a tough question :)

It's a "survey" system. Ask a question, record (voice or DTMF) a response, 
maybe branch based on a single DTMF.

All the "steps" are stored in the database.

When a call comes in, an AGI looks up the steps for the DNIS and loads all 
the variables of the form:

 	STEP-01-DATA -- name of variable, branch targets, etc
 	STEP-01-MAX-LENGTH
 	STEP-01-MIN-LENGTH
 	STEP-01-PROMPT -- path to a wav file
 	STEP-01-TYPE -- types are BRANCH, DTMF, END, PROMPT, VOICE, etc.
 		.
 		.
 		.
 	STEP-xx-DATA
 	STEP-xx-PROMPT
 	STEP-xx-MAX-LENGTH
 	STEP-xx-MIN-LENGTH
 	STEP-xx-TYPE

(There's actually 8 variables per step. One customer has 75 steps. Thus, 
600 channel variables.)

Each type is handled by a separate AGI.

The dialplan (in AEL) just loops through the indexes. A switch statement 
determines which AGI is invoked. A branch just changes the index. I never 
touch the database again until call completion.

All the control "logic" is in the database.

If a customer wants to add or delete a step, it's just a simple update to 
the database. If a customer wants to add a new type (SSN?), it's just a 
new AGI.

It seems to be very flexible, easy to maintain and extend -- so far :)

The system was just put into production on Monday.

If I can talk the client into it, I want to add a LABEL type so I can 
branch to a label instead of a step number -- shades of BASIC :)

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list