Thread: Re: [Asterisk-java-users] RedirectAction to MeetMe
Brought to you by:
srt
From: Johannes B. <j....@ad...> - 2006-10-16 15:49:16
|
Indeed I'm using a bristuffed one. I've already read a posting from you = somewhere regarding that bug (but somehow I thought it's not related to = my problem O_o). I'll check that at once. =20 Thanks and sorry for double posting. |
From: Stefan R. <ste...@re...> - 2006-10-16 23:18:18
Attachments:
signature.asc
|
Johannes Boesl wrote: > Indeed I'm using a bristuffed one. I've already read a posting from you= > somewhere regarding that bug (but somehow I thought it's not related to= > my problem O_o). I'll check that at once. Hehe I hope it solves the problem. If not feel free to tell us and I'll have a deeper look. The bristuff thing is just the first issue I thought of as it already caused a lot of headache for me, especially with new versions of Asterisk where I missed to apply it :) Just out of curioristy, is your JTAPI stuff related to Jens Wilke's project (http://asterisk-jtapi.sourceforge.net/) or different? =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: ste...@re... Jabber: ste...@re... |
From: Johannes B. <j....@ad...> - 2006-10-17 01:27:42
|
Well, I think the issue has to be located somewhere else. I've patched = my bristuff and tried it on a fresh trixbox install, too. The same = result: it keeps telling me one of the channels does not exist. In case = I try redirectAction with two channels I'm told the second channel = (connected to Zap/1 e.g.) does not exist. And I'm always disconnected = afterwards. Well I can't remember more details at the moment. As to asterisk-jtapi ... it's not related to that. I gave it a try once = and couldn't get it running so I sticked to the asterisk-provider I = checked into GJTapi-cvs a year or so ago. That one worked fine for me so = far and that's why I'm continuing with it. I don't want to offend = someone but besides the GJTapi project is a better place for an = GJTapi-provider than a separate sourceforge project I think. Johannes Boesl |
From: Johannes B. <j....@ad...> - 2006-10-18 13:52:01
|
Okay ... it was my fault. My calls store some details with the = channel-names in it and I accidentally used channel.toString() in one = place instead of channel.getName(). I still get hangups on redirect but at least it is done without an error = now. |
From: King H. <kin...@ne...> - 2006-10-19 11:03:25
|
Hi, I am having a very strange problem (probably a timing problem) with asterisk-java-m1. I am using the = DefaultAsteriskServer.originateToExtension method as follows: defaultAsteriskServer =3D new DefaultAsteriskServer("192.168.0.238", "testing", "testing123"); defaultAsteriskServer.initialize(); =20 defaultAsteriskServer.originateToExtension("SIP/1000@ray_server","testing= "," 1003",1,30000); The call did go through OK but there is a NoSuchChannelException thown. Below is the console output along with stack trace from the exception: 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.0.238:5038 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done org.asteriskjava.live.NoSuchChannelException: Channel = 'SIP/1000@ray_server' is not available at org.asteriskjava.live.internal.AsteriskServerImpl.originate(AsteriskServe= rIm pl.java:339) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:278) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:258) at org.asteriskjava.live.DefaultAsteriskServer.originateToExtension(DefaultA= ste riskServer.java:133) at hk.com.csl.asterisk_java_example.Manager.run(Manager.java:29) at hk.com.csl.asterisk_java_example.Manager.main(Manager.java:40) 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/ray_server-09e11ee0(1161253134.58) Based on the console output, the problem seems to be that the = "Newchannel" event was processed after the "OriginateSuccess" event so when it tried = to lookup the channel, it wasn't added yet. I have connected to the Asterisk Manager port and look at the order in = which the events are happening and Newchannel is happening before = OriginateSuccess which is correct. The version of Asterisk that I am using is 1.2.12.1 and also tried with = 1.2. 13 with the same problem. Thanks. Best Regards, King |
From: King H. <kin...@ne...> - 2006-10-20 04:03:48
|
Hi, After looking at the code more in detail, it seems that DefaultAsteriskServer will use ManagerEventListenerProxy to handle the dispatch of events asynchronously. However, it looks like the onManagerEvent() of ManagerEventListenerProxy will create a separate = thread for each event so that the system may finish handling a later arrive = event earlier than a previously arrive event. I think having each event being handled in a separate thread may create problem in saturations where a later arrived event depends on the = complete processing of a previously arrived event. I think one way to achive serialization of the event handling is to = append the events in a queue in onManagerEvent() of ManagerEventListenerProxy. = And ManagerEventListenerProxy (probably make it a Runnable) will run a = separate thread getting events from the queue and call = target.onManagerEvent(event). This is one way I can think of that will do it but may not be the best = way. Thanks. Best Regards, King -----=AD=EC=A9l=B6l=A5=F3----- =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Thursday, 19 October, 2006 19:03 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users] Strange problem with = originateToExtension Hi, I am having a very strange problem (probably a timing problem) with asterisk-java-m1. I am using the = DefaultAsteriskServer.originateToExtension method as follows: defaultAsteriskServer =3D new DefaultAsteriskServer("192.168.0.238", "testing", "testing123"); defaultAsteriskServer.initialize(); =20 defaultAsteriskServer.originateToExtension("SIP/1000@ray_server","testing= "," 1003",1,30000); The call did go through OK but there is a NoSuchChannelException thown. Below is the console output along with stack trace from the exception: 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.0.238:5038 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done org.asteriskjava.live.NoSuchChannelException: Channel = 'SIP/1000@ray_server' is not available at org.asteriskjava.live.internal.AsteriskServerImpl.originate(AsteriskServe= rIm pl.java:339) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:278) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:258) at org.asteriskjava.live.DefaultAsteriskServer.originateToExtension(DefaultA= ste riskServer.java:133) at hk.com.csl.asterisk_java_example.Manager.run(Manager.java:29) at hk.com.csl.asterisk_java_example.Manager.main(Manager.java:40) 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/ray_server-09e11ee0(1161253134.58) Based on the console output, the problem seems to be that the = "Newchannel" event was processed after the "OriginateSuccess" event so when it tried = to lookup the channel, it wasn't added yet. I have connected to the Asterisk Manager port and look at the order in = which the events are happening and Newchannel is happening before = OriginateSuccess which is correct. The version of Asterisk that I am using is 1.2.12.1 and also tried with = 1.2. 13 with the same problem. Thanks. Best Regards, King __________ NOD32 1.1810 (20061018) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk |
From: King H. <kin...@ne...> - 2006-10-20 06:47:16
|
Sorry, I missed this: public ManagerEventListenerProxy() { this.executor =3D Executors.newSingleThreadExecutor(new DaemonThreadFactory()); } So the handling of event is serialized. Please ignore my previous post!! Best Regards, King -----=AD=EC=A9l=B6l=A5=F3----- =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Friday, 20 October, 2006 12:03 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: Re: [Asterisk-java-users] Strange problem with = originateToExtension Hi, After looking at the code more in detail, it seems that DefaultAsteriskServer will use ManagerEventListenerProxy to handle the dispatch of events asynchronously. However, it looks like the onManagerEvent() of ManagerEventListenerProxy will create a separate = thread for each event so that the system may finish handling a later arrive = event earlier than a previously arrive event. I think having each event being handled in a separate thread may create problem in saturations where a later arrived event depends on the = complete processing of a previously arrived event. I think one way to achive serialization of the event handling is to = append the events in a queue in onManagerEvent() of ManagerEventListenerProxy. = And ManagerEventListenerProxy (probably make it a Runnable) will run a = separate thread getting events from the queue and call = target.onManagerEvent(event). This is one way I can think of that will do it but may not be the best = way. Thanks. Best Regards, King -----=AD=EC=A9l=B6l=A5=F3----- =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Thursday, 19 October, 2006 19:03 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users] Strange problem with = originateToExtension Hi, I am having a very strange problem (probably a timing problem) with asterisk-java-m1. I am using the = DefaultAsteriskServer.originateToExtension method as follows: defaultAsteriskServer =3D new DefaultAsteriskServer("192.168.0.238", "testing", "testing123"); defaultAsteriskServer.initialize(); =20 defaultAsteriskServer.originateToExtension("SIP/1000@ray_server","testing= "," 1003",1,30000); The call did go through OK but there is a NoSuchChannelException thown. Below is the console output along with stack trace from the exception: 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.0.238:5038 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done org.asteriskjava.live.NoSuchChannelException: Channel = 'SIP/1000@ray_server' is not available at org.asteriskjava.live.internal.AsteriskServerImpl.originate(AsteriskServe= rIm pl.java:339) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:278) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:258) at org.asteriskjava.live.DefaultAsteriskServer.originateToExtension(DefaultA= ste riskServer.java:133) at hk.com.csl.asterisk_java_example.Manager.run(Manager.java:29) at hk.com.csl.asterisk_java_example.Manager.main(Manager.java:40) 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/ray_server-09e11ee0(1161253134.58) Based on the console output, the problem seems to be that the = "Newchannel" event was processed after the "OriginateSuccess" event so when it tried = to lookup the channel, it wasn't added yet. I have connected to the Asterisk Manager port and look at the order in = which the events are happening and Newchannel is happening before = OriginateSuccess which is correct. The version of Asterisk that I am using is 1.2.12.1 and also tried with = 1.2. 13 with the same problem. Thanks. Best Regards, King __________ NOD32 1.1810 (20061018) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk __________ NOD32 1.1810 (20061018) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk |
From: King H. <kin...@ne...> - 2006-10-20 10:12:31
|
Sorry, I missed this: public ManagerEventListenerProxy() { this.executor =3D Executors.newSingleThreadExecutor(new DaemonThreadFactory()); } So the handling of event is serialized. Please ignore my previous post!! Best Regards, King -----=AD=EC=A9l=B6l=A5=F3----- =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Friday, 20 October, 2006 12:03 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: Re: [Asterisk-java-users] Strange problem with = originateToExtension Hi, After looking at the code more in detail, it seems that DefaultAsteriskServer will use ManagerEventListenerProxy to handle the dispatch of events asynchronously. However, it looks like the onManagerEvent() of ManagerEventListenerProxy will create a separate = thread for each event so that the system may finish handling a later arrive = event earlier than a previously arrive event. I think having each event being handled in a separate thread may create problem in saturations where a later arrived event depends on the = complete processing of a previously arrived event. I think one way to achive serialization of the event handling is to = append the events in a queue in onManagerEvent() of ManagerEventListenerProxy. = And ManagerEventListenerProxy (probably make it a Runnable) will run a = separate thread getting events from the queue and call = target.onManagerEvent(event). This is one way I can think of that will do it but may not be the best = way. Thanks. Best Regards, King -----=AD=EC=A9l=B6l=A5=F3----- =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Thursday, 19 October, 2006 19:03 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users] Strange problem with = originateToExtension Hi, I am having a very strange problem (probably a timing problem) with asterisk-java-m1. I am using the = DefaultAsteriskServer.originateToExtension method as follows: defaultAsteriskServer =3D new DefaultAsteriskServer("192.168.0.238", "testing", "testing123"); defaultAsteriskServer.initialize(); =20 defaultAsteriskServer.originateToExtension("SIP/1000@ray_server","testing= "," 1003",1,30000); The call did go through OK but there is a NoSuchChannelException thown. Below is the console output along with stack trace from the exception: 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.0.238:5038 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done org.asteriskjava.live.NoSuchChannelException: Channel = 'SIP/1000@ray_server' is not available at org.asteriskjava.live.internal.AsteriskServerImpl.originate(AsteriskServe= rIm pl.java:339) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:278) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:258) at org.asteriskjava.live.DefaultAsteriskServer.originateToExtension(DefaultA= ste riskServer.java:133) at hk.com.csl.asterisk_java_example.Manager.run(Manager.java:29) at hk.com.csl.asterisk_java_example.Manager.main(Manager.java:40) 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/ray_server-09e11ee0(1161253134.58) Based on the console output, the problem seems to be that the = "Newchannel" event was processed after the "OriginateSuccess" event so when it tried = to lookup the channel, it wasn't added yet. I have connected to the Asterisk Manager port and look at the order in = which the events are happening and Newchannel is happening before = OriginateSuccess which is correct. The version of Asterisk that I am using is 1.2.12.1 and also tried with = 1.2. 13 with the same problem. Thanks. Best Regards, King __________ NOD32 1.1810 (20061018) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk __________ NOD32 1.1810 (20061018) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk |
From: King H. <kin...@ne...> - 2006-10-26 09:55:39
|
Stefan, Do you have a chance to look at this problem? My feeling is that the originateToExtension() method may not always be able to return the = channel used. It depends on the order in which responses and events are handled. = Thanks. King -----=AD=EC=A9l=B6l=A5=F3----- =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Thursday, 19 October, 2006 19:03 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users] Strange problem with = originateToExtension Hi, I am having a very strange problem (probably a timing problem) with asterisk-java-m1. I am using the = DefaultAsteriskServer.originateToExtension method as follows: defaultAsteriskServer =3D new DefaultAsteriskServer("192.168.0.238", "testing", "testing123"); defaultAsteriskServer.initialize(); =20 defaultAsteriskServer.originateToExtension("SIP/1000@ray_server","testing= "," 1003",1,30000); The call did go through OK but there is a NoSuchChannelException thown. Below is the console output along with stack trace from the exception: 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.0.238:5038 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done org.asteriskjava.live.NoSuchChannelException: Channel = 'SIP/1000@ray_server' is not available at org.asteriskjava.live.internal.AsteriskServerImpl.originate(AsteriskServe= rIm pl.java:339) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:278) at org.asteriskjava.live.internal.AsteriskServerImpl.originateToExtension(As= ter iskServerImpl.java:258) at org.asteriskjava.live.DefaultAsteriskServer.originateToExtension(DefaultA= ste riskServer.java:133) at hk.com.csl.asterisk_java_example.Manager.run(Manager.java:29) at hk.com.csl.asterisk_java_example.Manager.main(Manager.java:40) 2006=A6~10=A4=EB19=A4=E9 =A4U=A4=C806:19:40 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/ray_server-09e11ee0(1161253134.58) Based on the console output, the problem seems to be that the = "Newchannel" event was processed after the "OriginateSuccess" event so when it tried = to lookup the channel, it wasn't added yet. I have connected to the Asterisk Manager port and look at the order in = which the events are happening and Newchannel is happening before = OriginateSuccess which is correct. The version of Asterisk that I am using is 1.2.12.1 and also tried with = 1.2. 13 with the same problem. Thanks. Best Regards, King __________ NOD32 1.1810 (20061018) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com.hk |
From: King H. <kin...@ne...> - 2006-10-28 03:04:18
|
Hi, =20 This is going to be a little long as there is a lot of debugging information.=20 =20 I am trying to use asteriskjava.live with a new project and found that = the onDialing() method in my OriginateCallback class does not always get = called. Below is a small program that I have written to demonstrate this = problem: =20 import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; =20 import org.asteriskjava.live.AsteriskChannel; import org.asteriskjava.live.ChannelState; import org.asteriskjava.live.DefaultAsteriskServer; import org.asteriskjava.live.LiveException; import org.asteriskjava.live.ManagerCommunicationException; import org.asteriskjava.live.NoSuchChannelException; import org.asteriskjava.live.OriginateCallback; =20 =20 public class MakeCall implements OriginateCallback { =20 private DefaultAsteriskServer defaultAsteriskServer =3D null; =20 public MakeCall() { =20 try { defaultAsteriskServer =3D new DefaultAsteriskServer( "192.168.2.102", "testing", "testing123"); defaultAsteriskServer.setSkipQueues(true); defaultAsteriskServer.initialize(); } catch (Exception e) { e.printStackTrace(); } } =20 public void dial() { =20 while (true) { try { defaultAsteriskServer.originateToExtensionAsync( "SIP/king238", "testing", "1000", 1, 30000, = null, null, this); Thread.sleep(1500); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } =20 } } =20 public void onBusy(AsteriskChannel channel) { System.out.println("onBusy"); } =20 public void onDialing(AsteriskChannel channel) { System.out.println("onDialing - " + channel.getId()); = channel.addPropertyChangeListener(AsteriskChannel.PROPERTY_STATE, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { System.out.println("New State: " + = evt.getNewValue()); if (evt.getNewValue() =3D=3D ChannelState.RINGING) { try { AsteriskChannel ch =3D (AsteriskChannel) evt.getSource(); System.out.println("Hangup channel " + ch.getName() + "-" + ch.getId()); ch.hangup(); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (NoSuchChannelException e) { e.printStackTrace(); } } } }); } =20 public void onFailure(LiveException cause) { System.out.println("onFailure"); } =20 public void onNoAnswer(AsteriskChannel channel) { System.out.println("onNoAnswer"); } =20 public void onSuccess(AsteriskChannel channel) { System.out.println("onSuccess"); } =20 public static void main(String[] args) { new MakeCall().dial(); } } =20 =20 Below is the output I captured from the console: =20 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.2.102:5038 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done onDialing - 1161985584.7314 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985584.7314) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985584.7314 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985585.7315 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985585.7315) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985585.7315 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985586.7316) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:17 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985587.7317) onDialing - 1161985588.7318 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:18 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08398420(1161985588.7318) New State: RINGING Hangup channel SIP/king238-08398420-1161985588.7318 New State: HUNGUP onFailure =20 As seen above, the channel SIP/king238-08392ee0(1161985587.7317) was = created to dial but onDialing() was not called!! Therefore, it wasn=A1=A6t = hangup by the program. I have also capture the communication to and from the asterisk manager = port using ngrep. Below is the part of the output related to the channel SIP/king238-08392ee0(1161985587.7317): =20 T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_13#AJ_ORIGINATE_3. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_3. context: testing. priority: 1. channel: SIP/king238. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_13#AJ_ORIGINATE_3. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: GetVar. actionid: 27165481_14#. variable: AJ_TRACE_ID. channel: SIP/king238-08392ee0. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. Variable: AJ_TRACE_ID. Value: . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_14#. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newcallerid. Privilege: call,all. Channel: SIP/king238-08392ee0. CallerID: <Unknown>. CallerIDName: <Unknown>. Uniqueid: 1161985587.7317. CID-CallingPres: 0 (Presentation Allowed, Not Screened). . ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Ringing. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . =20 ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_15#AJ_ORIGINATE_4. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_4. context: testing. priority: 1. channel: SIP/king238. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_15#AJ_ORIGINATE_4. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08398420. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985588.7318. . As seen above, the events for the channel SIP/king238-08392ee0 (1161985587.7317) looks OK except there is no hangup action called after = the RINGING event for the channel: SIP/king238-08392ee0 (1161985587.7317). =20 Since I have set a sleep period of 1.5 sec between each originate = action, I don=A1=A6t think I am pushing the system hard. If there is any more = information that is needed to debug this, please let me know and I=A1=A6ll do my = best to provide it. =20 Thanks. =20 Best Regards, =20 King |
From: King H. <kin...@ne...> - 2006-10-29 03:35:34
|
I have just upgraded my Java VM from 1.5.0_08 to 1.5.0_09 and the = problem is not there anymore. Looked at the release notes for 1.5.0_09 and cannot = find any fix that maybe related to this.=20 =20 Thanks. =20 King =20 _____ =20 =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Saturday, 28 October, 2006 11:04 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users] onDialing() in OriginateCallback does = notalways get called =20 Hi, =20 This is going to be a little long as there is a lot of debugging information.=20 =20 I am trying to use asteriskjava.live with a new project and found that = the onDialing() method in my OriginateCallback class does not always get = called. Below is a small program that I have written to demonstrate this = problem: =20 import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; =20 import org.asteriskjava.live.AsteriskChannel; import org.asteriskjava.live.ChannelState; import org.asteriskjava.live.DefaultAsteriskServer; import org.asteriskjava.live.LiveException; import org.asteriskjava.live.ManagerCommunicationException; import org.asteriskjava.live.NoSuchChannelException; import org.asteriskjava.live.OriginateCallback; =20 =20 public class MakeCall implements OriginateCallback { =20 private DefaultAsteriskServer defaultAsteriskServer =3D null; =20 public MakeCall() { =20 try { defaultAsteriskServer =3D new DefaultAsteriskServer( "192.168.2.102", "testing", "testing123"); defaultAsteriskServer.setSkipQueues(true); defaultAsteriskServer.initialize(); } catch (Exception e) { e.printStackTrace(); } } =20 public void dial() { =20 while (true) { try { defaultAsteriskServer.originateToExtensionAsync( "SIP/king238", "testing", "1000", 1, 30000, = null, null, this); Thread.sleep(1500); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } =20 } } =20 public void onBusy(AsteriskChannel channel) { System.out.println("onBusy"); } =20 public void onDialing(AsteriskChannel channel) { System.out.println("onDialing - " + channel.getId()); = channel.addPropertyChangeListener(AsteriskChannel.PROPERTY_STATE, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { System.out.println("New State: " + = evt.getNewValue()); if (evt.getNewValue() =3D=3D ChannelState.RINGING) { try { AsteriskChannel ch =3D (AsteriskChannel) evt.getSource(); System.out.println("Hangup channel " + ch.getName() + "-" + ch.getId()); ch.hangup(); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (NoSuchChannelException e) { e.printStackTrace(); } } } }); } =20 public void onFailure(LiveException cause) { System.out.println("onFailure"); } =20 public void onNoAnswer(AsteriskChannel channel) { System.out.println("onNoAnswer"); } =20 public void onSuccess(AsteriskChannel channel) { System.out.println("onSuccess"); } =20 public static void main(String[] args) { new MakeCall().dial(); } } =20 =20 Below is the output I captured from the console: =20 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.2.102:5038 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done onDialing - 1161985584.7314 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985584.7314) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985584.7314 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985585.7315 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985585.7315) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985585.7315 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985586.7316) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:17 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985587.7317) onDialing - 1161985588.7318 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:18 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08398420(1161985588.7318) New State: RINGING Hangup channel SIP/king238-08398420-1161985588.7318 New State: HUNGUP onFailure =20 As seen above, the channel SIP/king238-08392ee0(1161985587.7317) was = created to dial but onDialing() was not called!! Therefore, it wasn=A1=A6t = hangup by the program. I have also capture the communication to and from the asterisk manager = port using ngrep. Below is the part of the output related to the channel SIP/king238-08392ee0(1161985587.7317): =20 T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_13#AJ_ORIGINATE_3. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_3. context: testing. priority: 1. channel: SIP/king238. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_13#AJ_ORIGINATE_3. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: GetVar. actionid: 27165481_14#. variable: AJ_TRACE_ID. channel: SIP/king238-08392ee0. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. Variable: AJ_TRACE_ID. Value: . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_14#. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newcallerid. Privilege: call,all. Channel: SIP/king238-08392ee0. CallerID: <Unknown>. CallerIDName: <Unknown>. Uniqueid: 1161985587.7317. CID-CallingPres: 0 (Presentation Allowed, Not Screened). . ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Ringing. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . =20 ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_15#AJ_ORIGINATE_4. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_4. context: testing. priority: 1. channel: SIP/king238. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_15#AJ_ORIGINATE_4. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08398420. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985588.7318. . As seen above, the events for the channel SIP/king238-08392ee0 (1161985587.7317) looks OK except there is no hangup action called after = the RINGING event for the channel: SIP/king238-08392ee0 (1161985587.7317). =20 Since I have set a sleep period of 1.5 sec between each originate = action, I don=A1=A6t think I am pushing the system hard. If there is any more = information that is needed to debug this, please let me know and I=A1=A6ll do my = best to provide it. =20 Thanks. =20 Best Regards, =20 King |
Sorry, I after more testing, JVM 1.5.0_09 did not solve the problem. =20 I did more debugging by enabling the following line in the getTraceId() method in ChannelManager.java: =20 logger.info("TraceId for channel " + channel.getName() + " is " + = traceId); =20 Below is the console output that show the problem: =20 2006=A6~10=A4=EB29=A4=E9 =A4U=A4=C801:58:10 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-084c7190(1162032410.12175) 2006=A6~10=A4=EB29=A4=E9 =A4U=A4=C801:58:10 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: TraceId for channel SIP/king238-084c7190 is null =20 It looks like there is a problem in getting the value of the trace ID = back from=20 Asterisk. I also did a ngrep while the program runs and below is the = part of the=20 Manager communication related to the channel: =20 T 192.168.1.102:1524 -> 192.168.1.104:5038 [AP] action: Originate.=20 actionid: 27165481_14#AJ_ORIGINATE_4. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_4. context: testing. priority: 1. channel: SIP/king238. . # T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] Response: Success. =20 # T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] ActionID: 27165481_14#AJ_ORIGINATE_4. =20 ## T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] Message: Originate successfully queued. . =20 # Event: Newchannel. Privilege: call,all. Channel: SIP/king238-084c7190. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1162032410.12175. . =20 ## T 192.168.1.102:1524 -> 192.168.1.104:5038 [AP] action: GetVar. actionid: 27165481_15#. variable: AJ_TRACE_ID. channel: SIP/king238-084c7190. . =20 # T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] Response: Success. Variable: AJ_TRACE_ID. Value: . =20 So the problem is that Asterisk is not reporting the variable = AJ_TRACE_ID back correctly. =20 I was using Asterisk 1.2.12.1 and upgraded to 1.2.13 did not solve the problem. So this is Actually a problem with Asterisk rather than Asterisk-Java. =20 Best Regards, =20 King _____ =20 =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Sunday, 29 October, 2006 11:35 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users]=A6^=C2=D0: [Asterisk-java-users] = onDialing() in OriginateCallback does notalways get called =20 I have just upgraded my Java VM from 1.5.0_08 to 1.5.0_09 and the = problem is not there anymore. Looked at the release notes for 1.5.0_09 and cannot = find any fix that maybe related to this.=20 =20 Thanks. =20 King =20 _____ =20 =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Saturday, 28 October, 2006 11:04 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users] onDialing() in OriginateCallback does = notalways get called =20 Hi, =20 This is going to be a little long as there is a lot of debugging information.=20 =20 I am trying to use asteriskjava.live with a new project and found that = the onDialing() method in my OriginateCallback class does not always get = called. Below is a small program that I have written to demonstrate this = problem: =20 import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; =20 import org.asteriskjava.live.AsteriskChannel; import org.asteriskjava.live.ChannelState; import org.asteriskjava.live.DefaultAsteriskServer; import org.asteriskjava.live.LiveException; import org.asteriskjava.live.ManagerCommunicationException; import org.asteriskjava.live.NoSuchChannelException; import org.asteriskjava.live.OriginateCallback; =20 =20 public class MakeCall implements OriginateCallback { =20 private DefaultAsteriskServer defaultAsteriskServer =3D null; =20 public MakeCall() { =20 try { defaultAsteriskServer =3D new DefaultAsteriskServer( "192.168.2.102", "testing", "testing123"); defaultAsteriskServer.setSkipQueues(true); defaultAsteriskServer.initialize(); } catch (Exception e) { e.printStackTrace(); } } =20 public void dial() { =20 while (true) { try { defaultAsteriskServer.originateToExtensionAsync( "SIP/king238", "testing", "1000", 1, 30000, = null, null, this); Thread.sleep(1500); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } =20 } } =20 public void onBusy(AsteriskChannel channel) { System.out.println("onBusy"); } =20 public void onDialing(AsteriskChannel channel) { System.out.println("onDialing - " + channel.getId()); = channel.addPropertyChangeListener(AsteriskChannel.PROPERTY_STATE, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { System.out.println("New State: " + = evt.getNewValue()); if (evt.getNewValue() =3D=3D ChannelState.RINGING) { try { AsteriskChannel ch =3D (AsteriskChannel) evt.getSource(); System.out.println("Hangup channel " + ch.getName() + "-" + ch.getId()); ch.hangup(); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (NoSuchChannelException e) { e.printStackTrace(); } } } }); } =20 public void onFailure(LiveException cause) { System.out.println("onFailure"); } =20 public void onNoAnswer(AsteriskChannel channel) { System.out.println("onNoAnswer"); } =20 public void onSuccess(AsteriskChannel channel) { System.out.println("onSuccess"); } =20 public static void main(String[] args) { new MakeCall().dial(); } } =20 =20 Below is the output I captured from the console: =20 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.2.102:5038 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done onDialing - 1161985584.7314 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985584.7314) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985584.7314 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985585.7315 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985585.7315) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985585.7315 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985586.7316) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:17 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985587.7317) onDialing - 1161985588.7318 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:18 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08398420(1161985588.7318) New State: RINGING Hangup channel SIP/king238-08398420-1161985588.7318 New State: HUNGUP onFailure =20 As seen above, the channel SIP/king238-08392ee0(1161985587.7317) was = created to dial but onDialing() was not called!! Therefore, it wasn=A1=A6t = hangup by the program. I have also capture the communication to and from the asterisk manager = port using ngrep. Below is the part of the output related to the channel SIP/king238-08392ee0(1161985587.7317): =20 T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_13#AJ_ORIGINATE_3. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_3. context: testing. priority: 1. channel: SIP/king238. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_13#AJ_ORIGINATE_3. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: GetVar. actionid: 27165481_14#. variable: AJ_TRACE_ID. channel: SIP/king238-08392ee0. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. Variable: AJ_TRACE_ID. Value: . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_14#. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newcallerid. Privilege: call,all. Channel: SIP/king238-08392ee0. CallerID: <Unknown>. CallerIDName: <Unknown>. Uniqueid: 1161985587.7317. CID-CallingPres: 0 (Presentation Allowed, Not Screened). . ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Ringing. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . =20 ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_15#AJ_ORIGINATE_4. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_4. context: testing. priority: 1. channel: SIP/king238. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_15#AJ_ORIGINATE_4. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08398420. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985588.7318. . As seen above, the events for the channel SIP/king238-08392ee0 (1161985587.7317) looks OK except there is no hangup action called after = the RINGING event for the channel: SIP/king238-08392ee0 (1161985587.7317). =20 Since I have set a sleep period of 1.5 sec between each originate = action, I don=A1=A6t think I am pushing the system hard. If there is any more = information that is needed to debug this, please let me know and I=A1=A6ll do my = best to provide it. =20 Thanks. =20 Best Regards, =20 King |
From: King H. <kin...@ne...> - 2006-10-29 09:40:09
|
=20 It seems that the variable is actually set correctly by Asterisk. It is = just that the GetVar of AMI could not get it. Below is the program output: =20 2006=A6~10=A4=EB29=A4=E9 =A4U=A4=C805:17:25 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-09fe4c48(1162039738.5117) 2006=A6~10=A4=EB29=A4=E9 =A4U=A4=C805:17:25 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: TraceId for channel SIP/king238-09fe4c48 is null =20 >From Asterisk CLI, I did a =A1=A7show channel SIP/king238-09fe4c48 and = obtained the following output: =20 pnc*CLI> show channel SIP/king238-09fe4c48 -- General --=20 Name: SIP/king238-09fe4c48 Type: SIP UniqueID: 1162039738.5117 Caller ID: (N/A) Caller ID Name: 235 DNID Digits: (N/A) State: Ringing (5) Rings: 0 NativeFormat: 4 WriteFormat: 4 ReadFormat: 4 1st File Descriptor: 27 Frames in: 1 Frames out: 0 Time to Hangup: 0 Elapsed Time: N/A Direct Bridge: <none> Indirect Bridge: <none> -- PBX -- Context: testing Extension:=20 Priority: 1 Call Group: 0 Pickup Group: 0 Application: (N/A) Data: (None) Blocking in: ast_waitfor_nandfds Variables: AJ_TRACE_ID=3DAJ_ORIGINATE_235 SIPCALLID=3D72957bc16da0e25507dccdf60b05c289@192.168.1.104 =20 Any one knows about problem with AMI GetVar ?=20 =20 Thanks. =20 King _____ =20 =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Sunday, 29 October, 2006 14:41 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users]=A6^=C2=D0: = [Asterisk-java-users]=A6^=C2=D0: [Asterisk-java-users] onDialing() in OriginateCallback does notalways = get called =20 Sorry, I after more testing, JVM 1.5.0_09 did not solve the problem. =20 I did more debugging by enabling the following line in the getTraceId() method in ChannelManager.java: =20 logger.info("TraceId for channel " + channel.getName() + " is " + = traceId); =20 Below is the console output that show the problem: =20 2006=A6~10=A4=EB29=A4=E9 =A4U=A4=C801:58:10 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-084c7190(1162032410.12175) 2006=A6~10=A4=EB29=A4=E9 =A4U=A4=C801:58:10 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: TraceId for channel SIP/king238-084c7190 is null =20 It looks like there is a problem in getting the value of the trace ID = back from=20 Asterisk. I also did a ngrep while the program runs and below is the = part of the=20 Manager communication related to the channel: =20 T 192.168.1.102:1524 -> 192.168.1.104:5038 [AP] action: Originate.=20 actionid: 27165481_14#AJ_ORIGINATE_4. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_4. context: testing. priority: 1. channel: SIP/king238. . # T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] Response: Success. =20 # T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] ActionID: 27165481_14#AJ_ORIGINATE_4. =20 ## T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] Message: Originate successfully queued. . =20 # Event: Newchannel. Privilege: call,all. Channel: SIP/king238-084c7190. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1162032410.12175. . =20 ## T 192.168.1.102:1524 -> 192.168.1.104:5038 [AP] action: GetVar. actionid: 27165481_15#. variable: AJ_TRACE_ID. channel: SIP/king238-084c7190. . =20 # T 192.168.1.104:5038 -> 192.168.1.102:1524 [AP] Response: Success. Variable: AJ_TRACE_ID. Value: . =20 So the problem is that Asterisk is not reporting the variable = AJ_TRACE_ID back correctly. =20 I was using Asterisk 1.2.12.1 and upgraded to 1.2.13 did not solve the problem. So this is Actually a problem with Asterisk rather than Asterisk-Java. =20 Best Regards, =20 King _____ =20 =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Sunday, 29 October, 2006 11:35 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users]=A6^=C2=D0: [Asterisk-java-users] = onDialing() in OriginateCallback does notalways get called =20 I have just upgraded my Java VM from 1.5.0_08 to 1.5.0_09 and the = problem is not there anymore. Looked at the release notes for 1.5.0_09 and cannot = find any fix that maybe related to this.=20 =20 Thanks. =20 King =20 _____ =20 =B1H=A5=F3=AA=CC: ast...@li... [mailto:ast...@li...] =A5N=B2z King = Ho =B1H=A5=F3=A4=E9=B4=C1: Saturday, 28 October, 2006 11:04 =A6=AC=A5=F3=AA=CC: ast...@li... =A5D=A6=AE: [Asterisk-java-users] onDialing() in OriginateCallback does = notalways get called =20 Hi, =20 This is going to be a little long as there is a lot of debugging information.=20 =20 I am trying to use asteriskjava.live with a new project and found that = the onDialing() method in my OriginateCallback class does not always get = called. Below is a small program that I have written to demonstrate this = problem: =20 import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; =20 import org.asteriskjava.live.AsteriskChannel; import org.asteriskjava.live.ChannelState; import org.asteriskjava.live.DefaultAsteriskServer; import org.asteriskjava.live.LiveException; import org.asteriskjava.live.ManagerCommunicationException; import org.asteriskjava.live.NoSuchChannelException; import org.asteriskjava.live.OriginateCallback; =20 =20 public class MakeCall implements OriginateCallback { =20 private DefaultAsteriskServer defaultAsteriskServer =3D null; =20 public MakeCall() { =20 try { defaultAsteriskServer =3D new DefaultAsteriskServer( "192.168.2.102", "testing", "testing123"); defaultAsteriskServer.setSkipQueues(true); defaultAsteriskServer.initialize(); } catch (Exception e) { e.printStackTrace(); } } =20 public void dial() { =20 while (true) { try { defaultAsteriskServer.originateToExtensionAsync( "SIP/king238", "testing", "1000", 1, 30000, = null, null, this); Thread.sleep(1500); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } =20 } } =20 public void onBusy(AsteriskChannel channel) { System.out.println("onBusy"); } =20 public void onDialing(AsteriskChannel channel) { System.out.println("onDialing - " + channel.getId()); = channel.addPropertyChangeListener(AsteriskChannel.PROPERTY_STATE, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { System.out.println("New State: " + = evt.getNewValue()); if (evt.getNewValue() =3D=3D ChannelState.RINGING) { try { AsteriskChannel ch =3D (AsteriskChannel) evt.getSource(); System.out.println("Hangup channel " + ch.getName() + "-" + ch.getId()); ch.hangup(); } catch (ManagerCommunicationException e) { e.printStackTrace(); } catch (NoSuchChannelException e) { e.printStackTrace(); } } } }); } =20 public void onFailure(LiveException cause) { System.out.println("onFailure"); } =20 public void onNoAnswer(AsteriskChannel channel) { System.out.println("onNoAnswer"); } =20 public void onSuccess(AsteriskChannel channel) { System.out.println("onSuccess"); } =20 public static void main(String[] args) { new MakeCall().dial(); } } =20 =20 Below is the output I captured from the console: =20 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connecting to 192.168.2.102:5038 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Connected via Asterisk Call Manager/1.0 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Successfully logged in 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Determined Asterisk version: Asterisk 1.2 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Initializing done onDialing - 1161985584.7314 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985584.7314) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985584.7314 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:12 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985585.7315 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985585.7315) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985585.7315 New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:14 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) onDialing - 1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985586.7316) New State: RINGING Hangup channel SIP/king238-08392ee0-1161985586.7316 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:15 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Removing channel SIP/king238-08392ee0 due to hangup (NORMAL) New State: HUNGUP onFailure 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:17 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08392ee0(1161985587.7317) onDialing - 1161985588.7318 2006=A6~10=A4=EB28=A4=E9 =A4W=A4=C810:25:18 = org.asteriskjava.util.internal.JavaLoggingLog info =B8=EA=B0T: Adding channel SIP/king238-08398420(1161985588.7318) New State: RINGING Hangup channel SIP/king238-08398420-1161985588.7318 New State: HUNGUP onFailure =20 As seen above, the channel SIP/king238-08392ee0(1161985587.7317) was = created to dial but onDialing() was not called!! Therefore, it wasn=A1=A6t = hangup by the program. I have also capture the communication to and from the asterisk manager = port using ngrep. Below is the part of the output related to the channel SIP/king238-08392ee0(1161985587.7317): =20 T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_13#AJ_ORIGINATE_3. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_3. context: testing. priority: 1. channel: SIP/king238. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_13#AJ_ORIGINATE_3. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: GetVar. actionid: 27165481_14#. variable: AJ_TRACE_ID. channel: SIP/king238-08392ee0. . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. Variable: AJ_TRACE_ID. Value: . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_14#. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] . # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newcallerid. Privilege: call,all. Channel: SIP/king238-08392ee0. CallerID: <Unknown>. CallerIDName: <Unknown>. Uniqueid: 1161985587.7317. CID-CallingPres: 0 (Presentation Allowed, Not Screened). . ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08392ee0. State: Ringing. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985587.7317. . =20 ## T 192.168.2.100:2396 -> 192.168.2.102:5038 [AP] action: Originate. actionid: 27165481_15#AJ_ORIGINATE_4. timeout: 30000. exten: 1000. async: true. variable: __AJ_TRACE_ID=3DAJ_ORIGINATE_4. context: testing. priority: 1. channel: SIP/king238. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Response: Success. =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] ActionID: 27165481_15#AJ_ORIGINATE_4. =20 ## T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Message: Originate successfully queued. . =20 # T 192.168.2.102:5038 -> 192.168.2.100:2396 [AP] Event: Newchannel. Privilege: call,all. Channel: SIP/king238-08398420. State: Down. CallerID: <unknown>. CallerIDName: <unknown>. Uniqueid: 1161985588.7318. . As seen above, the events for the channel SIP/king238-08392ee0 (1161985587.7317) looks OK except there is no hangup action called after = the RINGING event for the channel: SIP/king238-08392ee0 (1161985587.7317). =20 Since I have set a sleep period of 1.5 sec between each originate = action, I don=A1=A6t think I am pushing the system hard. If there is any more = information that is needed to debug this, please let me know and I=A1=A6ll do my = best to provide it. =20 Thanks. =20 Best Regards, =20 King |