質問

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.

役に立ちましたか?

解決

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

他のヒント

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top