This example shows how to initiate a credit control session with sendCCInitial.
In the following snippet, the client application begins a credit control session by constructing an RoChargingInfo object and invoking sendCCInitial. The client requests 60 seconds in Time quota for the subscription identified as "id0001."
RoChargingInfo roChargingInfo = new RoChargingInfo(); //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"); //Set the CC-Request-Number to 0 for an initial request. roChargingInfo.setCcRequestNumber(0); roChargingInfo.setServiceContextId("12345@example.com"); //Set the subscription id to identify the end user's subscription with the OCS. SubscriptionId subId = new SubscriptionId(); subId.setSubscriptionIdData("id0001"); subId.setSubscriptionIdType(SubscriptionIdType.END_USER_IMSI); roChargingInfo.setSubscriptionId(subId); MultipleServicesCreditControl mscc = new MultipleServicesCreditControl(); //Request quota in time Units RequestedServiceUnit rsu = new RequestedServiceUnit(); rsu.setCcTime(60); mscc.setRequestedServiceUnit(rsu); roChargingInfo.setMultipleServicesCreditControl(mscc); RoChargingResults roChargingResults = svc.sendCCInitial(roChargingInfo);