title: Asterisk AGI: How to get or set the value of a global variable?
body: <p>I'm using Asterisk 1.8 with PHP for AGI scripting.</p>
  
  <p>EDIT:</p>
  
  <p>I'm struggling with setting and obtaining the values of global variables from within an AGI PHP script. I can set channel variables but not global variables. Using PHPAGI lib.</p>
  
  <p>Tried:</p>
  
  <pre><code>Set({$varname}={$value},g)
  Set({$varname}=\"{$value}\",g)
  Set(GLOBAL({$varname})={$value})
  </code></pre>
  
  <p>That does not seem to work at all, when getting the value from within the dial plan, it is empty.</p>
  
  <p>Does anyone have a working example of setting and getting global variables in an AGI script?</p>