[Asterisk-java-users] RE: Asterisk-java-users digest, Vol 1 #52 - 2 msgs
Brought to you by:
srt
From: dovb <do...@te...> - 2005-07-16 01:34:19
|
Hi Stephan, Thanks for the reply. Actually, at home I am using AsteriskWin32, since here I have a Windows-based machine... It is supposed to emulate Asterisk 1.0.7 over Cygwin. The correction you made was a mistake of mine when I copied the code to the email, but the issue I have is the following... On AGI Server console I see the following: cc0 cc1 15/07/2005 22:29:41 net.sf.asterisk.util.impl.JavaLoggingLog error SEVERE: AGIException while handling request: Unable to read reply from Asterisk: Connection reset While on Asterisk console, nothing special -- Executing AGI("SIP/dov.bigio-5972", "agi://localhost/TrataAGI.agi") in new stack -- Playing 'digits/1' (language 'en') -- Playing 'digits/2' (language 'en') -- Playing 'digits/3' (language 'en') And no error at all, even with verbose = 10 and debug = 10. Is it possible that AsteriskWin32 doesn't behave well? I'll test my code at the office to see whether it would work on a Linux Red Hat machine! Thank you Dov --- Date: Thu, 14 Jul 2005 12:52:39 -0000 (UTC) Subject: Re: [Asterisk-java-users] Help about agi server From: "Stefan Reuter" <sr...@re...> To: ast...@li... Reply-To: ast...@li... Hi Dov, what version of Asterisk do you use? can you post the relevant section of your asterisk console (use set verbose 9 to enable full output)? When I run your AGI script and press '123#' the channel is hung up at SayDigitsCommand sc =3D new SayDigitsCommand(result); because: -- Playing 'digits/1' (language 'en') -- Playing 'digits/2' (language 'en') -- Playing 'digits/3' (language 'en') Jul 14 20:47:43 WARNING[801]: file.c:475 ast_openstream: File digits/# does not exist in any format Jul 14 20:47:43 WARNING[801]: file.c:779 ast_streamfile: Unable to open digits/# (format alaw): No such file or directory so I had to change that to new SayDigitsCommand(result.substring(0, result.length() - 1)); after that everything went fine. =3DStefan > Hi, > > I have the following simple code: > > After printing "cc1" (after I dial 123) the AGIServer prints > > 13/07/2005 23:28:05 net.sf.asterisk.util.impl.JavaLoggingLog error > SEVERE: AGIException while handling request: Unable to read reply from > Asterisk: Connectio > n reset > > and stops running. > > Where am I going wrong??? > > Thank you! > Dov > > > public class TrataAGI extends AbstractAGIScript > { > public void service(AGIRequest request, AGIChannel channel) throws > AGIException > { > // Answer the channel... > answer(channel); > > // ...say hello... > > String result =3D getNumber(channel); > SayDigitsCommand sc =3D new SayDigitsCommand(result); > System.out.println("aa" + result); > AGIReply rep =3D channel.sendCommand(sc); > System.out.println("bb" + result); > > if (result.substring(0, result.length() - 1).equals("123")) > { > System.out.println("cc0"); > SayNumberCommand cmd =3D new SayNumberCommand(new > Integer("123").toString()); > System.out.println("cc1"); > rep =3D channel.sendCommand(cmd); > System.out.println("cc2"); > } > > if (result.substring(0, result.length() - 1).equals("456")) > { > System.out.println("dd0"); > SayNumberCommand cmd =3D new SayNumberCommand(new > Integer("456").toString()); > System.out.println("dd1"); > rep =3D channel.sendCommand(cmd); > System.out.println("dd2"); > SayNumberCommand snc =3D new SayNumberCommand("11"); > System.out.println("dd3"); > rep =3D channel.sendCommand(snc); > System.out.println("dd4"); > } > > // ...and hangup. > hangup(channel); > } > > private String getNumber(AGIChannel channel) > { > String lido =3D ""; > AGIReply reply =3D null; > StringBuffer result =3D new StringBuffer(); > while (!lido.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; > lido =3D new Character(c).toString(); > result.append(lido); > } > return (result.toString()); > } > |