use of org.mobicents.charging.server.DiameterChargingServer in project charging-server by RestComm.
the class HTTPClientSbb method onResponseEvent.
// Event handler methods
public void onResponseEvent(ResponseEvent event, ActivityContextInterface aci) {
HttpResponse response = event.getHttpResponse();
if (tracer.isInfoEnabled()) {
tracer.info("[<<] Received HTTP Response. Status Code = " + response.getStatusLine().getStatusCode());
if (tracer.isFineEnabled()) {
try {
tracer.fine("[<<] Received HTTP Response. Response Body = [" + EntityUtils.toString(response.getEntity()) + "]");
} catch (Exception e) {
tracer.severe("[xx] Failed reading response body", e);
}
}
}
// end http activity
((HttpClientActivity) aci.getActivity()).endActivity();
// call back parent
HashMap params = (HashMap) event.getRequestApplicationData();
RatingInfo ratInfo = buildRatingInfo(response, params);
final DiameterChargingServer parent = (DiameterChargingServer) sbbContext.getSbbLocalObject().getParent();
parent.getRateForServiceResult(ratInfo);
}
use of org.mobicents.charging.server.DiameterChargingServer in project charging-server by RestComm.
the class AccountBalanceManagementSbb method handleRequest.
// ---------------------------- Helper Methods ----------------------------
private void handleRequest(CreditControlInfo ccInfo) {
if (tracer.isInfoEnabled()) {
tracer.info("[><] SID<" + ccInfo.getSessionId() + "> Handling Credit-Control-Request...");
}
if (bypass) {
if (tracer.isInfoEnabled()) {
tracer.info("[><] SID<" + ccInfo.getSessionId() + "> Bypassing Unit Reservation...");
}
ccInfo.setSuccess(true);
((DiameterChargingServer) sbbContext.getSbbLocalObject().getParent()).resumeOnCreditControlRequest(ccInfo);
} else {
DataSource ds = null;
try {
ds = getDatasource();
if (ccInfo.getRequestedAction() == RequestedActionType.DIRECT_DEBITING) {
ds.directDebitUnits(ccInfo);
} else {
ds.requestUnits(ccInfo);
}
} catch (Exception e) {
tracer.severe("[xx] Unable to obtain Datasource Child SBB", e);
}
}
}
Aggregations