Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Diameter support in Cipango is designed to offer a servlet-like programming model.

Configuration

Adding diameter support

Diameter support is optional and should be activated first. To start Cipango with diameter, add the diameter.xml to the command runline. For instance:

Code Block
java -jar start.jar --ini=start-cipango.ini etc/diameter.xml

API

Javadoc

Javadoc is available at http://www.cipango.org/javadoc/diameter-2.0/.

DiameterListener

To use diameter, a class implementing the DiameterListener must be declared within the application. This is similar to the TimerListener used for the SIP Servlet TimerService.This interface is then invoked when diameter messages are received.

...

Code Block
java
java
package org.cipango.diameter.appapi;

public interface DiameterListener extends EventListener
{
	/**
	 * The <code>handle</code> method  void doRequest(DiameterRequest request) throws IOException; 
    void doAnswer(DiameterAnswer answeris invoked by the container when a Diameter message should be
	 * passed to the application.
	 */
	void handle(DiameterServletMessage message) throws IOException;
}
}

The DiameterFactory

The DiameterFactory class is used to create instances of DiameterRequest [DiameterServletRequest|http://www.cipango.org/javadoc/diameter-2.0/org/cipango/diameter/api/DiameterServletRequest.html.

Cipango makes an instance of org.cipango.diameter.api.DiameterFactory available to servlets via the servlet context attribute of the same name, org.cipango.diameter.api.DiameterFactory.

Usage

The following code sample illustrates how to create an UDR request:

Code Block
java
java
DiameterFactory factory = (DiameterFactory) getServletContext().getAttribute(DiameterFactory.class.getName()); 
DiameterRequest request = factory.createRequest(Sh.SH_APPLICATION_ID, Sh.UDR,"home1.net","hss1.home1.net"); 
AVP<AVPList> userIdentity = factory.createAVPList(Sh.USER_IDENTITY);
userIdentity.addValue(Cx.PUBLIC_IDENTITY,"sip:alice@atlanta.com"); 
request.addAVP(userIdentity); 
request.add(Sh.DATA_REFERENCE, Sh.DataReference.IMSUserState); 
request.send();

Logging

Diameter messages are logged in the file ${jetty.home}/logs/yyyy_mm_dd.diameter.log (replace yyyy_mm_dd by the current date).