Search in sources :

Example 31 with DiameterMessage

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

the class DiameterGxResourceAdaptor method fireEvent.

/**
 * {@inheritDoc}
 */
@Override
public void fireEvent(final String sessionId, final Message message) {
    final DiameterMessage event = (DiameterMessage) createEvent(message);
    final FireableEventType eventId = eventIdCache.getEventId(eventLookup, message);
    this.fireEvent(event, getActivityHandle(sessionId), eventId, null, true, message.isRequest());
}
Also used : DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) FireableEventType(javax.slee.resource.FireableEventType)

Example 32 with DiameterMessage

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

the class GqSessionActivityImpl method sendSyncMessage.

@Override
public DiameterMessage sendSyncMessage(DiameterMessage message) {
    DiameterMessage answer = null;
    Message receivedMessage = doSendMessage(message);
    if (receivedMessage != null) {
        if (!receivedMessage.isRequest()) {
            if (receivedMessage.isError()) {
                answer = new ErrorAnswerImpl(receivedMessage);
            } else {
                switch(receivedMessage.getCommandCode()) {
                    case GqAARequest.COMMAND_CODE:
                        answer = new GqAARequestImpl(receivedMessage);
                        break;
                    case GqAbortSessionRequest.COMMAND_CODE:
                        answer = new GqAbortSessionRequestImpl(receivedMessage);
                        break;
                    case GqReAuthRequest.COMMAND_CODE:
                        answer = new GqReAuthRequestImpl(receivedMessage);
                        break;
                    case GqSessionTerminationRequest.COMMAND_CODE:
                        answer = new GqSessionTerminationRequestImpl(receivedMessage);
                        break;
                    default:
                        logger.error("Received an unknown type of Message for Gq' Activity: " + receivedMessage);
                        break;
                }
            }
        } else {
            logger.error("Received a REQUEST message when expecting an ANSWER.");
        }
    } else {
        logger.debug("No answer received. Returning null.");
    }
    return answer;
}
Also used : GqReAuthRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqReAuthRequestImpl) GqSessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl) GqAbortSessionRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) Message(org.jdiameter.api.Message) GqAARequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)

Example 33 with DiameterMessage

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

the class RfSessionActivityImpl method sendSyncMessage.

@Override
public DiameterMessage sendSyncMessage(DiameterMessage message) {
    DiameterMessage answer = null;
    Message receivedMessage = doSendMessage(message);
    if (receivedMessage != null) {
        if (!receivedMessage.isRequest()) {
            if (receivedMessage.isError()) {
                answer = new ErrorAnswerImpl(receivedMessage);
            } else {
                switch(receivedMessage.getCommandCode()) {
                    case RfAccountingRequest.commandCode:
                        answer = new RfAccountingRequestImpl(receivedMessage);
                        break;
                    default:
                        logger.error("Received an unknown type of Message for Rf Activity: " + receivedMessage);
                        break;
                }
            }
        } else {
            logger.error("Received a REQUEST message when expecting an ANSWER.");
        }
    } else {
        logger.debug("No answer received. Returning null.");
    }
    return answer;
}
Also used : DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) RfAccountingRequestImpl(org.mobicents.slee.resource.diameter.rf.events.RfAccountingRequestImpl)

Example 34 with DiameterMessage

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

the class DiameterRfResourceAdaptor method fireEvent.

/*
   * (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.base.handlers.BaseSessionCreationListener#fireEvent(java.lang.String, org.jdiameter.api.Request, org.jdiameter.api.Answer)
   */
public void fireEvent(String sessionId, Message message) {
    DiameterMessage event = (DiameterMessage) createEvent(message);
    FireableEventType eventId = eventIdCache.getEventId(eventLookup, message);
    this.fireEvent(event, getActivityHandle(sessionId), eventId, null, true, message.isRequest());
}
Also used : DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) FireableEventType(javax.slee.resource.FireableEventType)

Aggregations

DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)34 Message (org.jdiameter.api.Message)14 FireableEventType (javax.slee.resource.FireableEventType)12 ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)7 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)4 ExtensionDiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)4 OperationNotSupportedException (javax.naming.OperationNotSupportedException)3 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)3 IOException (java.io.IOException)2 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)2 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)2 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)2 ServerShSession (org.jdiameter.api.sh.ServerShSession)2 ShServerSessionDataLocalImpl (org.jdiameter.server.impl.app.sh.ShServerSessionDataLocalImpl)2 ShServerSessionImpl (org.jdiameter.server.impl.app.sh.ShServerSessionImpl)2 DiameterMessageFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl)2 AbortSessionAnswerImpl (org.mobicents.slee.resource.diameter.base.events.AbortSessionAnswerImpl)2 AccountingAnswerImpl (org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl)2 CapabilitiesExchangeAnswerImpl (org.mobicents.slee.resource.diameter.base.events.CapabilitiesExchangeAnswerImpl)2