Search in sources :

Example 56 with Message

use of org.jdiameter.api.Message 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 57 with Message

use of org.jdiameter.api.Message in project jain-slee.diameter by RestComm.

the class GqMessageFactoryImpl method createRequest.

public Message createRequest(int code, DiameterAvp[] avps) {
    Message raw = createMessage(code, new DiameterAvp[] {});
    raw.setProxiable(true);
    raw.setRequest(true);
    return raw;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage)

Example 58 with Message

use of org.jdiameter.api.Message in project jain-slee.diameter by RestComm.

the class GqMessageFactoryImpl method createMessage.

public Message createMessage(int commandCode, DiameterAvp[] avps) throws AvpNotAllowedException {
    Message msg = createRawMessage(commandCode);
    AvpSet set = msg.getAvps();
    for (DiameterAvp avp : avps) {
        addAvp(avp, set);
    }
    return msg;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) AvpSet(org.jdiameter.api.AvpSet)

Example 59 with Message

use of org.jdiameter.api.Message 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 60 with Message

use of org.jdiameter.api.Message in project jain-slee.diameter by RestComm.

the class RfMessageFactoryImpl method createMessage.

public Message createMessage(DiameterHeader header, DiameterAvp[] avps) throws AvpNotAllowedException {
    Message msg = createRawMessage(header);
    AvpSet set = msg.getAvps();
    for (DiameterAvp avp : avps) {
        addAvp(avp, set);
    }
    return msg;
}
Also used : Message(org.jdiameter.api.Message) RfAccountingMessage(net.java.slee.resource.diameter.rf.events.RfAccountingMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) AvpSet(org.jdiameter.api.AvpSet)

Aggregations

Message (org.jdiameter.api.Message)61 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)56 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)22 NoSuchAvpException (net.java.slee.resource.diameter.base.NoSuchAvpException)10 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)10 AvpSet (org.jdiameter.api.AvpSet)8 ArrayList (java.util.ArrayList)7 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)7 InternalException (org.jdiameter.api.InternalException)7 ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)7 GxCreditControlMessage (net.java.slee.resource.diameter.gx.events.GxCreditControlMessage)5 GxReAuthMessage (net.java.slee.resource.diameter.gx.events.GxReAuthMessage)5 RoCreditControlMessage (net.java.slee.resource.diameter.ro.events.RoCreditControlMessage)4 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)4 ExtensionDiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)4 IOException (java.io.IOException)3 AccountingAnswerImpl (org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl)3 GqAARequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAARequestImpl)3 GqAbortSessionRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl)3 GqReAuthRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqReAuthRequestImpl)3