2 new revisions:

Revision: 6d039aca9e6d
Author:   Sergey Vetyutnev <[email protected]>
Date:     Thu Jun 13 06:27:28 2013
Log:      TCAP preview mode bugs fixing
http://code.google.com/p/jss7/source/detail?r=6d039aca9e6d

Revision: 1a0131334f72
Author:   Sergey Vetyutnev <[email protected]>
Date:     Thu Jun 13 07:26:02 2013
Log:      Merge remote-tracking branch 'origin/2.0.x_cap24' into 2.0.x...
http://code.google.com/p/jss7/source/detail?r=1a0131334f72

==============================================================================
Revision: 6d039aca9e6d
Author:   Sergey Vetyutnev <[email protected]>
Date:     Thu Jun 13 06:27:28 2013
Log:      TCAP preview mode bugs fixing
http://code.google.com/p/jss7/source/detail?r=6d039aca9e6d

Modified:
/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/RequestReportBCSMEventRequestImpl.java /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/PrevewDialogData.java /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/TCAPProviderImpl.java

=======================================
--- /cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/RequestReportBCSMEventRequestImpl.java Wed May 16 05:00:01 2012 +++ /cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/RequestReportBCSMEventRequestImpl.java Thu Jun 13 06:27:28 2013
@@ -51,7 +51,7 @@
        public static final int _ID_bcsmEvents = 0;
        public static final int _ID_extensions = 2;

- public static final String _PrimitiveName = "ApplyChargingRequestIndication"; + public static final String _PrimitiveName = "RequestReportBCSMEventRequest";

        private ArrayList<BCSMEvent> bcsmEventList;
        private CAPExtensions extensions;
=======================================
--- /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java Fri Feb 8 10:11:07 2013 +++ /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java Thu Jun 13 06:27:28 2013
@@ -222,14 +222,15 @@
         * @param pdd
         * @param sideB
         */
- protected DialogImpl(long dialogId, SccpAddress localAddress, SccpAddress remoteAddress, int seqControl, ScheduledExecutorService executor,
-                       TCAPProviderImpl provider, PrevewDialogData pdd, 
boolean sideB) {
-               this.localAddress = localAddress;
-               this.remoteAddress = remoteAddress;
-               this.localTransactionId = dialogId;
-               this.executor = executor;
-               this.provider = provider;
-               this.structured = true;
+ protected DialogImpl(SccpAddress localAddress, SccpAddress remoteAddress, int seqControl, + ScheduledExecutorService executor, TCAPProviderImpl provider, PrevewDialogData pdd, boolean sideB) {
+        this.localAddress = localAddress;
+        this.remoteAddress = remoteAddress;
+        this.localTransactionIdObject = pdd.getDialogId();
+        this.localTransactionId = pdd.getDialogId();
+        this.executor = executor;
+        this.provider = provider;
+        this.structured = true;

                this.seqControl = seqControl;
                this.previewMode = true;
=======================================
--- /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/PrevewDialogData.java Tue Dec 11 00:37:01 2012 +++ /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/PrevewDialogData.java Thu Jun 13 06:27:28 2013
@@ -51,13 +51,19 @@
        private ScheduledExecutorService executor;
        private TCAPProviderImpl provider;
        private long idleTaskTimeout;
+    private Long dialogId;

-       public PrevewDialogData(TCAPProviderImpl provider) {
-               this.provider = provider;
-               TCAPStack stack = provider.getStack();
-               this.idleTaskTimeout = stack.getDialogIdleTimeout();
-               this.executor = provider._EXECUTOR;
-       }
+    public PrevewDialogData(TCAPProviderImpl provider, Long dialogId) {
+        this.provider = provider;
+        this.dialogId = dialogId;
+        TCAPStack stack = provider.getStack();
+        this.idleTaskTimeout = stack.getDialogIdleTimeout();
+        this.executor = provider._EXECUTOR;
+    }
+
+    public Long getDialogId() {
+        return dialogId;
+    }

        public ApplicationContextName getLastACN() {
                return lastACN;
=======================================
--- /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/TCAPProviderImpl.java Sun May 26 07:21:20 2013 +++ /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/TCAPProviderImpl.java Thu Jun 13 06:27:28 2013
@@ -826,48 +826,61 @@
                        if (this.dialogPreviewList.size() >= 
this.stack.getMaxDialogs())
throw new TCAPException("Current dialog count exceeds its maximum value");

-                       PrevewDialogData pdd = new PrevewDialogData(this);
-                       this.dialogPreviewList.put(ky, pdd);
- DialogImpl di = new DialogImpl(0, localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, false);
-                       pdd.setPrevewDialogDataKey1(ky);
-
-                       pdd.startIdleTimer();
-
+            Long dialogId = this.getAvailableTxIdPreview();
+            PrevewDialogData pdd = new PrevewDialogData(this, dialogId);
+            this.dialogPreviewList.put(ky, pdd);
+ DialogImpl di = new DialogImpl(localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, false);
+            pdd.setPrevewDialogDataKey1(ky);
+
+            pdd.startIdleTimer();
+
                        return di;
                }
        }

- private Dialog getPreviewDialog(PrevewDialogDataKey ky1, PrevewDialogDataKey ky2, SccpAddress localAddress, SccpAddress remoteAddress, int seqControl) {
-               synchronized (this.dialogPreviewList) {
-                       PrevewDialogData pdd = this.dialogPreviewList.get(ky1);
-                       DialogImpl di = null;
-                       boolean sideB = false;
-                       if (pdd != null) {
-                               sideB = 
pdd.getPrevewDialogDataKey1().equals(ky1);
- di = new DialogImpl(0, localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB);
-                       } else {
-                               pdd = this.dialogPreviewList.get(ky2);
-                               if (pdd != null) {
-                                       sideB = 
pdd.getPrevewDialogDataKey1().equals(ky1);
- di = new DialogImpl(0, localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB);
-                               } else {
-                                       return null;
-                               }
-                       }
-
-                       pdd.restartIdleTimer();
+    private Long getAvailableTxIdPreview() throws TCAPException {
+        while (true) {
+            if (this.curDialogId < this.stack.getDialogIdRangeStart())
+                this.curDialogId = this.stack.getDialogIdRangeStart() - 1;
+            if (++this.curDialogId > this.stack.getDialogIdRangeEnd())
+                this.curDialogId = this.stack.getDialogIdRangeStart();
+            Long id = this.curDialogId;
+            return id;
+        }
+    }

-                       if (pdd.getPrevewDialogDataKey2() == null && ky2 != 
null) {
-                               if (pdd.getPrevewDialogDataKey1().equals(ky1))
-                                       pdd.setPrevewDialogDataKey2(ky2);
-                               else
-                                       pdd.setPrevewDialogDataKey2(ky1);
-                               
this.dialogPreviewList.put(pdd.getPrevewDialogDataKey2(), pdd);
-                       }
+ private Dialog getPreviewDialog(PrevewDialogDataKey ky1, PrevewDialogDataKey ky2, SccpAddress localAddress,
+            SccpAddress remoteAddress, int seqControl) {
+        synchronized (this.dialogPreviewList) {
+            PrevewDialogData pdd = this.dialogPreviewList.get(ky1);
+            DialogImpl di = null;
+            boolean sideB = false;
+            if (pdd != null) {
+                sideB = pdd.getPrevewDialogDataKey1().equals(ky1);
+ di = new DialogImpl(localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB);
+            } else {
+                pdd = this.dialogPreviewList.get(ky2);
+                if (pdd != null) {
+                    sideB = pdd.getPrevewDialogDataKey1().equals(ky1);
+ di = new DialogImpl(localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB);
+                } else {
+                    return null;
+                }
+            }
+
+            pdd.restartIdleTimer();
+
+            if (pdd.getPrevewDialogDataKey2() == null && ky2 != null) {
+                if (pdd.getPrevewDialogDataKey1().equals(ky1))
+                    pdd.setPrevewDialogDataKey2(ky2);
+                else
+                    pdd.setPrevewDialogDataKey2(ky1);
+ this.dialogPreviewList.put(pdd.getPrevewDialogDataKey2(), pdd);
+            }

-                       return di;
-               }
-       }
+            return di;
+        }
+    }

        protected void removePreviewDialog(DialogImpl di) {
PrevewDialogData pdd = this.dialogPreviewList.get(di.prevewDialogData.getPrevewDialogDataKey1());
@@ -932,15 +945,18 @@
                }

                @Override
-               public int hashCode() {
-                       final int prime = 31;
-                       int result = 1;
-                       result = prime * result + this.dpc;
- result = prime * result + ((sccpDigits == null) ? 0 : sccpDigits.hashCode());
-                       result = prime * result + this.ssn;
-                       result = prime * result + (int) (this.origTxId + 
(this.origTxId >> 32));
-                       return result;
-               }
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            if (this.sccpDigits != null) {
+ result = prime * result + ((sccpDigits == null) ? 0 : sccpDigits.hashCode());
+            } else {
+                result = prime * result + this.dpc;
+            }
+            result = prime * result + this.ssn;
+ result = prime * result + (int) (this.origTxId + (this.origTxId >> 32));
+            return result;
+        }
        }
 }


==============================================================================
Revision: 1a0131334f72
Author:   Sergey Vetyutnev <[email protected]>
Date:     Thu Jun 13 07:26:02 2013
Log:      Merge remote-tracking branch 'origin/2.0.x_cap24' into 2.0.x

Conflicts:
cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/RequestReportBCSMEventRequestImpl.java tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/PrevewDialogData.java tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/TCAPProviderImpl.java

http://code.google.com/p/jss7/source/detail?r=1a0131334f72

Modified:
/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/RequestReportBCSMEventRequestImpl.java /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/PrevewDialogData.java /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/TCAPProviderImpl.java

=======================================
--- /cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/RequestReportBCSMEventRequestImpl.java Wed Jun 12 12:00:55 2013 +++ /cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/RequestReportBCSMEventRequestImpl.java Thu Jun 13 07:26:02 2013
@@ -51,7 +51,7 @@
     public static final int _ID_bcsmEvents = 0;
     public static final int _ID_extensions = 2;

- public static final String _PrimitiveName = "ApplyChargingRequestIndication"; + public static final String _PrimitiveName = "RequestReportBCSMEventRequest";

     private ArrayList<BCSMEvent> bcsmEventList;
     private CAPExtensions extensions;
=======================================
--- /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java Wed Jun 12 12:00:55 2013 +++ /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java Thu Jun 13 07:26:02 2013
@@ -222,11 +222,12 @@
      * @param pdd
      * @param sideB
      */
- protected DialogImpl(long dialogId, SccpAddress localAddress, SccpAddress remoteAddress, int seqControl, - ScheduledExecutorService executor, TCAPProviderImpl provider, PrevewDialogData pdd, boolean sideB) { + protected DialogImpl(SccpAddress localAddress, SccpAddress remoteAddress, int seqControl, ScheduledExecutorService executor, TCAPProviderImpl provider,
+            PrevewDialogData pdd, boolean sideB) {
         this.localAddress = localAddress;
         this.remoteAddress = remoteAddress;
-        this.localTransactionId = dialogId;
+        this.localTransactionIdObject = pdd.getDialogId();
+        this.localTransactionId = pdd.getDialogId();
         this.executor = executor;
         this.provider = provider;
         this.structured = true;
=======================================
--- /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/PrevewDialogData.java Wed Jun 12 12:00:55 2013 +++ /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/PrevewDialogData.java Thu Jun 13 07:26:02 2013
@@ -51,13 +51,19 @@
     private ScheduledExecutorService executor;
     private TCAPProviderImpl provider;
     private long idleTaskTimeout;
+    private Long dialogId;

-    public PrevewDialogData(TCAPProviderImpl provider) {
+    public PrevewDialogData(TCAPProviderImpl provider, Long dialogId) {
         this.provider = provider;
+        this.dialogId = dialogId;
         TCAPStack stack = provider.getStack();
         this.idleTaskTimeout = stack.getDialogIdleTimeout();
         this.executor = provider._EXECUTOR;
     }
+
+    public Long getDialogId() {
+        return dialogId;
+    }

     public ApplicationContextName getLastACN() {
         return lastACN;
=======================================
--- /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/TCAPProviderImpl.java Wed Jun 12 12:00:55 2013 +++ /tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/TCAPProviderImpl.java Thu Jun 13 07:26:02 2013
@@ -825,15 +825,15 @@

     }

- private Dialog createPreviewDialog(PrevewDialogDataKey ky, SccpAddress localAddress, SccpAddress remoteAddress,
-            int seqControl) throws TCAPException {
+ private Dialog createPreviewDialog(PrevewDialogDataKey ky, SccpAddress localAddress, SccpAddress remoteAddress, int seqControl) throws TCAPException {
         synchronized (this.dialogPreviewList) {
if (this.dialogPreviewList.size() >= this.stack.getMaxDialogs()) throw new TCAPException("Current dialog count exceeds its maximum value");

-            PrevewDialogData pdd = new PrevewDialogData(this);
+            Long dialogId = this.getAvailableTxIdPreview();
+            PrevewDialogData pdd = new PrevewDialogData(this, dialogId);
             this.dialogPreviewList.put(ky, pdd);
- DialogImpl di = new DialogImpl(0, localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, false); + DialogImpl di = new DialogImpl(localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, false);
             pdd.setPrevewDialogDataKey1(ky);

             pdd.startIdleTimer();
@@ -842,20 +842,30 @@
         }
     }

- private Dialog getPreviewDialog(PrevewDialogDataKey ky1, PrevewDialogDataKey ky2, SccpAddress localAddress,
-            SccpAddress remoteAddress, int seqControl) {
+    private Long getAvailableTxIdPreview() throws TCAPException {
+        while (true) {
+            if (this.curDialogId < this.stack.getDialogIdRangeStart())
+                this.curDialogId = this.stack.getDialogIdRangeStart() - 1;
+            if (++this.curDialogId > this.stack.getDialogIdRangeEnd())
+                this.curDialogId = this.stack.getDialogIdRangeStart();
+            Long id = this.curDialogId;
+            return id;
+        }
+    }
+
+ private Dialog getPreviewDialog(PrevewDialogDataKey ky1, PrevewDialogDataKey ky2, SccpAddress localAddress, SccpAddress remoteAddress, int seqControl) {
         synchronized (this.dialogPreviewList) {
             PrevewDialogData pdd = this.dialogPreviewList.get(ky1);
             DialogImpl di = null;
             boolean sideB = false;
             if (pdd != null) {
                 sideB = pdd.getPrevewDialogDataKey1().equals(ky1);
- di = new DialogImpl(0, localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB); + di = new DialogImpl(localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB);
             } else {
                 pdd = this.dialogPreviewList.get(ky2);
                 if (pdd != null) {
                     sideB = pdd.getPrevewDialogDataKey1().equals(ky1);
- di = new DialogImpl(0, localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB); + di = new DialogImpl(localAddress, remoteAddress, seqControl, this._EXECUTOR, this, pdd, sideB);
                 } else {
                     return null;
                 }
@@ -941,8 +951,11 @@
         public int hashCode() {
             final int prime = 31;
             int result = 1;
-            result = prime * result + this.dpc;
- result = prime * result + ((sccpDigits == null) ? 0 : sccpDigits.hashCode());
+            if (this.sccpDigits != null) {
+ result = prime * result + ((sccpDigits == null) ? 0 : sccpDigits.hashCode());
+            } else {
+                result = prime * result + this.dpc;
+            }
             result = prime * result + this.ssn;
result = prime * result + (int) (this.origTxId + (this.origTxId >> 32));
             return result;

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to