SCTP Support in Mobicents Diameter 1.5.0.FINAL!

Tuesday, February 5, 2013 em 10:33
Mobicents Diameter 1.5.0.FINAL has been released last week (announcement) and as it's main highlight is the addition of Stream Control Transmission Protocol (SCTP, RFC 2960).

SCTP was designed to transport PSTN signaling messages over IP Networks, but become a general purpose protocol. It brings features from both UDP and TCP protocols with important additions. The two main improvements over traditional transport protocols are:
  • Multi-homing: instead of a single IP:port connection, an SCTP connection can make use of several IP addresses, if available at the endpoint, providing physical interface fault tolerance and higher availability.
  • Multi-streaming: While in TCP if there's a loss at the head of line, all subsequent packets must be delayed until a re-transmission (Head-of-Line Blocking), SCTP supports multiple streams (up to 64K) each one with it's own ordering, not causing a delay in other streams when there are losses.
It also provides many other interesting improvements (SYN-flood protection, preserved message boundaries, built-in heartbeat, etc.) that make SCTP a great transport protocol!

The integration of SCTP in Mobicents Diameter Stack was a contribution from Smilecoms with the Mobicents team support and by using the Mobicents SCTP Library. The requirements for using it are an operating system which supports SCTP (either natively or through third-party libraries) and JDK7.  

You can enable it in Mobicents Diameter by adding the following to your jdiameter-config.xml:
<?xml version="1.0"?>
<Configuration xmlns="http://www.jdiameter.org/jdiameter-server">
 ...
 <Network>
  <Peers>
   ...
   <-- For SCTP we have to add portRange, a port range to use for establishing connections -->
   <Peer name="aaa://127.0.0.1:1218" portRange="25000-35000" attempt_connect="false" rating="1" />
   ...
  </Peers>
  ...
 </Network>

 ...

 <Extensions>
  <-- Set SCTP classes as extension points for Connection and Network Guard -->
  <Connection value="org.jdiameter.client.impl.transport.sctp.SCTPClientConnection" />
  <NetworkGuard value="org.jdiameter.server.impl.io.sctp.NetworkGuard" />
 </Extensions>
</Configuration>

So, as you see in line 8, there's a new parameter that has to be added to the peer definition, which is the portRange. Such parameter is also available for TCP but it's usage is optional, while for SCTP it is mandatory as there's no wildcard value for picking any available port.

At lines 18 and 19, it's the extension point definition, so the stack uses SCTP connection client and Network Guard instead of the default TCP.

This is it.. as simple as it gets! Hope to get some feedback on this first version of Mobicents Diameter SCTP support. Feel free to leave comments on this post or at the feature issue.

Also, make sure to check all the other enhancements in Mobicents Diameter 1.5.0.FINAL!

7 comentários

  1. Can you please add a sample code on how to achieve the same at run-time using EmptyConfiguration class?
    Thank you!

  2. It can be achieved with:

    add(PeerTable,
    // Add Peer (with port range)
    getInstance().
    add(PeerRating, 1).
    add(PeerName, "aaa://127.0.0.1:1218").
    add(PeerLocalPortRange, "25000-35000"));

    // Set SCTP Connection and Network Guard classes
    AppConfiguration internalExtensions = (AppConfiguration) getChildren(Parameters.Extensions.ordinal())[ExtensionPoint.Internal.id()];
    internalExtensions.
    add(ExtensionPoint.InternalConnectionClass, "org.jdiameter.client.impl.transport.sctp.SCTPClientConnection").
    add(ExtensionPoint.InternalNetworkGuard, "org.jdiameter.server.impl.io.sctp.NetworkGuard");

    Regards.

  3. relics Says:

    Hi,

    I had followed the steps as mentioned in the below link for SCTP support.

    http://ammendonca.blogspot.in/2013/02/sctp-support-in-mobicents-diameter.html


    I had come across below exception when i start the stack as a client, On debug i had come across an observation where the ordinal values assigned to QueueSize and InternalConnectionClass seems to be same i.e 7, So when the QueueSize was retrieved it gives the SCTP connection class configured in the jdiameter-client-config due to which it gives the below exception.

    Can you please do the needful, let me know if i need to configure anything further to avoid this issue.

    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
    at org.jdiameter.client.impl.helpers.EmptyConfiguration.getIntValue(EmptyConfiguration.java:143)
    at org.jdiameter.client.impl.fsm.PeerFSMImpl.(PeerFSMImpl.java:110)
    at org.jdiameter.client.impl.fsm.FsmFactoryImpl.createInstanceFsm(FsmFactoryImpl.java:49)
    at org.jdiameter.client.impl.controller.PeerImpl.(PeerImpl.java:267)
    Br,

    Vinay . R M

  4. relics Says:

    Hi,

    Below is the issue which we identified.

    In the client XMLConfiguration add, in the addExtension method i had to replace add method with addInternalExtensions method.

    ------------omitting other codes -------------------
    changed from ---> if (nodeName.equals("MetaData")) { add(ExtensionPoint.InternalMetaData,getValue(c.item(i))); }
    changed to -----> if (nodeName.equals("MetaData")) { addInternalExtension(ExtensionPoint.InternalMetaData,getValue(c.item(i))); }


    The addInternalExtension method i was able to get it from the server package.


    Br,
    Vinay R M.

  5. Vinay, thanks for the correction. I'll make sure to apply it.

  6. relics Says:

    You are welcome Alexandre.

  7. Is it possible to connect to both SCTP and TCP nodes at the same time? I removed the portRange attribute and tried.
    Doesn't seem to work though.

Post a Comment