This repository contains a simple Diameter parser and stack in Ruby.

Gem VersionTravis CI statusCode ClimateLicenseInline docs

Getting started

functional_test/basic_stacks.rb contains some code which can:

  • Set a handler for a particular Diameter application
  • Read Diameter messages off a TCP connection
  • Parse them and read individual AVPs
  • Create a response to Diameter messages
  • Add AVPs (including string, integer and grouped AVPs)
  • Send the response over the TCP connection

Current state

The message parsing and sending code has been verified (using Wireshark to check that the parsed values are correct and that the sent message is valid).

The Diameter stack works for basic use - it can create/accept peer connections, do the CER/CEA exchange, and allows you to register handlers for Diameter applications.

Only a small handful of AVPs are implemented - more can be added just by editing the AVAILABLE_AVPS dictionary in constants.rb, or at runtime by calling AVP.define.



  • Set up handwritten documentation (


  • Implement more AVPs (at least all the RFC 3877 and all the 3GPP ones)
  • Implement the remaining Derived AVP Data Formats (Time, UTF8String, DiameterURI, DiameterIdentity)
  • continue to improve the YARD API documentation


  • Allow disconnecting from peers
  • SCTP support
  • Send watchdog requests on a timer and track unresponsive peers
  • Handle failover/failback
  • Handle more complex routing (e.g. based on realms or via a designated proxy)
  • Provide proxy/redirect/relay function
  • Flesh out the state machine, including e.g. disconnection support
  • Dynamic peer discovery


  • Test the APIs in a variety of use-cases (e.g. server and client, test tools, maybe a real app?)



  • Set up an infrastructure for reading and parsing .pcap or PDML files, so parsed messages can be manually checked against Wireshark


  • Ruby 1.8? I'm not sure there will be demand.
  • Testing on Windows/Mac OS X