Search in sources :

Example 1 with GqSessionTerminationRequestImpl

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

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

the class GqMessageFactoryImpl method createGqSessionTerminationRequest.

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

Example 3 with GqSessionTerminationRequestImpl

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

the class GqMessageFactoryImpl method createGqSessionTerminationRequest.

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

Example 4 with GqSessionTerminationRequestImpl

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

GqSessionTerminationRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl)4 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)3 Message (org.jdiameter.api.Message)3 GqSessionTerminationRequest (net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest)2 ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)2 GqAARequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl)2 GqAbortSessionRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl)2 GqReAuthRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqReAuthRequestImpl)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