In the code below I set the channel to automatically hang up in 10 seconds, but nothing happens.
import org.asteriskjava.fastagi.AgiChannel;
import org.asteriskjava.fastagi.AgiException;
import org.asteriskjava.fastagi.AgiRequest;
import org.asteriskjava.fastagi.BaseAgiScript;
public class AgiServer extends BaseAgiScript
{
public void service(AgiRequest request, AgiChannel channel)
throws AgiException
{
exec("Dial","SIP/"+request.getExtension()+"");
channel.setAutoHangup(10);
hangup();
}
}
In your code nothing happens after Dial line until your phone call will be hanguped.
You should use dial command L or S param or set timeout BEFORE dialling