Search in sources :

Example 6 with DiameterMessageImpl

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

the class CxDxServerSessionImpl method sendMultimediaAuthenticationAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendMultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer)
   */
public void sendMultimediaAuthenticationAnswer(MultimediaAuthenticationAnswer multimediaAuthenticationAnswer) throws IOException {
    DiameterMessageImpl msg = (DiameterMessageImpl) multimediaAuthenticationAnswer;
    JMultimediaAuthAnswerImpl answer = new JMultimediaAuthAnswerImpl((Answer) msg.getGenericData());
    try {
        appSession.sendMultimediaAuthAnswer(answer);
    } catch (org.jdiameter.api.validation.AvpNotAllowedException anae) {
        throw new AvpNotAllowedException(anae.getMessage(), anae.getAvpCode(), anae.getVendorId());
    } catch (Exception e) {
        if (logger.isDebugEnabled()) {
            logger.debug("Failed to send message.", e);
        }
        throw new IOException(e.getMessage());
    }
}
Also used : IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) JMultimediaAuthAnswerImpl(org.jdiameter.common.impl.app.cxdx.JMultimediaAuthAnswerImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) InternalException(org.jdiameter.api.InternalException) IOException(java.io.IOException)

Example 7 with DiameterMessageImpl

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

the class CreditControlClientSessionImpl method sendInitialCreditControlRequest.

/*
   * (non-Javadoc)
   * 
   * @seenet.java.slee.resource.diameter.cca.CreditControlClientSession#
   * sendInitialCreditControlRequest
   * (net.java.slee.resource.diameter.cca.events.CreditControlRequest)
   */
public void sendInitialCreditControlRequest(CreditControlRequest ccr) throws IOException {
    // FIXME: should this affect FSM ?
    ccr.setCcRequestType(CcRequestType.INITIAL_REQUEST);
    validateState(ccr);
    DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
    try {
        session.sendCreditControlRequest(new JCreditControlRequestImpl((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 : JCreditControlRequestImpl(org.jdiameter.common.impl.app.cca.JCreditControlRequestImpl) Request(org.jdiameter.api.Request) CreditControlRequest(net.java.slee.resource.diameter.cca.events.CreditControlRequest) 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 8 with DiameterMessageImpl

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

the class CreditControlClientSessionImpl method sendTerminationCreditControlRequest.

/*
   * (non-Javadoc)
   * 
   * @seenet.java.slee.resource.diameter.cca.CreditControlClientSession#
   * sendTerminationCreditControlRequest
   * (net.java.slee.resource.diameter.cca.events.CreditControlRequest)
   */
public void sendTerminationCreditControlRequest(CreditControlRequest ccr) throws IOException {
    // This should not be used to terminate sub-sessions!
    // FIXME: Should this come already in the CCR?
    ccr.setCcRequestType(CcRequestType.TERMINATION_REQUEST);
    validateState(ccr);
    DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
    try {
        session.sendCreditControlRequest(new JCreditControlRequestImpl((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 : JCreditControlRequestImpl(org.jdiameter.common.impl.app.cca.JCreditControlRequestImpl) Request(org.jdiameter.api.Request) CreditControlRequest(net.java.slee.resource.diameter.cca.events.CreditControlRequest) 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 9 with DiameterMessageImpl

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

the class CreditControlServerSessionImpl method sendCreditControlAnswer.

/*
   * (non-Javadoc)
   * 
   * @see net.java.slee.resource.diameter.cca.CreditControlServerSession#sendCreditControlAnswer(net.java.slee.resource.diameter.cca.events.CreditControlAnswer)
   */
public void sendCreditControlAnswer(CreditControlAnswer cca) throws IOException {
    fetchCurrentState(cca);
    DiameterMessageImpl msg = (DiameterMessageImpl) cca;
    try {
        session.sendCreditControlAnswer(new JCreditControlAnswerImpl((Answer) msg.getGenericData()));
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        AvpNotAllowedException anae = new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
        throw anae;
    } catch (Exception e) {
        e.printStackTrace();
        IOException ioe = new IOException("Failed to send message, due to: " + e);
        throw ioe;
    }
}
Also used : CreditControlAnswer(net.java.slee.resource.diameter.cca.events.CreditControlAnswer) Answer(org.jdiameter.api.Answer) JCreditControlAnswerImpl(org.jdiameter.common.impl.app.cca.JCreditControlAnswerImpl) 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 10 with DiameterMessageImpl

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

the class ValidatorImpl method validate.

// NOTE: this class possibly should be Singleton, however some impl may use something more to perform validation
// hence, its not static, each RA provides instance through RA Sbb Interface.
/*
   * (non-Javadoc)
   * 
   * @see
   * net.java.slee.resource.diameter.Validator#validate(net.java.slee.resource
   * .diameter.base.events.DiameterMessage)
   */
@Override
public void validate(DiameterMessage msg) throws AvpNotAllowedException {
    Dictionary dictionary = DictionarySingleton.getDictionary();
    if (dictionary.isConfigured() && dictionary.isEnabled()) {
        DiameterCommand com = msg.getCommand();
        MessageRepresentation rep = dictionary.getMessage(com.getCode(), com.getApplicationId(), com.isRequest());
        if (rep != null) {
            DiameterMessageImpl impl = (DiameterMessageImpl) msg;
            try {
                rep.validate(impl.getGenericData(), ValidatorLevel.ALL);
            } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
                throw new AvpNotAllowedException("Failed to validate message.", e, e.getAvpCode(), e.getVendorId());
            }
        }
    }
}
Also used : DiameterCommand(net.java.slee.resource.diameter.base.events.DiameterCommand) Dictionary(org.jdiameter.api.validation.Dictionary) MessageRepresentation(org.jdiameter.api.validation.MessageRepresentation) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

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