[Asterisk-Users] AGI/php help needed with variables

Warren H. Prince wprince at unconundrum.com
Mon Mar 1 11:27:55 MST 2004


Well, I finally found my own answer, so I'm posting to share.

In php, $argv is an array of the command line variables passed to the 
routine.  So, if in extension.conf  you do a :

    exten => AGI(myphpcode.php,${EXTEN})

$argv[1] will have the value of EXTEN.  Note that it's $argv[1] and not 
$argv[0].  Element 0 contains information about where the variables came 
from.

Warren H. Prince wrote:

> I want to pull the current extension into a php script, but can't seem 
> to figure out the syntax.  I've tried:
>
> $agi->agi_exec("GET VARIABLE EXTEN $EXTEN");
> $EXTEN = $agi->response_var($EXTEN);
> $EXTEN = $agi->request("agi_extension");
> $EXTEN = $agi->get_variable('EXTEN');
>
> and some other variations, but none seem to work.  The first example 
> is the only one that doesn't cause an error, but it still doesn't 
> return the extension.  Could someone offer a hand?
>
> Thanks in advance.
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list