RE: [Asterisk-java-users] RE: connection reset
Brought to you by:
srt
|
From: dovb <do...@te...> - 2005-07-23 04:53:08
|
Hi Stephan,
Sorry to insist on this... But I have tried several times, even
simplifying the already simple test, and it still doesn't work!
In the example code below, after I dial "123#" I hear it saying 1,2,3
and just after printing "will play agent-newlocation again", I still get
the following message:
23/07/2005 01:49:28 net.sf.asterisk.util.impl.JavaLoggingLog error
SEVERE: AGIException while handling request: Unable to read reply from
Asterisk: Connection reset
The connection is then Hangup...
What else could be wrong??? The file "agent-newlocation" exists, since
it plays correctly on the first time!
Thank you again!
Dov
public void service(AGIRequest request, AGIChannel channel) throws
AGIException
{
// Answer the channel...
answer(channel);
System.out.println("will play agent-newlocation");
streamFile(channel, "agent-newlocation");
String read = "";
AGIReply reply = null;
StringBuffer result = new StringBuffer();
while (!read.equals("#"))
{
WaitForDigitCommand wc = new WaitForDigitCommand();
try
{
reply = channel.sendCommand(wc);
}
catch (AGIException e)
{
e.printStackTrace();
System.exit(0);
}
String resp = (String) reply.getResult();
int number = new Integer(resp).intValue();
char c = (char) number;
read = new Character(c).toString();
result.append(read);
}
SayDigitsCommand sc = new SayDigitsCommand(result.toString());
AGIReply rep = channel.sendCommand(sc);
System.out.println("will play agent-newlocation again");
streamFile(channel, "agent-newlocation");
hangup(channel);
}
|