RE: [Asterisk-java-users] RE: connection reset
Brought to you by:
srt
|
From: dovb <do...@te...> - 2005-07-25 01:04:59
|
Sorry!!!!
I saw the error, and fixed it!
Thank you
Dov
-----Original Message-----
From: ast...@li...
[mailto:ast...@li...] On Behalf Of
Stefan Reuter
Sent: s=E1bado, 23 de julho de 2005 06:11
To: ast...@li...
Subject: RE: [Asterisk-java-users] RE: connection reset
> Sorry to insist on this... But I have tried several times, even
no problem i will reply again. you sill the same error in your script.
> simplifying the already simple test, and it still doesn't work!
that while loop is totally crazy plus it doesnt strip the # so you are
still sending the # to asterisk. this gets asterisk into trouble because
there is no sound file for a # digit. you can still see this on
asterisk's console (please look there using a high verbosity level!):
-- Playing 'digits/1' (language 'en')
-- Playing 'digits/2' (language 'en')
-- Playing 'digits/3' (language 'en')
Jul 23 16:59:28 WARNING[801]: file.c:475 ast_openstream: File digits/#
does notexist in any format Jul 23 16:59:28 WARNING[801]: file.c:779
ast_streamfile: Unable to open digits/# (format ulaw): No such file or
directory
that causes asterisk to hangup the channel and thats what Asterisk-Java
reports (actually it notices the hangup not until you try to send the
next command thats why it stll prints the "will play agent-newlocation
again").
Please fix your java code!
suggestion:
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 =3D "";
AGIReply reply =3D null;
StringBuffer result =3D new StringBuffer();
while (!read.equals("#"))
{
WaitForDigitCommand wc =3D new WaitForDigitCommand();
try
{
reply =3D channel.sendCommand(wc);
}
catch (AGIException e)
{
e.printStackTrace();
System.exit(0);
}
String resp =3D (String) reply.getResult();
int number =3D new Integer(resp).intValue();
char c =3D (char) number;
read =3D new Character(c).toString();
// don't add the # sign!
if (!read.equals("#"))
{
result.append(read);
}
}
SayDigitsCommand sc =3D new SayDigitsCommand(result.toString());
AGIReply rep =3D channel.sendCommand(sc);
System.out.println("will play agent-newlocation again");
streamFile(channel, "agent-newlocation");
hangup(channel);
}
=3DStefan
|