Search code examples
phpasteriskagi

Transfer call to a Queue in PHPAGI


I am having difficulty transferring a call to a queue through PHPAGI. I am using

$agi->exec('Queue',"1000"); 

But the call keeps looping and the static agents never ring. Eventually I have to then restart the Asterisk.

Any help would be appreciated.

I know we can do it through the dial plan, but the situation requires me to do it from the AGI script.

Thanks in advance.


Solution

  • And after days of trying different things, finally I have it working with below. Posting it here so that it may help others too.

    $agi->exec('Transfer',"1000");
    

    Edit:

    a better way of doing it is using the Goto application. I had tried it previously but call kept hanging up and the transfer never happened. Then I just commented the hangup from the code and it worked like a charm. For Goto application to work with the phpagi code that I have, I had to comment the hangup.

    Following works perfect.

    #!/usr/bin/php -q
    <?PHP
    require('/var/lib/asterisk/agi-bin/phpagi.php');
    include('mylib.php');
    $agi = new AGI();
    $log = new Logging();
    $agi->answer();
    $agi->exec('Goto',"ext-queues,1000,1");
    //$agi->hangup();
    ?>