Menu

#10 get_variable

open
nobody
None
5
2008-06-17
2008-06-17
Anonymous
No

Some functions like, get_variable must be called twice to work, for example:

$var = $agi->get_variable('EXTEN');
$var = $agi->get_variable('EXTEN');

If you call it only one time, $var['data'] has no value.

Discussion

  • Nobody/Anonymous

    I have the same problem!!!

    The problem is php5 ?
    Asterisk version ?

     
  • josephtikva

    josephtikva - 2012-08-15

    this is often due to there being data in the stdin.

    Here's an easy fix

    add this to the beginning of the evaluate function:

    function evaluate($command)
    {

    //clear the buffer
    stream_set_blocking($this->in,0);
    do {
    $line = fgets($this->in);
    } while ($line);

    stream_set_blocking($this->in,1);

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.