# AGI get\_variable not saving variable...?

**URL:** <https://community.asterisk.org/t/agi-get-variable-not-saving-variable/25334>\
**Category:** Asterisk Support\
**Created:** [February 4, 2009, 4:29am UTC](https://community.asterisk.org/t/agi-get-variable-not-saving-variable/25334 "2009-02-04T04:29:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CustomGT](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@CustomGT](https://community.asterisk.org/u/CustomGT)\
**Post date:** [February 4, 2009, 4:29am UTC](https://community.asterisk.org/t/agi-get-variable-not-saving-variable/25334/1 "2009-02-04T04:29:24Z")

</div>

I run the php script from the command line, it contains:  
$asm-\>Originate(SIP/305, ‘’, ‘’, ‘’, ‘AGI’, ‘test.php’, ‘’, ‘’, ‘var1=41283’);

It Originates the call to test.php, which has:

#!/usr/bin/php -q

\<?php set\_time\_limit(0); require('phpagi.php'); $agi = new AGI(); $agi-\>answer(); $matt = $agi-\>get\_variable('var1'); var\_dump($matt); Now when it runs test.php, i get this in the cli with agi debug on: AGI Rx \<\> 200 result=0 AGI Rx \<\> 200 result=1 (41283) AGI Rx \<\> 510 Invalid or unknown command AGI Rx \< AGI Tx \>\> 510 Invalid or unknown command AGI Rx \<\> 510 Invalid or unknown command AGI Rx \< AGI Tx \>\> 510 Invalid or unknown command AGI Rx \<\> 510 Invalid or unknown command AGI Rx \< AGI Tx \>\> 510 Invalid or unknown command AGI Rx \<\> 510 Invalid or unknown command AGI Rx \<\> 510 Invalid or unknown command The unknown command lines are fine, ignore that. (ive tries verbose($matt['data']) and alot of other ways with the same blank result) See it gets var1, and shows the correct answer on the next line. But when I do vardump($matt); it is no where to be seen. Ive tried so many ways to do this, what could be going wrong???

---

<div class="post-metadata">

**Author:** ![CustomGT](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@CustomGT](https://community.asterisk.org/u/CustomGT)\
**Post date:** [February 5, 2009, 2:07am UTC](https://community.asterisk.org/t/agi-get-variable-not-saving-variable/25334/2 "2009-02-05T02:07:05Z")

</div>

tried this on an asterisk 1.4 server tonite, same thing…
