Search in sources :

Example 66 with DiameterMessageImpl

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

the class GxClientSessionActivityImpl method sendTerminationGxCreditControlRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diametergx.GxClientSessionActivity#sendTerminationRoCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest)
   */
public void sendTerminationGxCreditControlRequest(final GxCreditControlRequest ccr) throws IOException {
    // This should not be used to terminate sub-sessions!
    validateState(ccr);
    final DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
    try {
        session.sendCreditControlRequest(new GxCreditControlRequestImpl((Request) msg.getGenericData()));
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
    } catch (Exception e) {
        throw new IOException("Failed to send message, due to: " + e);
    }
}
Also used : Request(org.jdiameter.api.Request) GxCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest) GxReAuthRequest(net.java.slee.resource.diameter.gx.events.GxReAuthRequest) GxCreditControlRequestImpl(org.jdiameter.common.impl.app.gx.GxCreditControlRequestImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException) DiameterException(net.java.slee.resource.diameter.base.DiameterException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

Example 67 with DiameterMessageImpl

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

the class GxClientSessionActivityImpl method sendInitialGxCreditControlRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diametergx.GxClientSessionActivity#sendInitialRoCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest)
   */
public void sendInitialGxCreditControlRequest(final GxCreditControlRequest ccr) throws IOException {
    // FIXME: should this affect FSM ?
    validateState(ccr);
    final DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
    try {
        session.sendCreditControlRequest(new GxCreditControlRequestImpl((Request) msg.getGenericData()));
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
    } catch (Exception e) {
        throw new IOException("Failed to send message, due to: " + e);
    }
}
Also used : Request(org.jdiameter.api.Request) GxCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest) GxReAuthRequest(net.java.slee.resource.diameter.gx.events.GxReAuthRequest) GxCreditControlRequestImpl(org.jdiameter.common.impl.app.gx.GxCreditControlRequestImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException) DiameterException(net.java.slee.resource.diameter.base.DiameterException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

Example 68 with DiameterMessageImpl

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

the class GxClientSessionActivityImpl method sendEventGxCreditControlRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diametergx.GxClientSessionActivity#sendEventGxCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest)
   */
public void sendEventGxCreditControlRequest(final GxCreditControlRequest ccr) throws IOException {
    // fetchCurrentState(ccr);
    final DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
    validateState(ccr);
    try {
        session.sendCreditControlRequest(new GxCreditControlRequestImpl((Request) msg.getGenericData()));
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
    } catch (Exception e) {
        if (logger.isDebugEnabled()) {
            logger.debug("Failed to send message.", e);
        }
        throw new IOException("Failed to send message, due to: " + e);
    }
}
Also used : Request(org.jdiameter.api.Request) GxCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest) GxReAuthRequest(net.java.slee.resource.diameter.gx.events.GxReAuthRequest) GxCreditControlRequestImpl(org.jdiameter.common.impl.app.gx.GxCreditControlRequestImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException) DiameterException(net.java.slee.resource.diameter.base.DiameterException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

Example 69 with DiameterMessageImpl

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

the class GxServerSessionActivityImpl method sendGxCreditControlAnswer.

/**
 * {@inheritDoc}
 */
@Override
public void sendGxCreditControlAnswer(final GxCreditControlAnswer cca) throws IOException {
    fetchCurrentState(cca);
    final DiameterMessageImpl msg = (DiameterMessageImpl) cca;
    try {
        session.sendCreditControlAnswer(new GxCreditControlAnswerImpl((Answer) msg.getGenericData()));
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        final AvpNotAllowedException anae = new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
        throw anae;
    } catch (Exception e) {
        throw new IOException("Failed to send message.", e);
    }
}
Also used : GxCreditControlAnswer(net.java.slee.resource.diameter.gx.events.GxCreditControlAnswer) Answer(org.jdiameter.api.Answer) GxCreditControlAnswerImpl(org.jdiameter.common.impl.app.gx.GxCreditControlAnswerImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

Example 70 with DiameterMessageImpl

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

the class RfServerSessionActivityImpl method createRfAccountingAnswer.

public RfAccountingAnswer createRfAccountingAnswer() {
    RfAccountingAnswer answer = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == RfAccountingRequest.commandCode) {
            RfAccountingRequest msg = (RfAccountingRequest) stateMessages.get(index);
            answer = createRfAccountingAnswer(msg);
            if (!answer.hasSessionId() && session != null) {
                answer.setSessionId(session.getSessionId());
            }
            ((DiameterMessageImpl) answer).setData(msg);
            break;
        }
    }
    return answer;
}
Also used : RfAccountingAnswer(net.java.slee.resource.diameter.rf.events.RfAccountingAnswer) RfAccountingRequest(net.java.slee.resource.diameter.rf.events.RfAccountingRequest) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)

Aggregations

DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)70 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)63 IOException (java.io.IOException)62 InternalException (org.jdiameter.api.InternalException)30 Request (org.jdiameter.api.Request)17 DiameterException (net.java.slee.resource.diameter.base.DiameterException)12 Answer (org.jdiameter.api.Answer)11 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)6 GxCreditControlRequest (net.java.slee.resource.diameter.gx.events.GxCreditControlRequest)5 CreditControlRequest (net.java.slee.resource.diameter.cca.events.CreditControlRequest)4 GxReAuthRequest (net.java.slee.resource.diameter.gx.events.GxReAuthRequest)4 RoCreditControlRequest (net.java.slee.resource.diameter.ro.events.RoCreditControlRequest)4 Message (org.jdiameter.api.Message)4 JCreditControlRequestImpl (org.jdiameter.common.impl.app.cca.JCreditControlRequestImpl)4 RoCreditControlRequestImpl (org.jdiameter.common.impl.app.ro.RoCreditControlRequestImpl)4 ArrayList (java.util.ArrayList)3 OperationNotSupportedException (javax.naming.OperationNotSupportedException)3 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)3 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)3 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)3