Mobicents Sip Servlets
Diameter Event Charging Service
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:email@example.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:firstname.lastname@example.org:5090 and sip:email@example.com: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.
How to activate it
From the binary
You can find the war file corresponding to this example here
Drop the downloaded war file into your jboss_home/server/default/deploy directory
Get the corresponding dar configuration file
To understand what the dar configuration file is used for, check the Application Router Documentation .
Drop it in your jboss_home/server/default/conf/dars directory.
To use this dar file for this service, specify in the Service xml tag, darConfigurationFileLocation attribute of the jboss_home/server/default/deploy/jboss-web.deployer/server.xml , the following :
You can now run your JBoss container.
From the source
Please check out the location service example located under this location from the svn repository.
Follow the instructions in the README.txt to build and run the example.
How to play with it
This example must be run under JBoss.
You will also need Ericsson SDK Charging Emulator v1.0 .
Run the Charging Emulator (PPSDiamEmul.jar) and configure it like this:
Peer Id: aaa://127.0.0.1:21812
Host IP: 127.0.0.1\
Start two SIP Phones.
One phone should be setup as sip:firstname.lastname@example.org on ip address 127.0.0.1 and port 5090
The other phone can be setup as anything.
The SIP phone doesn't have to be registered.
We recommend using 3CX Phone, SJ Phone or WengoPhone.
From the second phone, make a call to sip:email@example.com you should have the other phone ringing.
You should see there is one first request, right after the invite and before the other party accept/reject the call, sent to the Charging Emulator, that's when the debit is made. In case the call is rejected, or the caller gives up, there's a new Diameter Request sent which will be the refund of the unused value. In case the call is accepted, nothing else will happen, related to Diameter.
You can see the user balance in the emulator: in the menu Config > Account > Click on "00001000-Klas Svensson" and watch the balance. Stretch the window down to see the history.
Please note that this is not the most correct way to do charging, as Diameter provides other means such as unit reservation, but only as purpose of a demo, where you can see debit and refund working. Also, this is a fixed price call, no matter what the duration. You can also have it using time-based charging.