Sipstack.io provides a fast and reliable SIP framework whose primary purpose is to provide developers with a stack that is lightweight, ops-friendly and optimized for production deployment out-of-the-box. It comes with sophisticated configuration, application metrics and operational tools, allowing you and your team to build a production ready SIP service in the shortest amount of time possible. Netty.io is providing the raw network stack and pkts.io is the library used for framing and parsing of SIP messages. Currently, it has support for building stateless stacks.
The following example shows how to build a very basic UAS, capable of handling several thousands of calls per second.
1 @Sharable
2 public final class UAS extends SimpleChannelInboundHandler<SipMessageEvent> {
3
4 @Override
5 protected void channelRead0(final ChannelHandlerContext ctx, final SipMessageEvent event)
6 throws Exception {
7 final SipMessage msg = event.getMessage();
8
9 if (msg.isAck()) {
10 return;
11 }
12
13 if (msg.isRequest()) {
14 final SipResponse response = msg.createResponse(200);
15 event.getConnection().send(response);
16 }
17 }
18
19 public static void main(final String[] args) throws Exception {
20 final UAS uas = new UAS();
21 final EventLoopGroup udpGroup = new NioEventLoopGroup();
22
23 final Bootstrap b = new Bootstrap();
24 b.group(udpGroup)
25 .channel(NioDatagramChannel.class)
26 .handler(new ChannelInitializer<DatagramChannel>() {
27 @Override
28 protected void initChannel(final DatagramChannel ch) throws Exception {
29 final ChannelPipeline pipeline = ch.pipeline();
30 pipeline.addLast("decoder", new SipMessageDatagramDecoder());
31 pipeline.addLast("encoder", new SipMessageEncoder());
32 pipeline.addLast("handler", uas);
33 }
34 });
35
36 final InetSocketAddress socketAddress = new InetSocketAddress("127.0.0.1", 5060);
37 b.bind(socketAddress).sync().channel().closeFuture().await();
38 }
39 }
Head over to the Get Started guide, which will take you through the above example and in general help you get started with sipstack.io.