Search in sources :

Example 56 with DiameterMessageImpl

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

the class AuthServerSessionActivityImpl method sendReAuthRequest.

public void sendReAuthRequest(ReAuthRequest request) throws IOException {
    try {
        // super.sendMessage(request);
        DiameterMessageImpl msg = (DiameterMessageImpl) request;
        this.serverSession.sendReAuthRequest(new ReAuthRequestImpl(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 : ReAuthRequestImpl(org.jdiameter.common.impl.app.auth.ReAuthRequestImpl) 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 57 with DiameterMessageImpl

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

the class AuthServerSessionActivityImpl method sendSessionTerminationAnswer.

public void sendSessionTerminationAnswer(SessionTerminationAnswer request) throws IOException {
    try {
        // super.sendMessage(request);
        DiameterMessageImpl msg = (DiameterMessageImpl) request;
        this.serverSession.sendSessionTerminationAnswer(new SessionTermAnswerImpl((Answer) 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 : Answer(org.jdiameter.api.Answer) SessionTerminationAnswer(net.java.slee.resource.diameter.base.events.SessionTerminationAnswer) SessionTermAnswerImpl(org.jdiameter.common.impl.app.auth.SessionTermAnswerImpl) 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 58 with DiameterMessageImpl

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

the class DiameterActivityImpl method doSendMessage.

protected Message doSendMessage(DiameterMessage message) {
    Message receivedMessage = null;
    try {
        if (message instanceof DiameterMessageImpl) {
            Future<Message> future = this.session.send(((DiameterMessageImpl) message).getGenericData());
            receivedMessage = future.get();
        } else {
            throw new OperationNotSupportedException("Trying to send wrong type of message? [" + message.getClass() + "] \n" + message);
        }
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        throw new 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) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) 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) OperationNotSupportedException(javax.naming.OperationNotSupportedException)

Example 59 with DiameterMessageImpl

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

the class DiameterActivityImpl method sendMessage.

public void sendMessage(DiameterMessage message) throws IOException {
    try {
        if (message instanceof DiameterMessageImpl) {
            DiameterMessageImpl msg = (DiameterMessageImpl) message;
            this.session.send(msg.getGenericData(), this.eventListener);
        } else {
            throw new OperationNotSupportedException("Trying to send wrong type of message? [" + message.getClass() + "] \n" + message);
        }
    } 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 : OperationNotSupportedException(javax.naming.OperationNotSupportedException) 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) OperationNotSupportedException(javax.naming.OperationNotSupportedException)

Example 60 with DiameterMessageImpl

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

the class ShServerActivityImpl method fetchSessionData.

// #########################
// # DiameterActivityImpl
// #########################
public void fetchSessionData(DiameterMessage msg, boolean incoming) {
    if (msg.getHeader().isRequest()) {
        // Well it should always be getting this on request and only once ?
        if (incoming) {
            boolean changed = false;
            if (remoteRealm == null) {
                remoteRealm = msg.getOriginRealm();
                changed = true;
            }
            if (remoteHost == null) {
                changed = true;
                remoteHost = msg.getOriginHost();
            }
            if (this.userIdentity == null) {
                changed = true;
                AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(DiameterShAvpCodes.USER_IDENTITY, DiameterShAvpCodes.SH_VENDOR_ID);
                this.userIdentity = new UserIdentityAvpImpl(DiameterShAvpCodes.USER_IDENTITY, DiameterShAvpCodes.SH_VENDOR_ID, rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), AvpUtilities.getAvpAsGrouped(DiameterShAvpCodes.USER_IDENTITY, DiameterShAvpCodes.SH_VENDOR_ID, ((DiameterMessageImpl) msg).getGenericData().getAvps()));
            }
            // FIXME: is this true?
            if (this.authSessionState == null) {
                changed = true;
                this.authSessionState = AuthSessionStateType.fromInt(AvpUtilities.getAvpAsInteger32(277, ((DiameterMessageImpl) msg).getGenericData().getAvps()));
            }
            stateMessages.add((DiameterMessageImpl) msg);
            if (changed) {
                super.baseListener.update(getActivityHandle(), this);
            }
        } else {
        // FIXME, do more :)
        }
    }
}
Also used : AvpRepresentation(org.mobicents.diameter.dictionary.AvpRepresentation) UserIdentityAvpImpl(org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl) 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