AGI script executes without error , but no results generated

懵懂的女人 提交于 2019-12-12 18:26:14

问题


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

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);

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

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

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'

Any solutions?

Thank you.


回答1:


Most likly - you need specify full path to java.

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

Also can be usfull enable AGI debugging in asterisk console:

agi set debug on



回答2:


Check that the script and any resources it requires is owned by the Asterisk user, and that SELinux is not preventing the script from running correctly



来源:https://stackoverflow.com/questions/15265972/agi-script-executes-without-error-but-no-results-generated

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!