Search in sources :

Example 1 with GqAbortSessionAnswerImpl

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

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

the class GqMessageFactoryImpl method createGqAbortSessionAnswer.

@Override
public GqAbortSessionAnswer createGqAbortSessionAnswer(GqAbortSessionRequest asr) {
    Message raw = createMessage(asr.getHeader(), new DiameterAvp[] {});
    // this should be different ...
    raw.setRequest(false);
    // just in case. answers never have T flag set
    raw.setReTransmitted(false);
    GqAbortSessionAnswerImpl asa = new GqAbortSessionAnswerImpl(raw);
    asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_HOST);
    asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_REALM);
    asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_HOST);
    asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_REALM);
    asa.setSessionId(asr.getSessionId());
    addOrigin(asa);
    return asa;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) GqAbortSessionAnswerImpl(org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionAnswerImpl)

Aggregations

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