Search in sources :

Example 16 with DiameterMessageImpl

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

the class RoClientSessionActivityImpl method sendEventRoCreditControlRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.ro.RoClientSessionActivity#sendEventRoCreditControlRequest(net.java.slee.resource.diameter.ro.events.RoCreditControlRequest)
   */
public void sendEventRoCreditControlRequest(RoCreditControlRequest ccr) throws IOException {
    // fetchCurrentState(ccr);
    DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
    validateState(ccr);
    try {
        session.sendCreditControlRequest(new RoCreditControlRequestImpl((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 : RoCreditControlRequestImpl(org.jdiameter.common.impl.app.ro.RoCreditControlRequestImpl) RoCreditControlRequest(net.java.slee.resource.diameter.ro.events.RoCreditControlRequest) Request(org.jdiameter.api.Request) 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 17 with DiameterMessageImpl

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

the class RoClientSessionActivityImpl method sendTerminationRoCreditControlRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.ro.RoClientSessionActivity#sendTerminationRoCreditControlRequest(net.java.slee.resource.diameter.ro.events.RoCreditControlRequest)
   */
public void sendTerminationRoCreditControlRequest(RoCreditControlRequest ccr) throws IOException {
    // This should not be used to terminate sub-sessions!
    validateState(ccr);
    DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
    try {
        session.sendCreditControlRequest(new RoCreditControlRequestImpl((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 : RoCreditControlRequestImpl(org.jdiameter.common.impl.app.ro.RoCreditControlRequestImpl) RoCreditControlRequest(net.java.slee.resource.diameter.ro.events.RoCreditControlRequest) Request(org.jdiameter.api.Request) 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 18 with DiameterMessageImpl

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

the class RxServerSessionActivityImpl method sendSessionTermAnswer.

/**
 * {@inheritDoc}
 */
@Override
public void sendSessionTermAnswer(final SessionTerminationAnswer sta) throws IOException {
    fetchCurrentState(sta);
    final DiameterMessageImpl msg = (DiameterMessageImpl) sta;
    try {
        session.sendSessionTermAnswer(new RxSessionTermAnswerImpl((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 : AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) SessionTerminationAnswer(net.java.slee.resource.diameter.rx.events.SessionTerminationAnswer) Answer(org.jdiameter.api.Answer) RxSessionTermAnswerImpl(org.jdiameter.common.impl.app.rx.RxSessionTermAnswerImpl) 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) IOException(java.io.IOException)

Example 19 with DiameterMessageImpl

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

the class RxSessionActivityImpl method doSendMessage.

// some override from base
protected Message doSendMessage(DiameterMessage message) {
    Message receivedMessage = null;
    try {
        if (message instanceof DiameterMessageImpl) {
            Future<Message> future = session.send(((DiameterMessageImpl) message).getGenericData());
            receivedMessage = future.get();
        } else {
            throw new OperationNotSupportedException((new StringBuilder()).append("Trying to send wrong type of message? [").append(message.getClass()).append("] \n").append(message).toString());
        }
    } catch (AvpNotAllowedException e) {
        throw new net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
    } catch (Exception e) {
        logger.error("Failure sending sync request.", e);
    }
    return receivedMessage;
}
Also used : OperationNotSupportedException(javax.naming.OperationNotSupportedException) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) Message(org.jdiameter.api.Message) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(org.jdiameter.api.validation.AvpNotAllowedException) AvpNotAllowedException(org.jdiameter.api.validation.AvpNotAllowedException) OperationNotSupportedException(javax.naming.OperationNotSupportedException)

Example 20 with DiameterMessageImpl

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

the class S6aClientSessionImpl method sendPurgeUERequest.

public void sendPurgeUERequest(PurgeUERequest pur) throws IOException {
    DiameterMessageImpl msg = (DiameterMessageImpl) pur;
    JPurgeUERequestImpl answer = new JPurgeUERequestImpl((Request) msg.getGenericData());
    try {
        appSession.sendPurgeUERequest(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 : JPurgeUERequestImpl(org.jdiameter.common.impl.app.s6a.JPurgeUERequestImpl) 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)

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