Thread: [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()); > } > |
From: Stefan R. <sr...@re...> - 2005-07-16 11:52:26
|
On Fri, 2005-07-15 at 22:34 -0300, dovb wrote: > 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. > Is it possible that AsteriskWin32 doesn't behave well? I don't have any experience with Asterisk on the Windows platform. > I'll test my code at the office to see whether it would work on a Linux > Red Hat machine! That sounds like a good idea so we can nail down the problem either to AsteriskWin32 or Asterisk-Java. =3DStefan |
From: Dov B. <do...@te...> - 2005-07-18 14:47:11
|
Hi Stephan, I ran that AGI code under Linux, with Asterisk 1.0.9, and got the following exception on the AGI Console: WARNING: Uncaught exception in Thread AGIServer-TaskThread-0 java.lang.IncompatibleClassChangeError at com.dov.TrataAGI.getNumber(TrataAGI.java:72) at com.dov.TrataAGI.service(TrataAGI.java:22) at net.sf.asterisk.fastagi.AGIConnectionHandler.run(AGIConnectionHandler.java:1 02) at net.sf.asterisk.util.ThreadPool$TaskThread.run(ThreadPool.java:164) I didn't have time to investigate it yet... but I am sending to you meanwhile just fyi. Thanks! Dov On Fri, 2005-07-15 at 22:34 -0300, dovb wrote: > 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. > Is it possible that AsteriskWin32 doesn't behave well? I don't have any experience with Asterisk on the Windows platform. > I'll test my code at the office to see whether it would work on a Linux > Red Hat machine! That sounds like a good idea so we can nail down the problem either to AsteriskWin32 or Asterisk-Java. =Stefan ----- Original Message ----- From: "Stefan Reuter" <sr...@re...> To: <ast...@li...> Sent: Saturday, July 16, 2005 8:52 AM Subject: Re: [Asterisk-java-users] RE: Asterisk-java-users digest, Vol 1 #52 - 2 msgs |
From: Stefan R. <sr...@re...> - 2005-07-18 15:00:46
|
Hi, > WARNING: Uncaught exception in Thread AGIServer-TaskThread-0 > java.lang.IncompatibleClassChangeError > at com.dov.TrataAGI.getNumber(TrataAGI.java:72) > at com.dov.TrataAGI.service(TrataAGI.java:22) > at > net.sf.asterisk.fastagi.AGIConnectionHandler.run(AGIConnectionHandler.j= ava:1 > 02) > at > net.sf.asterisk.util.ThreadPool$TaskThread.run(ThreadPool.java:164) without having a look at this in detail a IncompatibleClassChangeError sounds like you didn't compile your classes against the version of Asterisk-Java that you are now running. Compile your .java files again using the same asterisk-java.jar you will later use when running the application. =3DStefan |
From: Dov B. <do...@te...> - 2005-07-18 15:19:18
|
Yeah.. that was it. But the problem I had under AsteriskWin32 still happens here under Linux = red hat + asterisk 1.0.9... After printing "cc1", my application fails with the following: aa123# bb123# cc0 cc1 18/07/2005 12:15:20 net.sf.asterisk.util.impl.JavaLoggingLog error SEVERE: AGIException while handling request: Channel was hang up. Thank you Dov answer(channel); 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"); channel.sendCommand(cmd); System.out.println("cc2"); } ----- Original Message -----=20 From: "Stefan Reuter" <sr...@re...> To: <ast...@li...> Sent: Monday, July 18, 2005 12:00 PM Subject: Re: [Asterisk-java-users] RE: Asterisk-java-users digest, Vol 1#52 - 2 msgs Hi, > WARNING: Uncaught exception in Thread AGIServer-TaskThread-0 > java.lang.IncompatibleClassChangeError > at com.dov.TrataAGI.getNumber(TrataAGI.java:72) > at com.dov.TrataAGI.service(TrataAGI.java:22) > at > net.sf.asterisk.fastagi.AGIConnectionHandler.run(AGIConnectionHandler.jav= a:1 > 02) > at > net.sf.asterisk.util.ThreadPool$TaskThread.run(ThreadPool.java:164) without having a look at this in detail a IncompatibleClassChangeError sounds like you didn't compile your classes against the version of Asterisk-Java that you are now running. Compile your .java files again using the same asterisk-java.jar you will later use when running the application. =3DStefan ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Stefan R. <sr...@re...> - 2005-07-20 05:41:53
|
Sorry i am still unable to reproduce that bug. Everything works fine here using either Asterisk CVS-HEAD or 1.0.7. =3DStefan On Mon, 2005-07-18 at 12:17 -0300, Dov Bigio wrote: > Yeah.. that was it. >=20 > But the problem I had under AsteriskWin32 still happens here under Linux = red > hat + asterisk 1.0.9... >=20 > After printing "cc1", my application fails with the following: >=20 > aa123# > bb123# > cc0 > cc1 > 18/07/2005 12:15:20 net.sf.asterisk.util.impl.JavaLoggingLog error > SEVERE: AGIException while handling request: Channel was hang up. >=20 > Thank you > Dov >=20 > answer(channel); > 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); >=20 > 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"); > channel.sendCommand(cmd); > System.out.println("cc2"); > } >=20 >=20 > ----- Original Message -----=20 > From: "Stefan Reuter" <sr...@re...> > To: <ast...@li...> > Sent: Monday, July 18, 2005 12:00 PM > Subject: Re: [Asterisk-java-users] RE: Asterisk-java-users digest, Vol > 1#52 - 2 msgs >=20 >=20 > Hi, >=20 > > WARNING: Uncaught exception in Thread AGIServer-TaskThread-0 > > java.lang.IncompatibleClassChangeError > > at com.dov.TrataAGI.getNumber(TrataAGI.java:72) > > at com.dov.TrataAGI.service(TrataAGI.java:22) > > at > > > net.sf.asterisk.fastagi.AGIConnectionHandler.run(AGIConnectionHandler.jav= a:1 > > 02) > > at > > net.sf.asterisk.util.ThreadPool$TaskThread.run(ThreadPool.java:164) >=20 > without having a look at this in detail a IncompatibleClassChangeError > sounds like you didn't compile your classes against the version of > Asterisk-Java that you are now running. > Compile your .java files again using the same asterisk-java.jar you will > later use when running the application. >=20 > =3DStefan >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dclick > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
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); } |
From: Stefan R. <sr...@re...> - 2005-07-23 09:12:20
|
> 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 |
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 |
From: Peter H. <pe...@li...> - 2005-07-25 21:45:04
|
Is there any way to tell what the cause of an originate failure is? Specifically, I'd like to be able to find out if the provider accepted the call and the there was a timeout waiting for the user to answer or if the provider accepted the call, but was unable to process it for other reasons. (i.e. i should try a different provider) Peter |
From: Stefan R. <sr...@re...> - 2005-07-26 13:29:37
|
Hi Peter, > Is there any way to tell what the cause of an originate failure is? i don't think there currently is an easy one. Maybe you can observe the NewStateEvents that of the channel... but it is not an attribute that is supported out of the box. =3DStefan |
From: Peter H. <pe...@li...> - 2005-07-27 08:27:17
|
Thanks Stefan, A question about the FastAGI stuff in general. Many of the functions=20 provided by AbstractAGIScript allow DTMF input to be received from the=20 server. Is there a way to catch multiple dtmf input instead of a single character= ? i.e. I can wait for any digit from 0-9, but I can't wait for '10'.. Thanks, Peter ----- Original Message -----=20 From: "Stefan Reuter" <sr...@re...> To: <ast...@li...> Sent: Tuesday, July 26, 2005 6:29 AM Subject: Re: [Asterisk-java-users] Originate Failure Events > Hi Peter, > >> Is there any way to tell what the cause of an originate failure is? > > i don't think there currently is an easy one. > Maybe you can observe the NewStateEvents that of the channel... > but it is not an attribute that is supported out of the box. > > =3DStefan > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=CCk > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >=20 |
From: Peter H. <pe...@li...> - 2005-07-27 10:50:19
|
Another question related to receiving dtmf. I'm trying to emulate "Background" functionality when streaming audio... I'm playing audio, while expecting dtmf input. However, sometimes the dt= mf=20 is not picked up by my implementation of AgiScript. Here's a simplified version of the code: int attempts=3D0; String validResponse=3D"0123456789"; while (attempts<=3D3) { attempts++; char responseCode; responseCode =3D streamFile(channel, "tt-weasels",=20 validResponses); if (responseCode =3D=3D '1') break; responseCode =3D streamFile(channel, "silence/5",=20 validResponses); if (responseCode =3D=3D '1') break; } Any thoughts? Thanks, Peter ----- Original Message -----=20 From: "Peter Hsu" <pe...@li...> To: <ast...@li...> Sent: Wednesday, July 27, 2005 1:29 AM Subject: [Asterisk-java-users] FastAGI question > Thanks Stefan, > > A question about the FastAGI stuff in general. Many of the functions=20 > provided by AbstractAGIScript allow DTMF input to be received from the=20 > server. > > Is there a way to catch multiple dtmf input instead of a single charact= er? > > i.e. I can wait for any digit from 0-9, but I can't wait for '10'.. > > Thanks, > Peter > > ----- Original Message -----=20 > From: "Stefan Reuter" <sr...@re...> > To: <ast...@li...> > Sent: Tuesday, July 26, 2005 6:29 AM > Subject: Re: [Asterisk-java-users] Originate Failure Events > > >> Hi Peter, >> >>> Is there any way to tell what the cause of an originate failure is? >> >> i don't think there currently is an easy one. >> Maybe you can observe the NewStateEvents that of the channel... >> but it is not an attribute that is supported out of the box. >> >> =3DStefan >> >> >> >> ------------------------------------------------------- >> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies >> from IBM. Find simple to follow Roadmaps, straightforward articles, >> informative Webcasts and more! Get everything you need to get up to >> speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=CCk >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=CCk > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >=20 |