Search in sources :

Example 1 with DiameterActivity

use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.

the class DiameterCCAResourceAdaptor method processRequest.

// NetworkReqListener Implementation -----------------------------------
public Answer processRequest(Request request) {
    // FIXME: baranowb: check if ACR is vald here also
    if (request.getCommandCode() == CreditControlRequest.commandCode) {
        DiameterActivity activity;
        try {
            activity = raProvider.createActivity(request);
            if (activity == null) {
                tracer.severe("Diameter CCA RA :: Failed to create session, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
            } else {
                // We can only have server session?, but for sake error catching
                if (activity instanceof CreditControlServerSession) {
                    CreditControlServerSessionImpl session = (CreditControlServerSessionImpl) activity;
                    ((ServerCCASessionImpl) session.getSession()).processRequest(request);
                }
            }
        } catch (CreateActivityException e) {
            tracer.severe("Failure trying to create CCA Activity.", e);
        }
    } else {
        tracer.severe("Diameter CCA RA :: Received unexpected Request. Either its not CCR or session should exist to handle this, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
    }
    // Returning null so we can answer later
    return null;
}
Also used : CreditControlServerSession(net.java.slee.resource.diameter.cca.CreditControlServerSession) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) DiameterActivity(net.java.slee.resource.diameter.base.DiameterActivity) ServerCCASessionImpl(org.jdiameter.server.impl.app.cca.ServerCCASessionImpl)

Example 2 with DiameterActivity

use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.

the class DiameterRxResourceAdaptor method processRequest.

// NetworkReqListener Implementation -----------------------------------
public Answer processRequest(final Request request) {
    if (tracer.isInfoEnabled()) {
        tracer.info("Diameter Rx RA :: Got Request. Command-Code[" + request.getCommandCode() + "]");
    }
    // FIXME: baranowb: check if ACR is vald here also
    if (request.getCommandCode() == AARequest.commandCode) {
        DiameterActivity activity;
        try {
            activity = raProvider.createActivity(request);
            if (activity == null) {
                tracer.severe("Diameter Rx RA :: Failed to create session, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
            } else {
                if (activity instanceof RxServerSessionActivity) {
                    final RxServerSessionActivityImpl session = (RxServerSessionActivityImpl) activity;
                    ((ServerRxSessionImpl) session.getSession()).processRequest(request);
                }
            }
        } catch (CreateActivityException e) {
            tracer.severe("Failure trying to create Rx Activity.", e);
        }
        // Returning null so we can answer later
        return null;
    } else {
        if (tracer.isInfoEnabled()) {
            tracer.info("Diameter Rx RA :: Received unexpected Request. Either its not CCR or session should exist to handle this, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
        }
    }
    return null;
}
Also used : ServerRxSessionImpl(org.jdiameter.server.impl.app.rx.ServerRxSessionImpl) RxServerSessionActivity(net.java.slee.resource.diameter.rx.RxServerSessionActivity) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) DiameterActivity(net.java.slee.resource.diameter.base.DiameterActivity)

Example 3 with DiameterActivity

use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.

the class DiameterRoResourceAdaptor method processRequest.

// NetworkReqListener Implementation -----------------------------------
public Answer processRequest(Request request) {
    if (tracer.isInfoEnabled()) {
        tracer.info("Diameter Ro RA :: Got Request. Command-Code[" + request.getCommandCode() + "]");
    }
    // FIXME: baranowb: check if ACR is vald here also
    if (request.getCommandCode() == RoCreditControlRequest.commandCode) {
        DiameterActivity activity;
        try {
            activity = raProvider.createActivity(request);
            if (activity == null) {
                tracer.severe("Diameter Ro RA :: Failed to create session, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
            } else {
                // We can only have server session?, but for sake error catching
                if (activity instanceof RoServerSessionActivity) {
                    RoServerSessionActivityImpl session = (RoServerSessionActivityImpl) activity;
                    ((ServerRoSessionImpl) session.getSession()).processRequest(request);
                }
            }
        } catch (CreateActivityException e) {
            tracer.severe("Failure trying to create Ro Activity.", e);
        }
        // Returning null so we can answer later
        return null;
    } else {
        if (tracer.isInfoEnabled()) {
            tracer.info("Diameter Ro RA :: Received unexpected Request. Either its not CCR or session should exist to handle this, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
        }
    }
    return null;
}
Also used : RoServerSessionActivity(net.java.slee.resource.diameter.ro.RoServerSessionActivity) ServerRoSessionImpl(org.jdiameter.server.impl.app.ro.ServerRoSessionImpl) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) DiameterActivity(net.java.slee.resource.diameter.base.DiameterActivity)

Example 4 with DiameterActivity

use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.

the class DiameterShServerResourceAdaptor method fireEvent.

// Event and Activities management -------------------------------------
public boolean fireEvent(Object event, ActivityHandle handle, FireableEventType eventID, Address address, boolean useFiltering, boolean transacted) {
    if (useFiltering && eventIDFilter.filterEvent(eventID)) {
        if (tracer.isFineEnabled()) {
            tracer.fine("Event " + eventID + " filtered");
        }
    } else if (eventID == null) {
        tracer.severe("Event ID for " + eventID + " is unknown, unable to fire.");
    } else {
        if (tracer.isFineEnabled()) {
            tracer.fine("Firing event " + event + " on handle " + handle);
        }
        try {
            /* TODO: Support transacted fire of events when in cluster
        if (transacted){
          this.raContext.getSleeEndpoint().fireEventTransacted(handle, eventID, event, address, null, EVENT_FLAGS);
        }
        else */
            {
                DiameterActivity activity = (DiameterActivity) getActivity(handle);
                if (activity instanceof ShServerActivityImpl) {
                    ((ShServerActivityImpl) activity).fetchSessionData((DiameterMessage) event, true);
                } else if (activity instanceof ShServerSubscriptionActivityImpl) {
                    ((ShServerSubscriptionActivityImpl) activity).fetchSessionData((DiameterMessage) event, true);
                }
                this.raContext.getSleeEndpoint().fireEvent(handle, eventID, event, address, null, EVENT_FLAGS);
            }
            return true;
        } catch (Exception e) {
            tracer.severe("Error firing event.", e);
        }
    }
    return false;
}
Also used : DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterActivity(net.java.slee.resource.diameter.base.DiameterActivity) AvpDataException(org.jdiameter.api.AvpDataException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException)

Example 5 with DiameterActivity

use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.

the class DiameterShServerResourceAdaptor method sessionCreated.

// Session Management --------------------------------------------------
public void sessionCreated(ServerShSession session, boolean isSubscription) {
    // Make sure it's a new session and there's no activity created yet.
    if (this.getActivity(getActivityHandle(session.getSessions().get(0).getSessionId())) != null) {
        tracer.warning("Activity found for created Credit-Control Server Session. Shouldn't exist. Aborting.");
        return;
    }
    // Get Message Factories (for Base and ShServer)
    DiameterMessageFactoryImpl baseMsgFactory = new DiameterMessageFactoryImpl(session.getSessions().get(0), this.stack);
    ShServerMessageFactoryImpl shServerMsgFactory = new ShServerMessageFactoryImpl(baseMsgFactory, session.getSessions().get(0), this.stack, this.shAvpFactory);
    // Create Server Activity
    DiameterActivity activity = null;
    if (isSubscription) {
        ShServerSubscriptionActivityImpl _activity = new ShServerSubscriptionActivityImpl(shServerMsgFactory, this.shAvpFactory, session, null, null);
        _activity.setSessionListener(this);
        activity = _activity;
        activityCreated(activity, false);
    } else {
        ShServerActivityImpl _activity = new ShServerActivityImpl(shServerMsgFactory, this.shAvpFactory, session, null, null);
        _activity.setSessionListener(this);
        activity = _activity;
        activityCreated(activity, false);
    }
}
Also used : DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) DiameterActivity(net.java.slee.resource.diameter.base.DiameterActivity)

Aggregations

DiameterActivity (net.java.slee.resource.diameter.base.DiameterActivity)7 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)6 IOException (java.io.IOException)1 OperationNotSupportedException (javax.naming.OperationNotSupportedException)1 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)1 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 CreditControlServerSession (net.java.slee.resource.diameter.cca.CreditControlServerSession)1 GqServerSessionActivity (net.java.slee.resource.diameter.gq.GqServerSessionActivity)1 GxServerSessionActivity (net.java.slee.resource.diameter.gx.GxServerSessionActivity)1 RoServerSessionActivity (net.java.slee.resource.diameter.ro.RoServerSessionActivity)1 RxServerSessionActivity (net.java.slee.resource.diameter.rx.RxServerSessionActivity)1 AvpDataException (org.jdiameter.api.AvpDataException)1 ServerCCASessionImpl (org.jdiameter.server.impl.app.cca.ServerCCASessionImpl)1 GqServerSessionImpl (org.jdiameter.server.impl.app.gq.GqServerSessionImpl)1 ServerGxSessionImpl (org.jdiameter.server.impl.app.gx.ServerGxSessionImpl)1 ServerRoSessionImpl (org.jdiameter.server.impl.app.ro.ServerRoSessionImpl)1 ServerRxSessionImpl (org.jdiameter.server.impl.app.rx.ServerRxSessionImpl)1 DiameterMessageFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl)1