本文介绍了AGI 脚本执行没有错误,但没有生成结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用星号 AGI 运行 shell 脚本.我已经使用了这里提到的教程http://www.shiffman.net/p5/asterisk/

I am trying to run a shell script using asterisk AGI. I have used the tutorial mentioned herehttp://www.shiffman.net/p5/asterisk/

我的extensions.conf如下

My extensions.conf is as follows

[default]
include => clicall

[clicall]
exten => _X,1,Goto(s,1);
exten => _X.,1,Goto(s,1);
exten => s,1,Answer();
exten => s,n,EAGI(runEAGI.sh);

我尝试运行的脚本(runEAGI.sh)如下

The script I am trying to run (runEAGI.sh) is as follows

#!/bin/bash
java /home/sphata001/Downloads/EAGI/JEAGIClient $$

权限设置为755,脚本放在/var/lib/asterisk/agi-bin/.java文件(JEAGIClient)也已经预先编译好了.手动执行脚本时,它运行良好并连接到服务器.但是当从 SIP 客户端拨打电话时,脚本根据星号控制台执行,但看不到结果.我在控制台中得到以下输出

The permissions have been set as 755 and the script is placed in /var/lib/asterisk/agi-bin/. The java file(JEAGIClient) has been compiled beforehand as well . When executing the script manually it runs fine and connects to the server.But when making a call from SIP client the script executes according to asterisk console but no results are to seen.I get the following output in the console

 == Using SIP RTP CoS mark 5
    -- Executing [888@default:1] Goto("SIP/1001-00000027", "s,1") in new stack
    -- Goto (default,s,1)
    -- Executing [s@default:1] Answer("SIP/1001-00000027", "") in new stack
    -- Executing [s@default:2] EAGI("SIP/1001-00000027", "runEAGI.sh") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/runEAGI.sh
    -- <SIP/1001-00000027>AGI Script runEAGI.sh completed, returning 0
    -- Auto fallthrough, channel 'SIP/1001-00000027' status is 'UNKNOWN'

有什么解决办法吗?

谢谢.

推荐答案

最有可能 - 您需要指定 java 的完整路径.

Most likly - you need specify full path to java.

提示:对于调试 asterisk AGI,简单的解决方案是停止 asterisk 并启动它附加到控制台,这样您将看到所有脚本错误.

Hint: For debugging asterisk AGI simple solution is stop asterisk and start it attached to console, that way you will see all script errors.

asterisk -rx "core stop now"
asterisk -vvvvgc

也可以在 asterisk 控制台中启用 AGI 调试:

Also can be usfull enable AGI debugging in asterisk console:

agi set debug on

这篇关于AGI 脚本执行没有错误,但没有生成结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 18:48