<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div><div>not able to run my php from AGI</div><div>i am using asterisk 1.8.13 (debian)</div><div>i am able to make call file using php command line..</div><div>but when executing php from AGI, it is not working..</div><div>kindly see the attachment if bellow text is not readable...</div><div>____________________________<span style="font-size: 12pt;">_______________________</span></div><div> File: /etc/asterisk/extensions.conf</div><div>[call]</div><div>exten => call,1,Answer</div><div>exten => call,n,Playback(hello-world)</div><div>exten => call,n,Hangup()</div><div><br></div><div>exten => h,1,Set(NEXT=$[${NEXT}+1])</div><div>exten => h,n,AGI(generateCall.php,${NEXT})</div><div>exten => h,n,Hangup()</div><div>_______________________________________________________________________</div><div>File: /usr/share/asterisk/agi-bin/generateCall.php</div><div><br></div><div>#!/usr/bin/php -q</div><div><?php</div><div>$fileName = "/var/www/consumer.txt";</div><div>$next = $argv[1];</div><div>$f = fopen($fileName,'r');</div><div>$fileContent = file_get_contents($fileName);</div><div>$outdialNumbers = explode("\n",$fileContent);</div><div><br></div><div>if($outdialNumbers[$next]) {</div><div> $callFile = "/var/spool/asterisk/outgoing/".$outdialNumbers[$next].".call";</div><div> $f = fopen($callFile,'w');</div><div> $callFileContent = "\nChannel: dongle/dongle0/".$outdialNumbers[$next]."\nContext: call\nExtension: call\nPriority: 1\nSet: NEXT=".$next."\n";</div><div> fwrite($f, $callFileContent);</div><div> fclose($f);</div><div> chmod($callFile, 0777);</div><div>}</div><div>?></div><div>____________________________________________________________________________</div><div>mac@almighty ~ $ ls /usr/share/asterisk/agi-bin/ -l</div><div>total 4</div><div>-rwxrwxrwx 1 root root 1166 Feb 20 15:48 generateCall.php</div><div>____________________________________________________________________________</div><div>mac@almighty ~ $ ls /var/spool/asterisk/ -l</div><div>total 28</div><div>drwxrwxrwx 2 root users 4096 Sep 13 06:59 dictate</div><div>drwxrwxrwx 2 root users 4096 Sep 13 06:59 meetme</div><div>drwxrwxrwx 2 root users 4096 Sep 13 06:59 monitor</div><div>drwxrwxrwx 2 root users 4096 Feb 20 20:39 outgoing</div><div>drwxrwxrwx 2 root users 4096 Sep 13 06:59 system</div><div>drwxrwxrwx 2 root users 4096 Sep 13 06:59 tmp</div><div>drwxrwxrwx 2 root users 4096 Sep 13 06:59 voicemail</div><div>mac@almighty ~ $</div><div>____________________________________________________________________________</div><div>almighty*CLI></div><div>[Feb 20 20:39:32] WARNING[2007]: pbx_spool.c:278 safe_append: Unable to set utime on /var/spool/asterisk/outgoing/9033544852.call: Operation not permitted</div><div> -- Attempting call on dongle/dongle0/9033544852 for call@call:1 (Retry 1)</div><div> > Channel Dongle/dongle0-010000000d was answered.</div><div> -- Executing [call@call:1] Answer("Dongle/dongle0-010000000d", "") in new stack</div><div> -- Executing [call@call:2] Playback("Dongle/dongle0-010000000d", "silence/1") in new stack</div><div> -- <Dongle/dongle0-010000000d> Playing 'silence/1.gsm' (language 'en')</div><div> -- Executing [call@call:3] Playback("Dongle/dongle0-010000000d", "hello-world") in new stack</div><div> -- <Dongle/dongle0-010000000d> Playing 'hello-world.gsm' (language 'en')</div><div> -- Executing [call@call:4] SayDigits("Dongle/dongle0-010000000d", "0") in new stack</div><div> -- <Dongle/dongle0-010000000d> Playing 'digits/0.gsm' (language 'en')</div><div> -- Executing [call@call:5] Hangup("Dongle/dongle0-010000000d", "") in new stack</div><div> == Spawn extension (call, call, 5) exited non-zero on 'Dongle/dongle0-010000000d'</div><div> -- Executing [h@call:1] Set("Dongle/dongle0-010000000d", "NEXT=1") in new stack</div><div> -- Executing [h@call:2] AGI("Dongle/dongle0-010000000d", "generateCall.php,1") in new stack</div><div> -- Launched AGI Script /usr/share/asterisk/agi-bin/generateCall.php</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_request: generateCall.php</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_channel: Dongle/dongle0-010000000d</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_language: en</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_type: Dongle</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_uniqueid: 1361372972.13</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_version: 1.8.13.1~dfsg-1</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_callerid: unknown</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_calleridname: unknown</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_callingpres: 0</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_callingani2: 0</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_callington: 0</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_callingtns: 0</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_dnid: unknown</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_rdnis: unknown</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_context: call</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_extension: h</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_priority: 2</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_enhanced: 0.0</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_accountcode:</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_threadid: 1129301104</div><div><Dongle/dongle0-010000000d>AGI Tx >> agi_arg_1: 1</div><div><Dongle/dongle0-010000000d>AGI Tx >></div><div><Dongle/dongle0-010000000d>AGI Rx << Could not open input file: 1</div><div><Dongle/dongle0-010000000d>AGI Tx >> 510 Invalid or unknown command</div><div> -- <Dongle/dongle0-010000000d>AGI Script generateCall.php completed, returning 0</div><div>[Feb 20 20:39:44] NOTICE[2672]: pbx_spool.c:366 attempt_thread: Call completed to dongle/dongle0/9033544852</div><div>almighty*CLI></div></div><div><br></div>                                            </div></body>
</html>