Warren H. Prince
2004-Feb-29 21:00 UTC
[Asterisk-Users] AGI/php help needed with variables
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.
Warren H. Prince
2004-Mar-01 11:27 UTC
[Asterisk-Users] AGI/php help needed with variables
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@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