JBoss.orgCommunity Documentation

Chapter 6. SCCP

6.1. Routing Management
6.2. Routing Configuration
6.3. Mobicents SS7 Stack SCCP Usage
6.4. Access Point
6.5. SCCP User Part Example

The Signaling Connection Control Part (SCCP) is defined in ITU-T Recommendations Q.711-Q.716. SCCP sits on top of Message Transfer Part 3 (MTP3) in the SS7 protocol stack. The SCCP provides additional network layer functions to provide transfer of noncircuit-related (NCR) signaling information, application management procedures and alternative and more flexible methods of routing.

Currently Shell does not support commands to manage SCCP routes.

Routing rules are persisted within file. By default its sccp-routing.txt. This file is managed by SCCP stack and SS7 Service , it is not encouraged practice to edit this file by hand. However for complete rerefence, you can find structure of this file below:



sequence;pattern;translation;mtpinfo

                

Example file entry looks as follows:


sequence

is set to 0, since its only rule in a file(or first).

pattern

matches natioan mobile number with following digits: 9023629581

translation

changes destination to international mobile with following digits: 79023629581. Since no sub-system number is present, this rule requires mtpinfo to indicate target.

mtpinfo

indicates link through which message will be sent to next hop. Link:

  • Belongs to linkset with name equal to linkset.

  • Adjacent point code is equal to 14083.

  • Origin point code is equal to 14155.

  • Signaling link selector is equal to 0. Note that this value may be overriden by transport layer.

The org.mobicents.protocols.ss7.sccp.SccpStack is responsible for taking the config file and turning it into org.mobicents.protocols.ss7.sccp.Router. All the sccp messages sent bu SCCP User Part are routed as per the rule configured in Router

The SCCP User Part gets handle to SccpStack by doing JNDI look-up as explained in Section 6.4, “Access Point”

SccpStack exposes org.mobicents.protocols.ss7.sccp.SccpProvider that interacts directly with SccpStack. This interface defines the methods that will be used by SCCP User Part to send org.mobicents.protocols.ss7.sccp.message.SccpMessage and register org.mobicents.protocols.ss7.sccp.SccpListener's to listen for incoming SCCP messages.

SCCP User Part registers SccpListener for specific local org.mobicents.protocols.ss7.sccp.parameter.SccpAddress. For every incoming SccpMessage, if the called party address matches with this local SccpAddress, the corresponding SccpListner is called.

SccpProvider also exposes org.mobicents.protocols.ss7.sccp.message.MessageFactory and org.mobicents.protocols.ss7.sccp.parameter.ParameterFactory to create new concrete SccpMessage viz., org.mobicents.protocols.ss7.sccp.message.UnitData or org.mobicents.protocols.ss7.sccp.message.XUnitData passing the corresponding parameters created by leveraging ParameterFactory.

The UML class diagram looks like

SS7 Service provides user with access point to SCCP protocol/stack.

To get handle to SccpStack do the JNDI look-up passing the JNDI name configured in SS7 service as explained in Section 3.2.4, “Configuring SS7Service”

    

        private static SccpProvider getSccpProvider() throws NamingException {
    
            // no arg is ok, if we run in JBoss
            InitialContext ctx = new InitialContext();
            try {
                String providerJndiName = "/mobicents/ss7/sccp";
                return ((SccpStack) ctx.lookup(providerJndiName)).getSccpProvider();
    
            } finally {
                ctx.close();
            }
        }
            
        

Below is SCCP User Part example listening for incoming SCCP message and sending back new message



public class Test implements SccpListener {
    private SccpProvider sccpProvider;
    private SccpAddress localAddress;
    private static SccpProvider getSccpProvider() throws NamingException {
        // no arg is ok, if we run in JBoss
        InitialContext ctx = new InitialContext();
        try {
            String providerJndiName = "/mobicents/ss7/sccp";
            return ((SccpStack) ctx.lookup(providerJndiName)).getSccpProvider();
        } finally {
            ctx.close();
        }
    }
    public void start() throws Excetpion {
        this.sccpProvider = getSccpProvider();
        int translationType = 0;
        int subSystemNumber = 0;
        GlobalTitle gt = GlobalTitle.getInstance(translationType,
                NumberingPlan.ISDN_MOBILE, NatureOfAddress.NATIONAL, "1234");
        localAddress = new SccpAddress(gt, 0);
        this.sccpProvider.registerSccpListener(localAddress, this);
    }
    public void stop() {
        this.sccpProvider.deregisterSccpListener(localAddress);
    }
    public void onMessage(SccpMessage message) {
        if (message.getType() == MessageType.UDT) {
            throw new IlleagalArgumentException("Dont like UDT");
        } else if (message.getType() == MessageType.XUDT) {
            XUnitData xudt = (XUnitData) message;
            localAddress = ((XUnitData) message).getCalledPartyAddress();
            SccpAddress remoteAddress = ((XUnitData) message)
                    .getCallingPartyAddress();
            // now decode content
            byte[] data = xudt.getData();
            // some data encoded in
            CallRequest cr = new CallRequest(data);
            byte[] answerData;
            if (cr.getCallee().equals(this.localAddress)) {
                EstablihsCallAnswer eca = new EstablihsCallAnswer(cr);
                answerData = eca.encode();
            } else {
                TearDownCallAnswer tdca = new TearDownCallAnswer(cr);
                answerData = tdca.encode();
            }
            HopCounter hc = this.sccpProvider.getParameterFactory()
                    .createHopCounter(5);
            XUnitData sccpAnswer = this.sccpProvider
                    .getMessageFactory()
                    .createXUnitData(hc, xudt.getProtocolClass(),
                            message.getCallingPartyAddress(), this.localAddress);
            this.sccpProvider.send(sccpAnswer);
        }
    }
}