Hi everyone,
I’m learning using AGI. I created a very very simple php file:
#! /usr/bin/php -q
<?php require("/var/lib/asterisk/agi-bin/phpagi.php"); set_time_limit(30); error_reporting(E-ALL); $agi = new AGI(); $agi->answer(); $agi->exec_dial("SIP","201"); $agi->stream_file('demo-congrats','123'); $agi->hangup(); ?>.It did work and I got error like this:
[Oct 13 16:21:57] VERBOSE[3187] logger.c: == Parsing ‘/etc/asterisk/manager.conf’: [Oct 13 16:21:57] VERBOSE[3187] logger.c: Found
[Oct 13 16:21:57] VERBOSE[3187] logger.c: == Parsing ‘/etc/asterisk/manager_additional.conf’: [Oct 13 16:21:57] VERBOSE[3187] logger.c: Found
[Oct 13 16:21:57] VERBOSE[3187] logger.c: == Parsing ‘/etc/asterisk/manager_custom.conf’: [Oct 13 16:21:57] VERBOSE[3187] logger.c: Found
[Oct 13 16:21:57] VERBOSE[3187] logger.c: == Manager ‘admin’ logged on from 127.0.0.1
[Oct 13 16:21:58] VERBOSE[3187] logger.c: == Manager ‘admin’ logged off from 127.0.0.1
[Oct 13 16:22:05] VERBOSE[3192] logger.c: – Executing [789@from-internal:1] Answer(“SIP/208-0894e688”, “”) in new stack
[Oct 13 16:22:05] VERBOSE[3192] logger.c: – Executing [789@from-internal:2] Festival(“SIP/208-0894e688”, “Hello”) in new stack
[Oct 13 16:22:05] VERBOSE[3192] logger.c: == Parsing ‘/etc/asterisk/festival.conf’: [Oct 13 16:22:05] VERBOSE[3192] logger.c: Found
[Oct 13 16:22:05] DEBUG[3192] app_festival.c: Text passed to festival server : Hello
[Oct 13 16:22:05] DEBUG[3192] app_festival.c: Passing text to festival…
[Oct 13 16:22:05] DEBUG[3192] app_festival.c: Passing data to channel…
[Oct 13 16:22:05] DEBUG[3192] app_festival.c: Festival WV command
[Oct 13 16:22:05] ERROR[3192] channel.c: ast_read() called with no recorded file descriptor.
[Oct 13 16:22:06] DEBUG[3192] app_festival.c: Last frame
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Executing [789@from-internal:3] AGI(“SIP/208-0894e688”, “simpleAgi.php”) in new stack
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Launched AGI Script /var/lib/asterisk/agi-bin/simpleAgi.php
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] ERROR[3192] utils.c: write() returned error: Broken pipe
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – AGI Script simpleAgi.php completed, returning 0
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Executing [789@from-internal:4] Hangup(“SIP/208-0894e688”, “”) in new stack
[Oct 13 16:22:06] VERBOSE[3192] logger.c: == Spawn extension (from-internal, 789, 4) exited non-zero on ‘SIP/208-0894e688’
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Executing [h@from-internal:1] Macro(“SIP/208-0894e688”, “hangupcall”) in new stack
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Executing [s@macro-hangupcall:1] GotoIf(“SIP/208-0894e688”, “1?skiprg”) in new stack
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Goto (macro-hangupcall,s,4)
[Oct 13 16:22:06] DEBUG[3192] app_macro.c: Executed application: GotoIf
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Executing [s@macro-hangupcall:4] GotoIf(“SIP/208-0894e688”, “1?skipblkvm”) in new stack
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Goto (macro-hangupcall,s,7)
[Oct 13 16:22:06] DEBUG[3192] app_macro.c: Executed application: GotoIf
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Executing [s@macro-hangupcall:7] GotoIf(“SIP/208-0894e688”, “1?theend”) in new stack
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Goto (macro-hangupcall,s,9)
[Oct 13 16:22:06] DEBUG[3192] app_macro.c: Executed application: GotoIf
[Oct 13 16:22:06] VERBOSE[3192] logger.c: – Executing [s@macro-hangupcall:9] Hangup(“SIP/208-0894e688”, “”) in new stack
[Oct 13 16:22:06] VERBOSE[3192] logger.c: == Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/208-0894e688’ in macro ‘hangupcall’
[Oct 13 16:22:06] VERBOSE[3192] logger.c: == Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/208-0894e688’
[Oct 13 16:22:09] NOTICE[2935] chan_sip.c: Registration from ‘sip:[email protected]’ failed for ‘172.25.2.41’ - No matching peer found
[Oct 13 16:22:10] NOTICE[2935] chan_sip.c: Registration from ‘sip:[email protected]’ failed for ‘172.25.2.41’ - No matching peer found
[Oct 13 16:22:10] NOTICE[2935] chan_sip.c: Registration from ‘sip:[email protected]’ failed for ‘172.25.2.41’ - No matching peer found
[Oct 13 16:22:10] NOTICE[2935] chan_sip.c: Registration from ‘sip:[email protected]’ failed for ‘172.25.2.41’ - No matching peer found
[Oct 13 16:22:10] NOTICE[2935] chan_sip.c: Registration from ‘sip:[email protected]’ failed for ‘172.25.2.41’ - No matching peer found
[Oct 13 16:22:10] NOTICE[2935] chan_sip.c: Registration from ‘sip:[email protected]’ failed for ‘172.25.2.41’ - No matching peer found
[Oct 13 16:22:11] VERBOSE[3196] logger.c: == Parsing ‘/etc/asterisk/manager.conf’: [Oct 13 16:22:11] VERBOSE[3196] logger.c: Found
[Oct 13 16:22:11] VERBOSE[3196] logger.c: == Parsing ‘/etc/asterisk/manager_additional.conf’: [Oct 13 16:22:11] VERBOSE[3196] logger.c: Found
[Oct 13 16:22:11] VERBOSE[3196] logger.c: == Parsing ‘/etc/asterisk/manager_custom.conf’: [Oct 13 16:22:11] VERBOSE[3196] logger.c: Found
[Oct 13 16:22:11] VERBOSE[3196] logger.c: == Manager ‘admin’ logged on from 127.0.0.1
Here is my very simple dial plan:
[from-internal]
exten => 789,1,Answer()
exten => 789,n,Festival(Hello)
exten => 789,n,AGI(simpleAgi.php)
exten => 789,n,Hangup()
Could you please help me? It took me a day trying to figure out the problem is search help on internet but I got no luck.
Please help!
Thanks in advance,