Search in sources :

Example 1 with GqReAuthAnswerImpl

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

the class GqMessageFactoryImpl method createGqReAuthAnswer.

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

Example 2 with GqReAuthAnswerImpl

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

Aggregations

GqReAuthAnswerImpl (org.mobicents.slee.resource.diameter.gq.events.GqReAuthAnswerImpl)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 GqAbortSessionAnswerImpl (org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionAnswerImpl)1 GqAbortSessionRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl)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