[Asterisk-Users] AGI and SET VARIABLE

Steven Critchfield critch at basesys.com
Wed Jun 11 17:10:04 MST 2003


Why bother returning the value when you can just dial directly from AGI.

On Wed, 2003-06-11 at 18:35, Mark Street wrote:
> I am having a problem understanding/visualizing the environment of AGI and how 
> variables defined there can be used in my dial plan.  I am so close I can 
> taste it.  I just want to return a number to dial from a list of numbers in a 
> file.
> 
> from extensions.conf
> [talk2doc]
> ; Please Hold While I Transfer Your Call
> exten => s,1,AGI(pnumber.agi)
> exten => s,2,Dial(Zap/2/$[PHONE_NUM]|15)
> --------------------------------
> 
> in my agi perl script - pnumber.agi 
> .....
> if ( $cntr >= $#file ) {
>         print "SET VARIABLE PHONE_NUM $file[$cntr - 1]";
>         $cntr = 1;
> }
> else {
>         print "SET VARIABLE PHONE_NUM $file[$cntr - 1]";
>         $cntr++;
> }
> 
> If I open up a CLI and dial up asterisk and press the appropriate extension I 
> can see it run the agi script but no returned var.
> 
>  -- Goto (talk2doc,s,1)
>     -- Executing AGI("Zap/1-1", "pnumber.agi") in new stack
>     -- Launched AGI Script /var/lib/asterisk/agi-bin/pnumber.agi
>     -- AGI Script pnumber.agi completed, returning 0
>     -- Executing Dial("Zap/1-1", "Zap/2/$PHONE_NUM|15") in new stack
>     -- Called 2/$PHONE_NUM
> 
> 
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-users mailing list