我想使用 Lksctp linux 开发一个 M3UA 关联,我也认为使用 openSS7 M3UA 是可能的,但我不知道该怎么做。还有什么想法吗???感谢您的任何帮助。
您可以将 lk-sctp 与 jdk-7(及更高版本)上的 Netty 框架结合使用来实现 M3UA (RFC 4666)。Netty-4.0.25-FINAL是SCTP支持的稳定版本。
所以组合是:
- SCTP 堆栈:lk-sctp-1.0.16(在红帽企业 Linux Server 版本 6.5(圣地亚哥)上)
- JDK-7 或以上
- 净-4.0.25-决赛
以及您的应用程序。SCTPClientHandler 的示例代码可以是:
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也可以如上所述创建。
对于初始化引导程序:
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());
}
});
这种组合也扩展了很多。快乐编码。
我认为最好使用Mobicents jSS7