Search in sources :

Example 16 with ErrorAnswerImpl

use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.

the class RfSessionActivityImpl 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 RfAccountingRequest.commandCode:
                        answer = new RfAccountingRequestImpl(receivedMessage);
                        break;
                    default:
                        logger.error("Received an unknown type of Message for Rf 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 : DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) RfAccountingRequestImpl(org.mobicents.slee.resource.diameter.rf.events.RfAccountingRequestImpl)

Example 17 with ErrorAnswerImpl

use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.

the class DiameterRfResourceAdaptor 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 // ACR/ACA
        RfAccountingAnswer.commandCode:
            return isRequest ? new RfAccountingRequestImpl(message) : new RfAccountingAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) RfAccountingRequestImpl(org.mobicents.slee.resource.diameter.rf.events.RfAccountingRequestImpl) RfAccountingAnswerImpl(org.mobicents.slee.resource.diameter.rf.events.RfAccountingAnswerImpl)

Aggregations

ErrorAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)17 SleeEndpoint (javax.slee.resource.SleeEndpoint)10 ExtensionDiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl)10 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)7 Message (org.jdiameter.api.Message)7 AbortSessionAnswerImpl (org.mobicents.slee.resource.diameter.base.events.AbortSessionAnswerImpl)3 AccountingAnswerImpl (org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl)3 SessionTerminationAnswerImpl (org.mobicents.slee.resource.diameter.base.events.SessionTerminationAnswerImpl)3 AbortSessionRequestImpl (org.mobicents.slee.resource.diameter.base.events.AbortSessionRequestImpl)2 AccountingRequestImpl (org.mobicents.slee.resource.diameter.base.events.AccountingRequestImpl)2 ReAuthAnswerImpl (org.mobicents.slee.resource.diameter.base.events.ReAuthAnswerImpl)2 SessionTerminationRequestImpl (org.mobicents.slee.resource.diameter.base.events.SessionTerminationRequestImpl)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 GqSessionTerminationRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl)2 GxCreditControlRequestImpl (org.mobicents.slee.resource.diameter.gx.events.GxCreditControlRequestImpl)2 GxReAuthRequestImpl (org.mobicents.slee.resource.diameter.gx.events.GxReAuthRequestImpl)2 RfAccountingRequestImpl (org.mobicents.slee.resource.diameter.rf.events.RfAccountingRequestImpl)2 RoCreditControlAnswerImpl (org.mobicents.slee.resource.diameter.ro.events.RoCreditControlAnswerImpl)2