Search in sources :

Example 1 with InternalException

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

the class CxDxClientSessionImpl method createPushProfileAnswer.

/* (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#createPushProfileAnswer()
   */
public PushProfileAnswer createPushProfileAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof PushProfileRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        PushProfileAnswer ppa = (PushProfileAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, PushProfileAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(ppa);
        return ppa;
    } catch (InternalException e) {
        logger.error("Failed to create Push-Profile-Answer.", e);
    }
    return null;
}
Also used : PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) PushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest) InternalException(org.jdiameter.api.InternalException)

Example 2 with InternalException

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

the class CxDxServerSessionImpl method createMultimediaAuthenticationAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#createMultimediaAuthenticationAnswer()
   */
public MultimediaAuthenticationAnswer createMultimediaAuthenticationAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof MultimediaAuthenticationRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        MultimediaAuthenticationAnswer maa = (MultimediaAuthenticationAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, MultimediaAuthenticationAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(maa);
        return maa;
    } catch (InternalException e) {
        logger.error("Failed to create Multimedia-Authentication-Answer.", e);
    }
    return null;
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) MultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) InternalException(org.jdiameter.api.InternalException)

Example 3 with InternalException

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

the class GqMessageFactoryImpl method createRawMessage.

protected Message createRawMessage(DiameterHeader header) {
    if (header == null) {
        return null;
    }
    int commandCode = 0;
    long endToEndId = 0;
    long hopByHopId = 0;
    boolean isRequest = true;
    boolean isProxiable = true;
    boolean isError = false;
    boolean isPotentiallyRetransmitted = false;
    commandCode = header.getCommandCode();
    endToEndId = header.getEndToEndId();
    hopByHopId = header.getHopByHopId();
    isRequest = header.isRequest();
    isProxiable = header.isProxiable();
    isError = header.isError();
    isPotentiallyRetransmitted = header.isPotentiallyRetransmitted();
    Message msg = null;
    try {
        msg = stack.getSessionFactory().getNewRawSession().createMessage(commandCode, gqAppId, hopByHopId, endToEndId);
        // Set the message flags from header (or default)
        msg.setRequest(isRequest);
        msg.setProxiable(isProxiable);
        msg.setError(isError);
        msg.setReTransmitted(isRequest && isPotentiallyRetransmitted);
    } catch (IllegalDiameterStateException e) {
        logger.error("Failed to get session factory for message creation.", e);
    } catch (InternalException e) {
        logger.error("Failed to create new raw session for message creation.", e);
    }
    return msg;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) InternalException(org.jdiameter.api.InternalException)

Example 4 with InternalException

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

the class RoMessageFactoryImpl method createRawMessage.

protected Message createRawMessage(DiameterHeader header) {
    int commandCode = 0;
    long endToEndId = 0;
    long hopByHopId = 0;
    boolean isRequest = true;
    boolean isProxiable = true;
    boolean isError = false;
    boolean isPotentiallyRetransmitted = false;
    if (header != null) {
        // Answer
        commandCode = header.getCommandCode();
        endToEndId = header.getEndToEndId();
        hopByHopId = header.getHopByHopId();
        isRequest = header.isRequest();
        isProxiable = header.isProxiable();
        isError = header.isError();
        isPotentiallyRetransmitted = header.isPotentiallyRetransmitted();
    // aid = ApplicationId.createByAuthAppId(header.getApplicationId());
    } else {
        commandCode = RoCreditControlRequest.commandCode;
    // endToEndId = (long) (Math.random()*1000000);
    // hopByHopId = (long) (Math.random()*1000000)+1;
    }
    Message msg = null;
    try {
        if (header != null) {
            msg = stack.getSessionFactory().getNewRawSession().createMessage(commandCode, roAppId, hopByHopId, endToEndId);
        } else {
            msg = stack.getSessionFactory().getNewRawSession().createMessage(commandCode, roAppId);
        }
    } catch (IllegalDiameterStateException e) {
        logger.error("Failed to get session factory for message creation.", e);
    } catch (InternalException e) {
        logger.error("Failed to create new raw session for message creation.", e);
    }
    // Set the message flags from header (or default)
    msg.setRequest(isRequest);
    msg.setProxiable(isProxiable);
    msg.setError(isError);
    msg.setReTransmitted(isRequest && isPotentiallyRetransmitted);
    return msg;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) RoCreditControlMessage(net.java.slee.resource.diameter.ro.events.RoCreditControlMessage) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) InternalException(org.jdiameter.api.InternalException)

Example 5 with InternalException

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

the class S6aClientSessionImpl method createDeleteSubscriberDataAnswer.

public DeleteSubscriberDataAnswer createDeleteSubscriberDataAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof DeleteSubscriberDataRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        DeleteSubscriberDataAnswer dsa = (DeleteSubscriberDataAnswer) this.s6aMessageFactory.createS6aMessage(lastRequest.getHeader(), new DiameterAvp[] {}, DeleteSubscriberDataAnswer.COMMAND_CODE, s6aMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(dsa);
        return dsa;
    } catch (InternalException e) {
        logger.error("Failed to create Delete-Subscriber-Data-Answer.", e);
    }
    return null;
}
Also used : DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) DeleteSubscriberDataAnswer(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswer) DeleteSubscriberDataRequest(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest) InternalException(org.jdiameter.api.InternalException)

Aggregations

InternalException (org.jdiameter.api.InternalException)19 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)15 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)4 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)2 ApplicationId (org.jdiameter.api.ApplicationId)2 Message (org.jdiameter.api.Message)2 IOException (java.io.IOException)1 ObjectName (javax.management.ObjectName)1 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)1 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 LocationInfoAnswer (net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer)1 LocationInfoRequest (net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest)1 MultimediaAuthenticationAnswer (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer)1 MultimediaAuthenticationRequest (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest)1 PushProfileAnswer (net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer)1 PushProfileRequest (net.java.slee.resource.diameter.cxdx.events.PushProfileRequest)1 RegistrationTerminationAnswer (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer)1 RegistrationTerminationRequest (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest)1 ServerAssignmentAnswer (net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer)1