Search in sources :

Example 51 with AvpNotAllowedException

use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.

the class CxDxServerSessionImpl method sendLocationInfoAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendLocationInfoAnswer(net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer)
   */
public void sendLocationInfoAnswer(LocationInfoAnswer locationInfoAnswer) throws IOException {
    DiameterMessageImpl msg = (DiameterMessageImpl) locationInfoAnswer;
    JLocationInfoAnswerImpl answer = new JLocationInfoAnswerImpl((Answer) msg.getGenericData());
    try {
        appSession.sendLocationInformationAnswer(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 : JLocationInfoAnswerImpl(org.jdiameter.common.impl.app.cxdx.JLocationInfoAnswerImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) 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 52 with AvpNotAllowedException

use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.

the class CxDxServerSessionImpl method sendServerAssignmentAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendServerAssignmentAnswer(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer)
   */
public void sendServerAssignmentAnswer(ServerAssignmentAnswer serverAssignmentAnswer) throws IOException {
    DiameterMessageImpl msg = (DiameterMessageImpl) serverAssignmentAnswer;
    JServerAssignmentAnswerImpl answer = new JServerAssignmentAnswerImpl((Answer) msg.getGenericData());
    try {
        appSession.sendServerAssignmentAnswer(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 : JServerAssignmentAnswerImpl(org.jdiameter.common.impl.app.cxdx.JServerAssignmentAnswerImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) 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 53 with AvpNotAllowedException

use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.

the class CxDxServerSessionImpl method sendPushProfileRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendPushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest)
   */
public void sendPushProfileRequest(PushProfileRequest pushProfileRequest) throws IOException {
    DiameterMessageImpl msg = (DiameterMessageImpl) pushProfileRequest;
    JPushProfileRequestImpl request = new JPushProfileRequestImpl(msg.getGenericData());
    try {
        appSession.sendPushProfileRequest(request);
    } 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 : JPushProfileRequestImpl(org.jdiameter.common.impl.app.cxdx.JPushProfileRequestImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) 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 54 with AvpNotAllowedException

use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.

the class ValidatorImpl method validate.

/*
   * (non-Javadoc)
   * 
   * @see net.java.slee.resource.diameter.Validator#
   * validate(net.java.slee.resource.diameter.base.events.avp.DiameterAvp)
   */
@Override
public void validate(DiameterAvp avp) throws AvpNotAllowedException {
    Dictionary dictionary = DictionarySingleton.getDictionary();
    if (dictionary.isConfigured() && dictionary.isEnabled()) {
        AvpRepresentation rep = dictionary.getAvp(avp.getCode(), avp.getVendorId());
        // check for grouped?
        if (rep != null && rep.isGrouped()) {
            try {
                GroupedAvpImpl impl = (GroupedAvpImpl) avp;
                rep.validate(impl.getGenericData());
            } catch (ClassCastException cce) {
                throw new AvpNotAllowedException("Failed to validate avp, its not grouped!", cce, avp.getCode(), avp.getVendorId());
            }
        }
    }
}
Also used : GroupedAvpImpl(org.mobicents.slee.resource.diameter.base.events.avp.GroupedAvpImpl) Dictionary(org.jdiameter.api.validation.Dictionary) AvpRepresentation(org.jdiameter.api.validation.AvpRepresentation) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

Example 55 with AvpNotAllowedException

use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.

the class AccountingServerSessionActivityImpl method sendAccountingAnswer.

public void sendAccountingAnswer(AccountingAnswer answer) throws IOException {
    try {
        AccountingAnswerImpl aca = (AccountingAnswerImpl) answer;
        this.serverSession.sendAccountAnswer(new AccountAnswerImpl((Answer) aca.getGenericData()));
        // FIXME: check this?
        if (this.serverSession.isStateless()) {
            endActivity();
        } else if (aca.getAccountingRecordType() == AccountingRecordType.STOP_RECORD) {
            endActivity();
        }
    } 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, due to: ", e);
        }
        throw new IOException("Failed to send message, due to: " + e.getMessage());
    }
}
Also used : AccountingAnswer(net.java.slee.resource.diameter.base.events.AccountingAnswer) Answer(org.jdiameter.api.Answer) AccountingAnswerImpl(org.mobicents.slee.resource.diameter.base.events.AccountingAnswerImpl) AccountAnswerImpl(org.jdiameter.common.impl.app.acc.AccountAnswerImpl) IOException(java.io.IOException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

Aggregations

AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)75 IOException (java.io.IOException)70 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)62 InternalException (org.jdiameter.api.InternalException)32 Answer (org.jdiameter.api.Answer)19 Request (org.jdiameter.api.Request)18 DiameterException (net.java.slee.resource.diameter.base.DiameterException)12 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)7 ProfileUpdateAnswer (net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer)6 SubscribeNotificationsAnswer (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)6 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)6 UserDataAnswer (net.java.slee.resource.diameter.sh.events.UserDataAnswer)6 CreditControlRequest (net.java.slee.resource.diameter.cca.events.CreditControlRequest)4 GxCreditControlRequest (net.java.slee.resource.diameter.gx.events.GxCreditControlRequest)4 GxReAuthRequest (net.java.slee.resource.diameter.gx.events.GxReAuthRequest)4 RoCreditControlRequest (net.java.slee.resource.diameter.ro.events.RoCreditControlRequest)4 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)4 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)4 JCreditControlRequestImpl (org.jdiameter.common.impl.app.cca.JCreditControlRequestImpl)4 RoCreditControlRequestImpl (org.jdiameter.common.impl.app.ro.RoCreditControlRequestImpl)4