Menu

problem with get_variable(DIALSTATUS)

2011-12-06
2013-04-29
  • Kamlesh Kumar

    Kamlesh Kumar - 2011-12-06

    Hello,

    I need your help to resolve one issue i.e. while calling get_variable function with DIALSTATUS, I'm not able to get the value of data. Below is the AGI debug extracts from console.

    #!/usr/bin/php -q
    > > <?php
    > > include_once ("phpagi-2.14/phpagi.php");
    >> include_once ("phpagi-2.14/phpagi-asmanager.php");
    > > $agi = new AGI();

    $dialstatus=$agi->get_variable(DIALSTATUS);
    print_r($dialstatus);

    <SIP/10036-000000b8>AGI Rx << GET VARIABLE DIALSTATUS
    <SIP/10036-000000b8>AGI Tx >> 200 result=1 (CANCEL)
    <SIP/10036-000000b8>AGI Rx << Array
    <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command
    ERROR: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe
    <SIP/10036-000000b8>AGI Rx << (
    <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command
    ERROR: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe
    <SIP/10036-000000b8>AGI Rx <<    

     => 200
    <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command
    [Dec  3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe
    <SIP/10036-000000b8>AGI Rx <<     [result] => 1
    <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command
    [Dec  3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe[u]
    <SIP/10036-000000b8>AGI Rx <<     [data] [/u]=>
    Thanks,
    Kamlesh
    
     
  • Alon kogan

    Alon kogan - 2012-03-26

    I'm in this problem too, invoke get_variable(….) , It prints the returned value, but I cannot get that value in the

     
  • Ryan Smith

    Ryan Smith - 2012-04-02

    its an issue with php5 i think not a solution but it seems making the call 3 times will always work so a simple wrapper function..

    function get_var($agi_in, $value)
    {
    $temp = $agi_in->get_variable($value);
    $temp = $agi_in->get_variable($value);
    $temp = $agi_in->get_variable($value);
    $temp = $temp;

    $agi_in->verbose($value." :".$temp);
    return $temp;
    }

     
  • 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:

    around line 1496 in phpagi.php

    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);
    
     
  • hamzeh

    hamzeh - 2017-02-09

    HI. This is True:

    $dialstatus = $agi->get_variable('DIALSTATUS');
    if($dialstatus['result'] == 1)
    {
    $ds = $dialstatus['data'];
    $agi->verbose("DIAL STATUS is: $ds");
    }

     

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.