简体   繁体   中英

I need multiple execute php async and I should be shut down specific chanel when I want

Php File(demo.php);

#!/usr/bin/php -q
<?php 
    set_time_limit(0);
    ini_set('max_execution_time', 0);
    require('phpagi.php');
    $agi = new AGI();
    $timeParameter = $argv[1];
    $agi->verbose("................Demo.......................");
    sleep((int)$timeParameter*100);
    $agi->verbose("................Demo1.......................");
?>

DialPlan;

[demo_3]
exten => 003,1,AGI(demo.php,3)
[demo_4]
exten => 004,1,AGI(demo.php,4)

I need multiple execute demo.php async and I should be shut down specific chanel when I want.No problem when I call 003@demo from console.

asterisk -rx "console dial 003@demo_3" //it is running but not running with multiple
asterisk -rx "console dial 003@demo_3" // it is running
asterisk -rx "console dial 004@demo_4"  // but it is not running with async

What can I do about this?I try call from Extension.But php not waiting 400 second. php completed 30 second after. For example;

Extension:104
asterisk -rx "channel originate local/003@demo_3 extension 104@from-internal"
asterisk -rx "channel originate local/004@demo_4 extension 104@from-internal"


asterisk -rx "channel request hangup local/003@demo_3"  // I can run it when I want

AGI is NOT async interface and no way to use it as async.

You can use AMI or ARI.

In AGI you should use Wait(). In most cases you should answer call first otherwise ring timeout on other side will close channel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM