diff --git a/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/CAPProvider.java b/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/CAPProvider.java index bfa2f70cb2..2ba867754e 100644 --- a/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/CAPProvider.java +++ b/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/CAPProvider.java @@ -31,10 +31,12 @@ import org.mobicents.protocols.ss7.inap.api.INAPParameterFactory; import org.mobicents.protocols.ss7.isup.ISUPParameterFactory; import org.mobicents.protocols.ss7.map.api.MAPParameterFactory; +import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; /** * * @author sergey vetyutnev + * @author ProIDS sp. z o.o. * */ public interface CAPProvider extends Serializable { @@ -107,4 +109,19 @@ public interface CAPProvider extends Serializable { */ int getCurrentDialogsCount(); + /** + * Relay Initial Cap Message to other network node + * @param newServiceKey + * @param capMessage + * @throws CAPException + */ + void relayCapMessage(int newServiceKey, CAPMessage capMessage) throws CAPException; + + /** + * Relay Initial Cap Message to other network node + * @param newServiceKey + * @param capMessage + * @throws CAPException + */ + void relayCapMessage(int newServiceKey, SccpAddress origAddress, SccpAddress destAddress, CAPMessage capMessage) throws CAPException; } diff --git a/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCall.java b/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCall.java index 6a4b41f598..7ff2fa18d8 100644 --- a/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCall.java +++ b/cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCall.java @@ -30,6 +30,7 @@ /** * * @author sergey vetyutnev + * @author ProIDS sp. z o.o. * */ public interface CAPServiceCircuitSwitchedCall extends CAPServiceBase { @@ -44,4 +45,11 @@ CAPDialogCircuitSwitchedCall createNewDialog(CAPApplicationContext appCntx, Sccp void removeCAPServiceListener(CAPServiceCircuitSwitchedCallListener capServiceListener); + /** + * Create new structured dialog with default TransactionId. + * Used for SCCP relay functionality + * @param relayedLocalTrId + */ + CAPDialogCircuitSwitchedCall createNewRelayedDialog(CAPApplicationContext appCntx, SccpAddress origAddress, SccpAddress destAddress, Long relayedLocalTrId) throws CAPException; + } \ No newline at end of file diff --git a/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPProviderImpl.java b/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPProviderImpl.java index 19e92452b1..8639b48aa4 100644 --- a/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPProviderImpl.java +++ b/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPProviderImpl.java @@ -40,6 +40,7 @@ import org.mobicents.protocols.ss7.cap.api.CAPDialog; import org.mobicents.protocols.ss7.cap.api.CAPDialogListener; import org.mobicents.protocols.ss7.cap.api.CAPException; +import org.mobicents.protocols.ss7.cap.api.CAPMessage; import org.mobicents.protocols.ss7.cap.api.CAPParameterFactory; import org.mobicents.protocols.ss7.cap.api.CAPParsingComponentException; import org.mobicents.protocols.ss7.cap.api.CAPProvider; @@ -69,6 +70,7 @@ import org.mobicents.protocols.ss7.isup.impl.message.parameter.ISUPParameterFactoryImpl; import org.mobicents.protocols.ss7.map.MAPParameterFactoryImpl; import org.mobicents.protocols.ss7.map.api.MAPParameterFactory; +import org.mobicents.protocols.ss7.sccp.parameter.SccpAddress; import org.mobicents.protocols.ss7.tcap.DialogImpl; import org.mobicents.protocols.ss7.tcap.api.MessageType; import org.mobicents.protocols.ss7.tcap.api.TCAPProvider; @@ -113,6 +115,7 @@ /** * * @author sergey vetyutnev + * @author ProIDS sp. z o.o. * */ public class CAPProviderImpl implements CAPProvider, TCListener { @@ -1302,4 +1305,12 @@ protected void fireTCAbort(Dialog tcapDialog, CAPGeneralAbortReason generalAbort public int getCurrentDialogsCount() { return this.tcapProvider.getCurrentDialogsCount(); } + + public void relayCapMessage(int newServiceKey, CAPMessage capMessage) throws CAPException { + throw new RuntimeException("NotImplemented"); + } + + public void relayCapMessage(int newServiceKey, SccpAddress origAddress, SccpAddress destAddress, CAPMessage capMessage) throws CAPException { + throw new RuntimeException("NotImplemented"); + } } diff --git a/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCallImpl.java b/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCallImpl.java index 86c17afa9c..fe5becd105 100644 --- a/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCallImpl.java +++ b/cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/service/circuitSwitchedCall/CAPServiceCircuitSwitchedCallImpl.java @@ -51,6 +51,7 @@ /** * * @author sergey vetyutnev + * @author ProIDS sp. z o.o. * */ public class CAPServiceCircuitSwitchedCallImpl extends CAPServiceBaseImpl implements CAPServiceCircuitSwitchedCall { @@ -69,6 +70,11 @@ public CAPDialogCircuitSwitchedCall createNewDialog(CAPApplicationContext appCnt @Override public CAPDialogCircuitSwitchedCall createNewDialog(CAPApplicationContext appCntx, SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws CAPException { + return this.createNewDialog(appCntx, origAddress, destAddress, null, null); + } + + private CAPDialogCircuitSwitchedCall createNewDialog(CAPApplicationContext appCntx, SccpAddress origAddress, SccpAddress destAddress, Long localTrId, Long relayedLocalTrId) + throws CAPException { // We cannot create a dialog if the service is not activated if (!this.isActivated()) @@ -76,6 +82,7 @@ public CAPDialogCircuitSwitchedCall createNewDialog(CAPApplicationContext appCnt "Cannot create CAPDialogCircuitSwitchedCall because CAPServiceCircuitSwitchedCall is not activated"); Dialog tcapDialog = this.createNewTCAPDialog(origAddress, destAddress, localTrId); + tcapDialog.setRelayedLocalDialogId(relayedLocalTrId); CAPDialogCircuitSwitchedCallImpl dialog = new CAPDialogCircuitSwitchedCallImpl(appCntx, tcapDialog, this.capProviderImpl, this); @@ -84,6 +91,10 @@ public CAPDialogCircuitSwitchedCall createNewDialog(CAPApplicationContext appCnt return dialog; } + public CAPDialogCircuitSwitchedCall createNewRelayedDialog(CAPApplicationContext appCntx, SccpAddress origAddress, SccpAddress destAddress, Long relayedLocalTrId) throws CAPException { + return this.createNewDialog(appCntx, origAddress, destAddress, null, relayedLocalTrId); + } + @Override public void addCAPServiceListener(CAPServiceCircuitSwitchedCallListener capServiceListener) { super.addCAPServiceListener(capServiceListener); diff --git a/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/api/tc/dialog/Dialog.java b/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/api/tc/dialog/Dialog.java index 9af939cd0e..364798ee25 100644 --- a/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/api/tc/dialog/Dialog.java +++ b/tcap/tcap-api/src/main/java/org/mobicents/protocols/ss7/tcap/api/tc/dialog/Dialog.java @@ -42,6 +42,7 @@ * * @author baranowb * @author sergey vetyutnev + * @author ProIDS sp. z o.o. * */ public interface Dialog extends Serializable { @@ -53,6 +54,18 @@ public interface Dialog extends Serializable { */ Long getLocalDialogId(); + /** + * returns relayed dialog ID. + * + * @return + */ + Long getRelayedLocalDialogId(); + + /** + * sets relayed dialog ID. + */ + void setRelayedLocalDialogId(Long relayedDialogId); + /** * return the remote Dialog Id. This will be null if Dialog is locally originated and not confirmed yet * diff --git a/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java b/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java index f934a01b63..11eb2a6f43 100644 --- a/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java +++ b/tcap/tcap-impl/src/main/java/org/mobicents/protocols/ss7/tcap/DialogImpl.java @@ -107,6 +107,7 @@ * @author baranowb * @author amit bhayani * @author sergey vetyutnev + * @author ProIDS sp. z o.o. * */ public class DialogImpl implements Dialog { @@ -133,6 +134,7 @@ public class DialogImpl implements Dialog { private long localTransactionId; private byte[] remoteTransactionId; private Long remoteTransactionIdObject; + private Long localRelayedTransactionIdObject; private SccpAddress localAddress; private SccpAddress remoteAddress; @@ -545,7 +547,11 @@ public void send(TCBeginRequest event) throws TCAPSendException { } // now comps - tcbm.setOriginatingTransactionId(Utils.encodeTransactionId(this.localTransactionId)); + if (this.localRelayedTransactionIdObject!=null) { + tcbm.setOriginatingTransactionId(Utils.encodeTransactionId(this.localRelayedTransactionIdObject)); + } else { + tcbm.setOriginatingTransactionId(Utils.encodeTransactionId(this.localTransactionId)); + } if (this.scheduledComponentList.size() > 0) { Component[] componentsToSend = new Component[this.scheduledComponentList.size()]; this.prepareComponents(componentsToSend); @@ -2168,6 +2174,15 @@ public PrevewDialogData getPrevewDialogData() { return this.prevewDialogData; } + public Long getRelayedLocalDialogId() { + return this.localRelayedTransactionIdObject; + } + + public void setRelayedLocalDialogId(Long relayedDialogId) { + this.localRelayedTransactionIdObject = relayedDialogId; + } + + /* * (non-Javadoc) *