Product SiteDocumentation Site

3.2. The Diameter Event-Changing Service

The Diameter Event-Changing Service is based on the Location Service, which performs call-charging at a fixed rate. Upon the initiation of a call, a debit of €10.00 occurs. In the cases of a call being rejected or the caller disconnecting (hanging up) before an answer is received, the caller's account is refunded.
Note that an MSS for JBoss installation is required to run this example; it will not work with MSS for Tomcat.
Provided here is a step-by-step description of the procedure as performed by the application and container:
Procedure 3.2. Diameter Event-Changing Service Step-By-Step
  1. A user, Alice, makes a call to sip:receiver@sip-servlets.com. The INVITE is received by the servlet container, which sends a request to debit Alice's account to the Charging Server. The servlet container then invokes the location service.
  2. the Location Service determines, without using the SIP protocol itself, where the callee—or receiver—is registered. The callee may be registered at two locations identified by two SIP URIs: sip:receiver@127.0.0.1:5090 and sip:receiver@127.0.0.1:6090.
  3. The Location Service proxies to those two destinations simultaneously, without record-routing and without using supervised mode.
  4. One of the destinations returns 200 (OK), and so the container cancels the other.
  5. The 200 (OK) is forwarded upstream to Alice and the call setup is carried out as usual.
  6. If neither or none of the registered destinations accepts the call, a Diameter Accounting-Request for refund is sent to the Diameter Charging Server in order to debit the already-credited €10.00

3.2.1. Diameter Event-Changing Service: Installing, Configuring and Running

Preparing your MSS for JBoss server to run the Diameter Event-Changing example requires downloading a WAR archive, a DAR archive, the Ericsson Charging Emulator, setting an attribute in JBoss's server.xml configuration file, and then running JBoss AS. Detailed instructions follow.
Pre-Install Requirements and Prerequisites
 
Software Prerequisites
One MSS for JBoss Installation
Before proceeding, you should follow the instructions for installing, configuring, running and testing MSS for JBoss from the binary distribution.
Downloading
 
  1. First, download the Web Application Archive (WAR) file corresponding to this example, the current version of which is named diameter-event-charging-1.0.war, from http://repository.jboss.org/maven2/org/mobicents/servlet/sip/example/diameter-event-charging/1.0/.
  2. Secondly, download the corresponding Disk ARchive (DAR) configuration file here: , from http://www.mobicents.org/diametereventcharging-dar.properties.
  3. Finally, you will need to download the Ericsson Charging Emulator, version 1.0, from http://www.ericsson.com/mobilityworld/developerszonedown/downloads/tools/charging_solutions/ChargingSDK-1_0_D31E.zip.
Installing
 
  1. Place the diameter-event-charging-1.0.war WAR archive into the jboss_home/server/<profile>/deploy directory, where <deploy> is your Configuration Profile, whether “default” or “all” (the latter if you are using MSS for JBoss's clustering capabilities).
  2. Place the diametereventcharging-dar.properties DAR file in your $JBOSS_HOME/server/<profile>/conf/dars directory.
  3. Finally, open the terminal, move into the directory to which you downloaded the Ericsson Charging SDK (for the sake of this example, we will call this directory charging_sdk), and then unzip the downloaded zip file (you can use Java's jar -xvf command for this:
    ~]$ cd charging_sdk
    charging_sdk]$ jar -xvf ChargingSDK-1_0_D31E.zip
    
    Alternatively, you can use Linux's unzip command to do the dirty work:
    charging_sdk]$ unzip ChargingSDK-1_0_D31E.zip
    
Configuring
To configure the server for the Event-Changing example, simply open the server.xml configuration file in your server's $JBOSS_HOME/server/<profile>/deploy/jboss-web.deployer/ directory, and edit the value of the darConfigurationFileLocation attribute of the Service element so that it is “conf/dars/mobicents-dar.properties”. For example:
  1 ...
    
    <Service name="jboss.web"
          className="org.mobicents.servlet.sip.startup.SipStandardService"
  5   		sipApplicationDispatcherClassName="org.mobicents.servlet.sip.core.SipApplicationDispatcherImpl"
      		sipApplicationRouterClassName="org.mobicents.servlet.sip.router.DefaultApplicationRouter"
      		darConfigurationFileLocation="conf/dars/mobicents-dar.properties">
    
    ...
 10 
Example 3.3. Editing the darConfigurationFileLocation Attribute of the Service Tag

Running
 
Procedure 3.3. Diameter Event-Changing Service
  1. First, you should run your MSS for JBoss server. For instructions on doing so, refer to Section 2.1.7, “Running”.
  2. Then, run the Ericsson Charging Emulator. Open a terminal, change the working directory to the location of the unzipped Charging Emulator files (in ChargingSDK-1_0_D31E or a similarly-named directory), and run it with the java -jar PPSDiamEmul.jar command:
    ~]$ java -jar PPSDiamEmul.jar
    
Using
Using the Event-Changing service means, firstly, inserting some parameters into the Charging Emulator, and then, by using two SIP (soft)phones, calling one with the other. The following sequential instructions show you how.

SIP (Soft)Phone? Which?

The Mobicents team recommends one of the following SIP phones, and has found that they work well: the 3CX Phone, teh SJ Phone or the WengoPhone.
Procedure 3.4. Using the Diameter Event-Changing Service
  1. Configure the Ericsson SDK Charging Emulator

    Once you have started the Charging Emulator, you should configure it exactly as portrayed in the screenshot.
    Configuring the Charging Emulator
    1. Set the Peer Id to: aaa://127.0.0.1:21812
    2. Set the Realm to: mobicents.org
    3. Set the Host IP to: 127.0.0.1
  2. Start two SIP (soft)phones. You should set the first phone up with the following parameters: sip:receiver@sip-servlets on IP address 127.0.0.1 on port 5090. The other phone can be set up any way you like.
  3. Before making a call, open the ConfigOptions dialog window, as shown in the image.
    Configuring Accounts in the Charging Emulator
    In the Account Configuration window of the Charging Emulator, you can see the user's balances. Select a user to watch the balance. You can also stretch the window lengthwise to view the user's transaction history.
  4. Time to call! From the second, “any-configuration” phone, make a call to sip:receiver@sip-servlets.com. Upon doing so, the other phone should ring or signal that it is being contacted .
  5. You should be able to see a request—immediately following the invite and before the other party (i.e. you) accepts or rejects the call—sent to the Charging Emulator. That is when the debit of the user's account is made. In the case that the call is rejected, or the caller gives up, a second, new Diameter request is sent to refund the initial amount charged by the call. On the other hand, if the call is accepted, nothing else related to Diameter happens, and no second request takes place.
    Please not that this is not the truly-correct way to do charging, as Diameter provides other means, such as unit reservation. However, for the purpose of a demonstration it is sufficient to show the debit and follow-up credit working. Also, this is a fixed-price call, regardless of the duration. Charging can, of course, be configured so that it is time-based.