...
Code Block |
---|
java -jar start.jar etc/cipango.xml etc/diameter.xml |
The diameter module scans the deployed application at startup and looks for To use diameter, a class implementing the DiameterListener
interface 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.
The DiameterListener
is defined as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
package org.cipango.diameter.app;
public interface DiameterListener
{
void doRequest(DiameterRequest request) throws IOException;
void doAnswer(DiameterAnswer answer) throws IOException;
}
|
The DiameterFactory
The DiameterFactory
class is used to create instances of DiameterRequest
.
Cipango makes an instance of org.cipango.diameter.DiameterFactory
available to servlets via the servlet context attribute of the same name, org.cipango.diameter.DiameterFactory
.
Usage
The following code sample illustrates how to create an UDR
request:
Code Block | ||||
---|---|---|---|---|
| ||||
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).