forked from RestComm/jss7
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for issue RestComm#192 @github SCCP Relay feature implementation
Conflicts: cap/cap-api/src/main/java/org/mobicents/protocols/ss7/cap/api/CAPProvider.java cap/cap-impl/src/main/java/org/mobicents/protocols/ss7/cap/CAPProviderImpl.java
- Loading branch information
Showing
6 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <a href="mailto:[email protected]">ProIDS sp. z o.o.</a> | ||
* | ||
*/ | ||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
/** | ||
* | ||
* @author sergey vetyutnev | ||
* @author <a href="mailto:[email protected]">ProIDS sp. z o.o.</a> | ||
* | ||
*/ | ||
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; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <a href="mailto:[email protected]">ProIDS sp. z o.o.</a> | ||
* | ||
*/ | ||
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"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ | |
/** | ||
* | ||
* @author sergey vetyutnev | ||
* @author <a href="mailto:[email protected]">ProIDS sp. z o.o.</a> | ||
* | ||
*/ | ||
public class CAPServiceCircuitSwitchedCallImpl extends CAPServiceBaseImpl implements CAPServiceCircuitSwitchedCall { | ||
|
@@ -69,13 +70,19 @@ 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()) | ||
throw new CAPException( | ||
"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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
* | ||
* @author baranowb | ||
* @author sergey vetyutnev | ||
* @author <a href="mailto:[email protected]">ProIDS sp. z o.o.</a> | ||
* | ||
*/ | ||
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 | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,7 @@ | |
* @author baranowb | ||
* @author amit bhayani | ||
* @author sergey vetyutnev | ||
* @author <a href="mailto:[email protected]">ProIDS sp. z o.o.</a> | ||
* | ||
*/ | ||
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) | ||
* | ||
|