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

#!/usr/bin/php -q
	ini_set('max_execution_time', 0);
	$agi = new AGI();
	$agi->verbose("................Demo.......................");//it's running
	sleep(500);//code start to waiting here
	$agi->verbose("................Demo1.......................");//But not running this line.30 sec after php completed."Spawn extension ... exited non-zero on ...."

exten => 003,1,AGI(demo.php,3)

AGI Script demo.php completed 
Spawn extension ... exited non-zero on ...

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

No problem when I use console dial.But have a this problem when I call from extension.I must call from extension because I couldn’t multiple call from console.
I need multiple execute php async and I should be shut down specific chanel when I want

A console log (core set debug 3, core set verbose 3, agi set debug on) and a dialplan snippet may help. Please cut-n-paste text – no pictures. Please wrap the text in pre-formatted text tags so the forum doesn’t eat special characters.

I’d assume the caller gave up waiting for an answer long before the 500 seconds were up.

I can’t work out what you mean by multi execute and async. At first I thought you were referring to fast AGI, but this is a normal AGI where the script is run synchronously and a process is launched for every AGI application call.

It would probably help if you explained what you are trying to achieve that you think needs the use of AGI.

I wrote this code for testing. The main thing is that

$callList; //Dynamic list for ID parameter on php (argv[])
for ($i = 0; $i < count($callList); $i++) 
	shell_exec('asterisk -rx "database put phones autocall/device '.$callList[$i]['PhoneNumber'].'"');					
	$output = touch($fileName);
	$file = fopen($fileName, 'w');					
	fwrite($file, 'Channel: SIP/kobikom/'.$callList[$i]['PhoneNumber'].''.PHP_EOL.'Context: from-internal'.PHP_EOL.'Extension: '.$extension.PHP_EOL.'Archive: Yes'.PHP_EOL.'CallerID: '.$callList[$i]['PhoneNumber'].'');
	shell_exec('mv /var/lib/asterisk/'.$fileName /var/spool/asterisk/outgoing/');
		$fileCount = shell_exec('ls /var/spool/asterisk/outgoing_done/'.$fileName.' | wc -l');
			$stateCall =(string)shell_exec("tail /var/spool/asterisk/outgoing_done/".$fileName." | grep Status |awk '{print $2}'");
			//save database and call other number
	sleep($dynamicTime);// wait for user dynamic time for user options	

This php file execute for ID.Run it 1… Run it 2… Run it 3… Async
for example after if ID=2 then close.

I solved the problem in a different way. I use it as a regular php page instead of AGI.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.