jSS7

Following is example of SS7 (Sigtran) client which could be used for testing:

1. (OPTIONAL) Install NetBeans IDE

2. Download and install Mobicent RestComm jSS7

Instructions bellow, original instructions can be found here https://github.com/RestComm/jss7/wiki/Build-jSS7-from-Source

  • Clone jSS7 Repo : git clone https://github.com/RestComm/jss7.git
  • Download Dialogic dependencies from Dialogic website. This is required to build the hardware part of jSS7 to have support for Dialogic boards in case you can't use SIGTRAN directly : wget https://www.dialogic.com/files/DSI/developmentpackages/linux/dpklnx.Z
  • Unpack the contents of the Dialogic SS7 dependencies : tar --no-same-owner -zxvf dpklnx.Z
  • Install the Dialogic SS7 Java Dependency in your local maven repository : mvn install:install-file -DgroupId=com.vendor.dialogic -DartifactId=gctapi -Dversion=6.7.1 -Dpackaging=jar -Dfile=./JAVA/gctApi.jar
  • Download Sun JMX tools dependency used by the jSS7 simulator : wget http://www.datanucleus.org/downloads/maven2/com/sun/jdmk/jmxtools/1.2.1/jmxtools-1.2.1.jar
  • Install the Sun JMX Tools Dependency in your local maven repository : mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=jmxtools-1.2.1.jar
  • Build jSS7 with maven : mvn clean install -Dmaven.test.skip=true

3. (OPTIONAL) Import jSS7 project into NetBeans

4. Work with simulatorcore example and modify it:

  • Create new package
    • package name: org.mobicents.protocols.ss7.tools.simulator.test
    • folder name: tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/test
  • Code example is attached bellow. The example demonstrates various ways how to send message, using jSS7 send functions on various protocol layers.

SctpClient.java

...protected void initializeStack(IpChannelType ipChannelType) throws Exception {
this.initSCTP(ipChannelType);
// Initialize M3UA first this.initM3UA();
// Initialize SCCP this.initSCCP();
// Initialize TCAP this.initTCAP();
// Initialize MAP this.initMAP();
// FInally start ASP // Set 5: Finally start ASP this.clientM3UAMgmt.startAsp("ASP1"); }
private void initSCTP(IpChannelType ipChannelType) throws Exception { logger.debug("Initializing SCTP Stack ...."); this.sctpManagement = new ManagementImpl("Client"); this.sctpManagement.setSingleThread(true); this.sctpManagement.start(); this.sctpManagement.setConnectDelay(10000); this.sctpManagement.removeAllResourses();
// 1. Create SCTP Association sctpManagement.addAssociation(CLIENT_IP, CLIENT_PORT, SERVER_IP, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType, null); logger.debug("Initialized SCTP Stack ...."); }
private void initM3UA() throws Exception { logger.debug("Initializing M3UA Stack ...."); this.clientM3UAMgmt = new M3UAManagementProxyImpl("Client"); this.clientM3UAMgmt.setTransportManagement(this.sctpManagement); this.clientM3UAMgmt.start(); this.clientM3UAMgmt.removeAllResourses();
// m3ua as create rc <rc> <ras-name> RoutingContext rc = factory.createRoutingContext(new long[]{100l}); TrafficModeType trafficModeType = factory.createTrafficModeType(TrafficModeType.Loadshare); this.clientM3UAMgmt.createAs("AS1", Functionality.AS, ExchangeType.SE, IPSPType.CLIENT, rc, trafficModeType, 1, null);
// Step 2 : Create ASP this.clientM3UAMgmt.createAspFactory("ASP1", CLIENT_ASSOCIATION_NAME);
// Step3 : Assign ASP to AS AspImpl asp = this.clientM3UAMgmt.assignAspToAs("AS1", "ASP1");
// Step 4: Add Route. Remote point code is 2 clientM3UAMgmt.addRoute(SERVER_SPC, -1, -1, "AS1"); logger.debug("Initialized M3UA Stack ....");
}
private void initSCCP() throws Exception { logger.debug("Initializing SCCP Stack ...."); this.sccpStack = new SccpStackImpl("MapLoadClientSccpStack"); this.sccpStack.setMtp3UserPart(1, this.clientM3UAMgmt);
this.sccpStack.start(); this.sccpStack.removeAllResourses();
this.sccpStack.getSccpResource().addRemoteSpc(0, SERVER_SPC, 0, 0); this.sccpStack.getSccpResource().addRemoteSsn(0, SERVER_SPC, SSN, 0, false);
this.sccpStack.getRouter().addMtp3ServiceAccessPoint(1, 1, CLIENT_SPC, NETWORK_INDICATOR, 0); this.sccpStack.getRouter().addMtp3Destination(1, 1, SERVER_SPC, SERVER_SPC, 0, 255, 255); this.sccpProvider = this.sccpStack.getSccpProvider(); this.sccpStack.getSccpResource().addRemoteSpc(1, SERVER_SPC, 0, 0); this.sccpStack.getSccpResource().addRemoteSsn(1, SERVER_SPC, SSN, 0, false);
// SCCP routing table GlobalTitle gt = this.sccpProvider.getParameterFactory().createGlobalTitle("", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL); this.sccpStack.getRouter().addRoutingAddress(1, this.sccpProvider.getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, gt, SERVER_SPC, 0)); this.sccpStack.getRouter().addRoutingAddress(2, this.sccpProvider.getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_DPC_AND_SSN, gt, CLIENT_SPC, SSN));
gt = this.sccpProvider.getParameterFactory().createGlobalTitle("*", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL); SccpAddress pattern = this.sccpProvider.getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, gt, 0, 0); String mask = "K"; ((RouterImpl) this.sccpStack.getRouter()).addRule(1, RuleType.SOLITARY, null, OriginationType.LOCAL, pattern, mask, 1, -1, null, 0); pattern = this.sccpProvider.getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, gt, 0, 0); mask = "R"; ((RouterImpl) this.sccpStack.getRouter()).addRule(2, RuleType.SOLITARY, null, OriginationType.REMOTE, pattern, mask, 2, -1, null, 0); logger.debug("Initialized SCCP Stack ...."); }
private void initTCAP() throws Exception { logger.debug("Initializing TCAP Stack ...."); this.tcapStack = new TCAPStackImplWrapper(this.sccpStack.getSccpProvider(), SSN); this.tcapStack.start(); this.tcapStack.setDialogIdleTimeout(60000); this.tcapStack.setInvokeTimeout(30000); this.tcapStack.setMaxDialogs(2000); logger.debug("Initialized TCAP Stack ...."); }
private void initMAP() throws Exception { logger.debug("Initializing MAP Stack ...."); // this.mapStack = new MAPStackImpl(this.sccpStack.getSccpProvider(), // SSN); this.mapStack = new MAPStackImpl("Simulator", this.sccpStack.getSccpProvider(), SSN); this.mapProvider = this.mapStack.getMAPProvider();
this.mapProvider.addMAPDialogListener(this); //this.mapProvider.getMAPServiceSupplementary().addMAPServiceListener(this); this.mapProvider.getMAPServiceSupplementary().acivate(); this.mapProvider.getMAPServiceMobility().acivate();
this.mapStack.start(); logger.debug("Initialized MAP Stack ...."); }
.....
try { client.initializeStack(ipChannelType);
// Lets pause for 20 seconds so stacks are initialized properly Thread.sleep(20000); Mtp3TransferPrimitive mtp3TransferPrimitive = new Mtp3TransferPrimitive(3, 2, 0, 1, 2, 5, hexStringToByteArray("0980030e190b12060011041111111111110b1207001204111111111111186516480433119839490402035ea26c08a106020102020138"), RoutingLabelFormat.ITU); client.clientM3UAMgmt.sendMessage(mtp3TransferPrimitive); Thread.sleep(1000); GlobalTitle callingGT = client.sccpProvider.getParameterFactory().createGlobalTitle("100000000000", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL); GlobalTitle calledGT = client.sccpProvider.getParameterFactory().createGlobalTitle("100000000000", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL); SccpAddress callingParty = client.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, callingGT, 1, 8); SccpAddress calledParty = client.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, calledGT, 2, 8); SccpDataMessage sccpDataMessage; sccpDataMessage = client.sccpProvider.getMessageFactory().createDataMessageClass0(calledParty, callingParty, hexStringToByteArray("6516480433119839490402035ea26c08a106020102020138"), 0, true, null, null); client.sccpProvider.send(sccpDataMessage); Thread.sleep(1000); client.initiateUSSD(); Thread.sleep(1000); callingGT = client.sccpProvider.getParameterFactory().createGlobalTitle("100000000000", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL); calledGT = client.sccpProvider.getParameterFactory().createGlobalTitle("100000000000", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE, null, NatureOfAddress.INTERNATIONAL); callingParty = client.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, callingGT, 1, 8); calledParty = client.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, calledGT, 2, 8); ISDNAddressString origReference = client.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "11111111111"); ISDNAddressString destReference = client.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "111111111111111"); ISDNAddressString gsmSCFAddress = client.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "111111111111111"); MAPProvider mapProvider = client.mapStack.getMAPProvider();
MAPApplicationContextName acn = MAPApplicationContextName.anyTimeEnquiryContext; MAPApplicationContextVersion vers = MAPApplicationContextVersion.version3; MAPApplicationContext mapAppContext = MAPApplicationContext.getInstance(acn, vers);
SubscriberIdentity subscriberIdentity; IMSI imsi = mapProvider.getMAPParameterFactory().createIMSI("11111111111111"); subscriberIdentity = mapProvider.getMAPParameterFactory().createSubscriberIdentity(imsi); RequestedInfo requestedInfo = mapProvider.getMAPParameterFactory().createRequestedInfo( true, true, null, true, DomainType.csDomain, true, true, true); try { MAPDialogMobility curDialog = mapProvider.getMAPServiceMobility().createNewDialog(mapAppContext, callingParty, origReference, calledParty, destReference);
curDialog.addAnyTimeInterrogationRequest(subscriberIdentity, requestedInfo, gsmSCFAddress, null); curDialog.send();
} catch (MAPException ex) { ex.printStackTrace(); }

} catch (Exception e) { e.printStackTrace(); } ...

5. Run SctpServer and SctpClient. Example of generated traffic is bellow.

Attachments: