[Asterisk-Users] AGI and SET VARIABLE

Martin Pycko martinp at digium.com
Wed Jun 11 20:40:46 MST 2003


Notice that you should refer to PHONE_NUM variable this way:
${PHONE_NUM}

Martin

On Wed, 11 Jun 2003, 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
>
>
>
>
>
> --
> Mark Street, D.C.
> Red Hat Certified Engineer
> Cert# 807302251406074
> --
> Key fingerprint = 3949 39E4 6317 7C3C 023E  2B1F 6FB3 06E7 D109 56C0
> GPG key http://www.streetchiro.com/pubkey.asc
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
>




More information about the asterisk-users mailing list