use of javax.slee.ActivityContextInterface in project jain-slee.diameter by RestComm.
the class HSSClientChildSbb method getShClientActivity.
private ShClientActivity getShClientActivity() throws IOException {
try {
ShClientActivity activity = diameterShClientSbbInterface.createShClientActivity();
ActivityContextInterface aci = diameterShClientACIF.getActivityContextInterface(activity);
aci.attach(sbbContext.getSbbLocalObject());
return activity;
} catch (Exception e) {
throw new IOException(e.getMessage(), e);
}
}
use of javax.slee.ActivityContextInterface in project jain-slee.diameter by RestComm.
the class HSSClientChildSbb method storeRequestInACI.
private void storeRequestInACI(ShClientActivity activity, DiameterShMessage message) {
ActivityContextInterface aci = diameterShClientACIF.getActivityContextInterface(activity);
RequestMappingACI rmACI = asSbbActivityContextInterface(aci);
rmACI.setRequestData(new MessageData(message));
}
use of javax.slee.ActivityContextInterface in project charging-server by RestComm.
the class HTTPClientSbb method getRateForServiceAsync.
public RatingInfo getRateForServiceAsync(HashMap params) {
String sessionIdFromRequest = params.get("SessionId").toString();
HttpClientActivity clientActivity = null;
try {
clientActivity = raSbbInterface.createHttpClientActivity(true, null);
} catch (StartActivityException e) {
tracer.severe("[xx] Failed creating HTTP Client Activity to send HTTP Request to Rating Engine.");
return new RatingInfo(-1, sessionIdFromRequest);
}
ActivityContextInterface clientAci = httpClientAci.getActivityContextInterface(clientActivity);
clientAci.attach(sbbContext.getSbbLocalObject());
params.put("startTime", System.currentTimeMillis());
HttpPost httpPost = buildHTTPRequest(params);
// Asynchronous call
clientActivity.execute(httpPost, params);
tracer.info("[>>] Sent HTTP Request to Rating Client in asynchronous mode.");
return null;
}
use of javax.slee.ActivityContextInterface in project charging-server by RestComm.
the class DiameterChargingServerSbb method resumeOnCreditControlRequest.
// private String storedEndUserId;
// private long storedRequestedUnits;
// private long[] storedServiceIds;
// private ArrayList<UnitReservation> storedReservations = new ArrayList<UnitReservation>();
@Override
public void resumeOnCreditControlRequest(CreditControlInfo ccInfo) {
UserSessionInfo sessionInfo = getSessionInfo();
RoCreditControlRequest storedCCR = sessionInfo.getCcr();
if (tracer.isInfoEnabled()) {
tracer.info("[<<] " + sidString + " Resuming Handling of Credit-Control-Request [" + storedCCR.getCcRequestType().toString() + "]");
}
if (tracer.isFineEnabled()) {
tracer.fine("[<<] \" + sidString + \" " + ccInfo);
}
sessionInfo.getReservations().add(ccInfo);
setSessionInfo(sessionInfo);
long resultCode = DiameterResultCode.DIAMETER_SUCCESS;
if (ccInfo.isSuccessful()) {
if (tracer.isInfoEnabled()) {
tracer.info("[>>] " + sidString + " '" + sessionInfo.getEndUserId() + "' GRANTED for '" + Arrays.toString(sessionInfo.getServiceIds()) + "'.");
}
} else {
if (tracer.isInfoEnabled()) {
tracer.info("[>>] " + sidString + " '" + sessionInfo.getEndUserId() + "' DENIED for '" + Arrays.toString(sessionInfo.getServiceIds()) + "'.");
}
// If we can't determine error, say UNABLE_TO_COMPLY
resultCode = ccInfo.getErrorCodeType() != null ? getResultCode(ccInfo.getErrorCodeType()) : DiameterResultCode.DIAMETER_UNABLE_TO_COMPLY;
}
try {
ActivityContextInterface[] acis = this.sbbContextExt.getActivities();
ActivityContextInterface aci = null;
RoServerSessionActivity activity = null;
for (ActivityContextInterface curAci : acis) {
if (curAci.getActivity() instanceof RoServerSessionActivity) {
aci = curAci;
activity = (RoServerSessionActivity) curAci.getActivity();
break;
}
}
RoCreditControlAnswer cca = sessionInfo.getReservations().size() > 0 ? createCCA(activity, storedCCR, sessionInfo.getReservations(), resultCode) : createCCA(activity, storedCCR, null, DiameterResultCode.DIAMETER_MISSING_AVP);
sendCCA(cca, aci, storedCCR.getCcRequestType() == CcRequestType.TERMINATION_REQUEST || storedCCR.getCcRequestType() == CcRequestType.EVENT_REQUEST);
// Output the user session details.
if (tracer.isInfoEnabled()) {
tracer.info("[--] " + sidString + " CCA successfully sent.");
}
if (tracer.isFineEnabled()) {
tracer.fine("[--] " + sidString + "Dumping session info...\n" + sessionInfo);
}
} catch (Exception e) {
tracer.severe("[xx] " + sidString + " Unable to send Credit-Control-Answer.", e);
}
if (generateCDR && cdrGenerator != null && storedCCR.getCcRequestType() == CcRequestType.TERMINATION_REQUEST) {
if (tracer.isInfoEnabled()) {
tracer.info("[><] " + sidString + " Generating CDR.");
}
try {
cdrGenerator.writeCDR(sessionInfo);
} catch (Exception e) {
tracer.severe("[xx] " + sidString + " Unable to generate CDR", e);
}
}
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class RxSmppServerSbb method onRecoverablePduExceptionLocal.
private void onRecoverablePduExceptionLocal(final RxSmppServerSbbUsage anSbbUsage, final RecoverablePduException event, final ActivityContextInterface aci) {
if (logger.isFineEnabled())
logger.fine("onRecoverablePduException - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
if (rxSmppServerSbbLocalObject != null) {
ActivityContextInterface act = getSchedulerActivityContextInterface();
if (act != null) {
try {
act.attach(rxSmppServerSbbLocalObject);
fireRecoverablePduExceptionChild(event, act, null);
} catch (IllegalStateException e) {
if (logger.isInfoEnabled())
logger.info("onRecoverablePduException - IllegalStateException (activity is ending - dropping a SLEE event because it is not needed) : new activity=" + act.getActivity() + ", event=" + event);
}
}
}
}
Aggregations