Search
The Open Source SLEE and SIP Server

Mobicents Diameter / Examples

Diameter Examples

Mobicents Diameter provides a great variety of examples and integration with other Mobicents servers, such as JAIN SLEE and SIP Servlets. The following examples are available:

Standalone

Mobicents Diameter Charging Server Simulator

The Mobicents Diameter Charging Server Simulator is a simple simulator able to provide limited charging options to clients, such as Mobicents SIP Servlets Ro/Rf example.

The DCS Simulator will be evolved to become a complete charging server product.

It can be downloaded from here.

 

JAIN SLEE

Mobicents Diameter Base Example

The example provided for Base is a simple application that interacts with Ericsson Diameter SDK (both client and server). The following use cases are provided by this example:

1) Application acting as Client

In this case, our application acts as a Diameter Accounting Client, issuing a Debit or Refund request to Ericsson Diameter Server. If the message is correctly built the server should send an answer back stating that the operation was carried on successfully. If not, it should respond with an error message.

2) Application acting as Server

In this situation we use Ericsson SDK as the client and the application SBB will act as the server. When the request sent by the client is received, it will check a pre-loaded set of user data and verify if the user exists, and if he has enough balance to do the Debit request. If both requirements are fulfilled, it should answer back with a 2001 (SUCCESS) Credit-Control-Answer message. If not it will answer with the appropriate code (either 5241 for USER_NOT_FOUND or 4241 for INSUFFICIENT_BALANCE).

3) Application acting as Relay/Proxy

In this last scenario our application just performs requests/answers proxying. In this scenario both Ericsson Client and Server are used. Ericsson client should be connected as a client to Mobicents Diameter, which on it's side should be configured as server (for receiving the connection from Ericsson Client) and as a client for establishing the connection to the Ericsson Server. In this scenario any Request received by the SBB is forwarded to the Server and any Answer received is routed back to the client.


Information on how to setup and detailed usage can be found at the Mobicents JAIN SLEE Diameter Base wiki page.

Mobicents Diameter OpenIMS Example

In this example we will show some integration between Mobicents and OpenIMS, using the Diameter Sh interface to receive profile updates and SIP.

The idea is to provide a service that will let a user, who has been offline, know who called him while he was offline. To do that our service will be a proxy for SIP messages in the AS so he can capture the 404 sent by the CSCF when a call is made to him, while the user is offline.

It will also register on the HSS for receiving changes to the User-IMS-State, using the proper Diameter Sh message, Profile-Notification-Request.

When a call to a non-registered user happens, data is stored, regarding the person who called and the time of the call.  When the user becomes online (registers it's SIP phone), the HSS will fire a notification with the new user state, and by that time we will look into our map to find if the user has missed any call while offline.  If so, the user will receive a message, for each missed call, stating "UserXXX sip:xxx@open-ims.test tried to call you on dd/mm/yyyy at hh:mm:ss".

This flow is described in the diagram (SIP details and CSCF <-> HSS communication are not described for simplicity purposes)


Information on how to setup and detailed usage is similar to the one found at the Mobicents SIP Servlets Diameter Sh OpenIMS Core Integration Service example page and can be found at the Mobicents JAIN SLEE Diameter Sh OpenIMS Integration example page.

 

SIP Servlets

Mobicents Diameter Event Charging Example

Diameter Event Charging service based on Location Service that performs call charging at a fixed-rate (event charging). When the call is initiated there's a debit of 10.0 euros. In case of the call being rejected or the caller hangs up before an answer is received, that value is refunded into the user account.

The steps performed by the application and container are as follows:

  • Alice makes a call to sip:receiver@sip-servlets.com. The INVITE is received by the servlet container which sends the debit request to the Charging Server and invokes the location service
  • The location service determines, using non-SIP means, where the callee (receiver) is registered with two locations, identified by, say, two SIP URIs (sip:receiver@127.0.0.1:5090 and sip:receiver@127.0.0.1:6090).
  • The service proxies to those two destinations in parallel, without record-routing, and without the supervised mode.
  • Once one of the destinations return 200 (OK), the other branch is cancelled by the container.
  • The 200 is forwarded upstream to Alice and the call setup is completed as per usual.
  • If none of the destinations accepts the call, a Diameter Accounting-Request for refund is sent to the Diameter Charging Server in order to credit the 10.0 euros debited.

Information on how to setup and detailed usage can be found at the Mobicents SIP Servlets Diameter Event Charging Service example page.

Mobicents Diameter OpenIMS Example

In this example we will show some integration between Mobicents and OpenIMS, using the Diameter Sh interface to receive profile updates and SIP.

The idea is to provide a service that will let a user, who has been offline, know who called him while he was offline. To do that our service will be a proxy for SIP messages in the AS so he can capture the 404 sent by the CSCF when a call is made to him, while the user is offline.

It will also register on the HSS for receiving changes to the User-IMS-State, using the proper Diameter Sh message, Profile-Notification-Request.

When a call to a non-registered user happens, data is stored, regarding the person who called and the time of the call.  When the user becomes online (registers it's SIP phone), the HSS will fire a notification with the new user state, and by that time we will look into our map to find if the user has missed any call while offline.  If so, the user will receive a message, for each missed call, stating "UserXXX sip:xxx@open-ims.test tried to call you on dd/mm/yyyy at hh:mm:ss".

This flow is described in the diagram (SIP details and CSCF <-> HSS communication are not described for simplicity purposes)


Information on how to setup and detailed usage can be found at the Mobicents SIP Servlets Diameter Sh OpenIMS Core Integration Service example page.

Mobicents Diameter Ro/Rf Client Example

When an INVITE is received, the Diameter Ro/Rf service checks if the caller has enough balance to establish the call, by sending an Diameter Credit-Control-Request with Cc-Request-Type AVP set to 'INITIAL_REQUEST' to the Online Charging Server (OCS) to reserve initial units. If the user is not provisioned in the OCS or has insufficient funds, a 402 (Payment Required) message is sent back to the caller and the call is cancelled; if the user has enough funds to proceed, an initial amount of credit is reserved and the call establishment proceeds.

If the callee does not answer the call the reserved units are returned back to the OCS. If the call is answered and correctly established the actual call charging starts: the initially reserved units (10 by default, corresponding to 10 seconds) start being consumed. Once those units are consumed, a new Credit-Control-Request is sent to OCS with Cc-Request-Type AVP set to 'UPDATE_REQUEST' in order to grant a new amount of units (10 by default). This is repeated whenever needed during the call.

Once the call is terminated, the amount of unused units are returned to the OCS by sending a Credit-Control-Request with Cc-Request-Type AVP set to 'TERMINATION_REQUEST'. If the balance is exhausted before the user hangs up, the call is terminated by the Ro/Rf service.

The following scenarios for 3GPP TS 32.260 (Rel 9.10) are implemented in this example, with the S-CSCF being discarded for simplicity and the AS playing both roles:

Information on how to setup and detailed usage can be found at the Mobicents SIP Servlets Diameter Ro/Rf example page.