Search in sources :

Example 1 with ErrorAnswerImpl

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

the class DiameterCxDxResourceAdaptor 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 // UAR/UAA
        UserAuthorizationRequest.COMMAND_CODE:
            return isRequest ? new UserAuthorizationRequestImpl(message) : new UserAuthorizationAnswerImpl(message);
        case // SAR/SAA
        ServerAssignmentRequest.COMMAND_CODE:
            return isRequest ? new ServerAssignmentRequestImpl(message) : new ServerAssignmentAnswerImpl(message);
        case // LIR/LIA
        LocationInfoRequest.COMMAND_CODE:
            return isRequest ? new LocationInfoRequestImpl(message) : new LocationInfoAnswerImpl(message);
        case // MAR/MAA
        MultimediaAuthenticationRequest.COMMAND_CODE:
            return isRequest ? new MultimediaAuthenticationRequestImpl(message) : new MultimediaAuthenticationAnswerImpl(message);
        case // RTR/RTA
        RegistrationTerminationRequest.COMMAND_CODE:
            return isRequest ? new RegistrationTerminationRequestImpl(message) : new RegistrationTerminationAnswerImpl(message);
        case // MAR/MAA
        PushProfileRequest.COMMAND_CODE:
            return isRequest ? new PushProfileRequestImpl(message) : new PushProfileAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : ServerAssignmentRequestImpl(org.mobicents.slee.resource.diameter.cxdx.events.ServerAssignmentRequestImpl) RegistrationTerminationRequestImpl(org.mobicents.slee.resource.diameter.cxdx.events.RegistrationTerminationRequestImpl) PushProfileRequestImpl(org.mobicents.slee.resource.diameter.cxdx.events.PushProfileRequestImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) PushProfileAnswerImpl(org.mobicents.slee.resource.diameter.cxdx.events.PushProfileAnswerImpl) LocationInfoAnswerImpl(org.mobicents.slee.resource.diameter.cxdx.events.LocationInfoAnswerImpl) UserAuthorizationRequestImpl(org.mobicents.slee.resource.diameter.cxdx.events.UserAuthorizationRequestImpl) UserAuthorizationAnswerImpl(org.mobicents.slee.resource.diameter.cxdx.events.UserAuthorizationAnswerImpl) MultimediaAuthenticationRequestImpl(org.mobicents.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequestImpl) LocationInfoRequestImpl(org.mobicents.slee.resource.diameter.cxdx.events.LocationInfoRequestImpl) MultimediaAuthenticationAnswerImpl(org.mobicents.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswerImpl) RegistrationTerminationAnswerImpl(org.mobicents.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswerImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) ServerAssignmentAnswerImpl(org.mobicents.slee.resource.diameter.cxdx.events.ServerAssignmentAnswerImpl)

Example 2 with ErrorAnswerImpl

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

the class GxSessionActivityImpl 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 GxCreditControlRequest.commandCode:
                        answer = new GxCreditControlRequestImpl(receivedMessage);
                        break;
                    case GxReAuthRequest.commandCode:
                        answer = new GxReAuthRequestImpl(receivedMessage);
                        break;
                    default:
                        logger.error("Received an unknown type of Message for Gx 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) GxReAuthRequestImpl(org.mobicents.slee.resource.diameter.gx.events.GxReAuthRequestImpl) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) GxCreditControlRequestImpl(org.mobicents.slee.resource.diameter.gx.events.GxCreditControlRequestImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl)

Example 3 with ErrorAnswerImpl

use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl 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 4 with ErrorAnswerImpl

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

the class DiameterS13ResourceAdaptor 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 MEIdentityCheckRequest.COMMAND_CODE:
            return isRequest ? new MEIdentityCheckRequestImpl(message) : new MEIdentityCheckAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : MEIdentityCheckRequestImpl(org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckRequestImpl) MEIdentityCheckAnswerImpl(org.mobicents.slee.resource.diameter.s13.events.MEIdentityCheckAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint)

Example 5 with ErrorAnswerImpl

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

the class DiameterS6aResourceAdaptor 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 UpdateLocationRequest.COMMAND_CODE:
            return isRequest ? new UpdateLocationRequestImpl(message) : new UpdateLocationAnswerImpl(message);
        case AuthenticationInformationRequest.COMMAND_CODE:
            return isRequest ? new AuthenticationInformationRequestImpl(message) : new AuthenticationInformationAnswerImpl(message);
        case CancelLocationRequest.COMMAND_CODE:
            return isRequest ? new CancelLocationRequestImpl(message) : new CancelLocationAnswerImpl(message);
        case InsertSubscriberDataRequest.COMMAND_CODE:
            return isRequest ? new InsertSubscriberDataRequestImpl(message) : new InsertSubscriberDataAnswerImpl(message);
        case DeleteSubscriberDataRequest.COMMAND_CODE:
            return isRequest ? new DeleteSubscriberDataRequestImpl(message) : new DeleteSubscriberDataAnswerImpl(message);
        case PurgeUERequest.COMMAND_CODE:
            return isRequest ? new PurgeUERequestImpl(message) : new PurgeUEAnswerImpl(message);
        case ResetRequest.COMMAND_CODE:
            return isRequest ? new ResetRequestImpl(message) : new ResetAnswerImpl(message);
        case NotifyRequest.COMMAND_CODE:
            return isRequest ? new NotifyRequestImpl(message) : new NotifyAnswerImpl(message);
        default:
            return new ExtensionDiameterMessageImpl(message);
    }
}
Also used : UpdateLocationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationAnswerImpl) UpdateLocationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.UpdateLocationRequestImpl) NotifyRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.NotifyRequestImpl) PurgeUEAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.PurgeUEAnswerImpl) CancelLocationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.CancelLocationRequestImpl) NotifyAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.NotifyAnswerImpl) InsertSubscriberDataRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataRequestImpl) DeleteSubscriberDataAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswerImpl) ExtensionDiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl) ResetRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.ResetRequestImpl) SleeEndpoint(javax.slee.resource.SleeEndpoint) AuthenticationInformationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationAnswerImpl) DeleteSubscriberDataRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequestImpl) ResetAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.ResetAnswerImpl) AuthenticationInformationRequestImpl(org.mobicents.slee.resource.diameter.s6a.events.AuthenticationInformationRequestImpl) ErrorAnswerImpl(org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl) CancelLocationAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.CancelLocationAnswerImpl) InsertSubscriberDataAnswerImpl(org.mobicents.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswerImpl) PurgeUERequestImpl(org.mobicents.slee.resource.diameter.s6a.events.PurgeUERequestImpl)

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