This example shows how to terminate a credit control session.
In the following snippet, the client application initiates a graceful termination by invoking sendCCTermination. In this example, the client reports the UsedServiceUnit messages received since the last interim and includes an Event-Timestamp that contains time of session termination.
//Set the Session-Id to a unique identifier. roChargingInfo.setSessionId("FQDNServerName:servicexyz:session00001"); //Set the Destination-Realm of the OCS, which should match a route name in the Diameter_Ro.properties file. roChargingInfo.setDestinationRealm("emulators.example.com"); //Increment the CC-Request-Number by 1 for the final termination request. roChargingInfo.setCcRequestNumber(2); roChargingInfo.setServiceContextId("12345@example.com"); roChargingInfo.setEventTimeStamp(System.currentTimeMillis()); SubscriptionId subId = new SubscriptionId(); subId.setSubscriptionIdData("id0001"); subId.setSubscriptionIdType(SubscriptionIdType.END_USER_IMSI); roChargingInfo.setSubscriptionId(subId); MultipleServicesCreditControl mscc = new MultipleServicesCreditControl(); //Report final used quota in time units. UsedServiceUnit usu = new UsedServiceUnit(); usu.setCcTime(60); mscc.setUsedServiceUnits(new UsedServiceUnit[]{usu}); roChargingInfo.setMultipleServicesCreditControl(mscc); RoChargingResults roChargingResults = svc.sendCCTermination(roChargingInfo);