0

I would like to develop an M3UA association using Lksctp linux also I thought it could be possible using openSS7 M3UA but I do not know how to do it. Any more ideas??? Thanks for any help.

Waqas
  • 6,812
  • 2
  • 33
  • 50

2 Answers2

1

I think it is better to use Mobicents jSS7

1

You can use lk-sctp in combination with Netty framework over jdk-7 (and above) to implement M3UA (RFC 4666). Netty-4.0.25-FINAL is stable version for SCTP support.

So the combination is:

  • SCTP stack : lk-sctp-1.0.16 (over Red Hat Enterprise Linux Server release 6.5 (Santiago))
  • JDK-7 or above
  • Netty-4.0.25-FINAL

And your application on top of it. A sample code for SCTPClientHandler can be:

    public class SctpClientHandler extends ChannelDuplexHandler {
@Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt)
            throws Exception {
        SctpChannel sctpChannel = (SctpChannel) ctx.channel();
        if (evt instanceof AssociationChangeNotification) {
            AssociationChangeNotification associationChangeNotification = (AssociationChangeNotification) evt;
            switch (associationChangeNotification.event()) {
            case CANT_START:
            //Do something
            break;
            case COMM_LOST:
           //
            case COMM_UP:


  } else if (evt instanceof PeerAddressChangeNotification) {
                PeerAddressChangeNotification peerAddressChangeNotification = (PeerAddressChangeNotification) evt;
            int associationId = sctpChannel.association().associationID();
            switch (peerAddressChangeNotification.event()) {
            case ADDR_ADDED:
}
} else if (evt instanceof SendFailedNotification) {
}

@Override
    public void channelRead(ChannelHandlerContext ctx, Object msg)
            throws Exception {
        SctpMessage sctpMessage = (SctpMessage) msg;
        // Check if this is a M3UA message
        if (sctpMessage.protocolIdentifier() == 3) {
            // Send upstream - to M3UA
            ctx.fireChannelRead(sctpMessage);
        }

    }

public void send(ByteBuf buffer, int streamId) {
        SctpMessage message = new SctpMessage(3, streamId, buffer);
        ctx.writeAndFlush(message);
    }

public void send(ByteBuf buffer, int streamId, SocketAddress remoteAddress) {
        MessageInfo msgInfo = MessageInfo.createOutgoing(remoteAddress,
                streamId);
        SctpMessage message = new SctpMessage(msgInfo, buffer);
        ctx.writeAndFlush(message);
    }

public void send(ByteBuf buffer, int streamId, boolean unOrderedFlag) {
        SctpMessage message = new SctpMessage(3, streamId, buffer);
        message.messageInfo().unordered(unOrderedFlag);
        ctx.writeAndFlush(message);

    }

public void send(ByteBuf buffer, int streamId, SocketAddress remoteAddress,
            boolean unOrderedFlag) {
        MessageInfo msgInfo = MessageInfo.createOutgoing(remoteAddress,
                streamId);
        msgInfo.unordered(unOrderedFlag);
        SctpMessage message = new SctpMessage(msgInfo, buffer);
        ctx.writeAndFlush(message);
    }
    }

SCTPServerHandler can also be created as above.

For initializing Bootstrap:

bootstrap.group(worker)
            .channel(NioSctpChannel.class)
             .option(SctpChannelOption.SCTP_NODELAY,true)
              .handler(new ChannelInitializer<SctpChannel>() {
                @Override
                public void initChannel(SctpChannel ch) throws Exception {
                    ch.pipeline().addLast(
                            new SctpClientHandler());
                    ch.pipeline().addLast(new M3UAAspHandler());
                }
            });

This combination scales a lot as well. Happy coding.