Search in sources :

Example 1 with GqAARequestImpl

use of org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl in project jain-slee.diameter by RestComm.

the class DiameterGqResourceAdaptor method createEvent.

/**
 * Create Event object from a JDiameter message (request or answer)
 *
 * @return a DiameterMessage object wrapping the request/answer
 * @throws OperationNotSupportedException
 */
private DiameterMessage createEvent(Message message) {
    if (message == null) {
        throw new NullPointerException("Message argument cannot be null while creating event.");
    }
    int commandCode = message.getCommandCode();
    if (message.isError()) {
        return new ErrorAnswerImpl(message);
    }
    boolean isRequest = message.isRequest();
    switch(commandCode) {
        case // AAR/AAA
        GqAARequest.COMMAND_CODE:
            return isRequest ? new GqAARequestImpl(message) : new GqAAAnswerImpl(message);
        case // ASR/ASA
        GqAbortSessionRequest.COMMAND_CODE:
            return isRequest ? new GqAbortSessionRequestImpl(message) : new GqAbortSessionAnswerImpl(message);
        case // STR/STA
        GqSessionTerminationRequest.COMMAND_CODE:
            return isRequest ? new GqSessionTerminationRequestImpl(message) : new GqSessionTerminationAnswerImpl(message);
        case // RAR/RAA
        GqReAuthRequest.COMMAND_CODE:
            return isRequest ? new GqReAuthRequestImpl(message) : new GqReAuthAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : GqReAuthRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqReAuthRequestImpl) GqSessionTerminationAnswerImpl(org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationAnswerImpl) GqAAAnswerImpl(org.mobicents.slee.resource.diameter.gq.events.GqAAAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) GqSessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl) GqAbortSessionRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl) GqReAuthAnswerImpl(org.mobicents.slee.resource.diameter.gq.events.GqReAuthAnswerImpl) GqAARequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) GqAbortSessionAnswerImpl(org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionAnswerImpl)

Example 2 with GqAARequestImpl

use of org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl in project jain-slee.diameter by RestComm.

the class GqMessageFactoryImpl method createGqAARequest.

@Override
public GqAARequest createGqAARequest(String sessionId) {
    Message raw = createRequest(GqAARequest.COMMAND_CODE, new DiameterAvp[] {});
    GqAARequest aar = new GqAARequestImpl(raw);
    aar.setSessionId(sessionId);
    addOrigin(aar);
    return aar;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) GqAARequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl) GqAARequest(net.java.slee.resource.diameter.gq.events.GqAARequest)

Example 3 with GqAARequestImpl

use of org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl in project jain-slee.diameter by RestComm.

the class GqMessageFactoryImpl method createGqAARequest.

@Override
public GqAARequest createGqAARequest() {
    Message raw = createRequest(GqAARequest.COMMAND_CODE, new DiameterAvp[] {});
    GqAARequest aar = new GqAARequestImpl(raw);
    if (sessionId != null) {
        aar.setSessionId(sessionId);
    }
    addOrigin(aar);
    return aar;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) GqAARequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl) GqAARequest(net.java.slee.resource.diameter.gq.events.GqAARequest)

Example 4 with GqAARequestImpl

use of org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl 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)

Aggregations

GqAARequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl)4 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)3 Message (org.jdiameter.api.Message)3 GqAARequest (net.java.slee.resource.diameter.gq.events.GqAARequest)2 ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)2 GqAbortSessionRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl)2 GqReAuthRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqReAuthRequestImpl)2 GqSessionTerminationRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl)2 SleeEndpoint (javax.slee.resource.SleeEndpoint)1 ExtensionDiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)1 GqAAAnswerImpl (org.mobicents.slee.resource.diameter.gq.events.GqAAAnswerImpl)1 GqAbortSessionAnswerImpl (org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionAnswerImpl)1 GqReAuthAnswerImpl (org.mobicents.slee.resource.diameter.gq.events.GqReAuthAnswerImpl)1 GqSessionTerminationAnswerImpl (org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationAnswerImpl)1