Reputation: 1
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
Upvotes: 0
Views: 243
Reputation: 15259
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.
Upvotes: 0