我正在使用PHPAGI,我有一点麻烦。我把这个问题简化为只有几行代码。首先,我的上下文:
[script]
exten=>s,1,AGI(asterisk_callback.php)
我的实际代码(使用Laravel 4):
Log::info('[callback script] Creating PHPAGI..');
$agi = new AGI();
Log::info('[callback script] Trying noop..');
$agi->noop('Can you see me?');
Log::info('[callback script] Success!');
当我删除。call文件时,我确实会收到一个呼叫。一旦我回答了,我的日志就会收到前两条消息。然后挂在$agi->noop()上。我的电话将保持在线状态,一旦我挂断电话,脚本将继续并记录"成功!"
Asterisk有如下日志:
Connected to Asterisk 11.7.0~dfsg-1ubuntu1 currently running on playground (pid = 26298)
> Channel SIP/vitel-outbound-00000000 was answered
-- Executing [s@callback_script:1] AGI("SIP/vitel-outbound-00000000", "asterisk_callback.php,53,SIP/vitel-outbound-00000000") in new stack
-- Launched AGI Script /usr/share/asterisk/agi-bin/asterisk_callback.php
> 0x7f84dc0181d0 -- Probation passed - setting RTP source address to 64.2.142.190:15106
…在我挂断电话之前,这里都僵住了。然后得到:
-- <SIP/vitel-outbound-00000000>AGI Script asterisk_callback.php completed, returning 4
== Spawn extension (callback_script, s, 1) exited non-zero on 'SIP/vitel-outbound-00000000'
[Jun 20 12:33:44] NOTICE[26511]: pbx_spool.c:402 attempt_thread: Call completed to SIP/2144769335@vitel-outbound/n
我做错了什么phpagi?
找到问题。我实际上有AGI()调用一个脚本,它运行Laravel作为一个工匠命令。我认为问题是标准输入/输出没有被路由到脚本中的exec()命令。我将在另一篇文章中以不同的方式问这个问题。