[Asterisk-java-users] =?big5?B?pl7C0DogW0FzdGVyaXNrLWphdmEtdXNlcnNdIG9uRGlhbGluZygpIGluIE9yaQ==?= =
Brought to you by:
srt
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 |