Search in sources :

Example 1 with DiameterShMessageImpl

use of org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl in project jain-slee.diameter by RestComm.

the class ShServerActivityImpl method sendSubscribeNotificationsAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerActivity#sendSubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)
   */
public void sendSubscribeNotificationsAnswer(SubscribeNotificationsAnswer message) throws IOException {
    try {
        DiameterShMessageImpl msg = (DiameterShMessageImpl) message;
        fetchSessionData(msg, false);
        this.serverSession.sendSubscribeNotificationsAnswer(new SubscribeNotificationsAnswerImpl((Answer) msg.getGenericData()));
        clean(msg);
    } 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 : SubscribeNotificationsAnswerImpl(org.jdiameter.common.impl.app.sh.SubscribeNotificationsAnswerImpl) Answer(org.jdiameter.api.Answer) SubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer) ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) IOException(java.io.IOException) 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 2 with DiameterShMessageImpl

use of org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl in project jain-slee.diameter by RestComm.

the class ShServerSubscriptionActivityImpl method createUserDataAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#createUserDataAnswer()
   */
public UserDataAnswer createUserDataAnswer() {
    UserDataAnswer answer = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == UserDataRequest.commandCode) {
            UserDataRequest msg = (UserDataRequest) stateMessages.get(index);
            answer = this.messageFactory.createUserDataAnswer(msg);
            if (answer.getAuthSessionState() == null && this.authSessionState != null) {
                answer.setAuthSessionState(this.authSessionState);
            }
            ((DiameterShMessageImpl) answer).setData(msg);
            break;
        }
    }
    // answer.setSessionId(super.session.getSessionId());
    return answer;
}
Also used : UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)

Example 3 with DiameterShMessageImpl

use of org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl in project jain-slee.diameter by RestComm.

the class ShServerSubscriptionActivityImpl method createUserDataAnswer.

public UserDataAnswer createUserDataAnswer(byte[] userData) {
    UserDataAnswer answer = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == UserDataRequest.commandCode) {
            UserDataRequest msg = (UserDataRequest) stateMessages.get(index);
            answer = this.messageFactory.createUserDataAnswer(msg, userData);
            if (answer.getAuthSessionState() == null && this.authSessionState != null) {
                answer.setAuthSessionState(this.authSessionState);
            }
            ((DiameterShMessageImpl) answer).setData(msg);
            break;
        }
    }
    // answer.setSessionId(super.session.getSessionId());
    return answer;
}
Also used : UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)

Example 4 with DiameterShMessageImpl

use of org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl in project jain-slee.diameter by RestComm.

the class ShServerSubscriptionActivityImpl method sendUserDataAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#sendUserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer)
   */
public void sendUserDataAnswer(UserDataAnswer message) throws IOException {
    try {
        DiameterShMessageImpl msg = (DiameterShMessageImpl) message;
        this.serverSession.sendUserDataAnswer(new UserDataAnswerImpl((Answer) msg.getGenericData()));
        clean(msg);
    } 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 : UserDataAnswerImpl(org.jdiameter.common.impl.app.sh.UserDataAnswerImpl) Answer(org.jdiameter.api.Answer) SubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer) ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) IOException(java.io.IOException) 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 5 with DiameterShMessageImpl

use of org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl in project jain-slee.diameter by RestComm.

the class ShServerSubscriptionActivityImpl method createProfileUpdateAnswer.

public ProfileUpdateAnswer createProfileUpdateAnswer(long resultCode, boolean isExperimentalResult) {
    ProfileUpdateAnswer answer = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == ProfileUpdateRequest.commandCode) {
            ProfileUpdateRequest msg = (ProfileUpdateRequest) stateMessages.get(index);
            answer = this.messageFactory.createProfileUpdateAnswer(msg, resultCode, isExperimentalResult);
            if (answer.getAuthSessionState() == null && this.authSessionState != null) {
                answer.setAuthSessionState(this.authSessionState);
            }
            ((DiameterShMessageImpl) answer).setData(msg);
            break;
        }
    }
    // answer.setSessionId(super.session.getSessionId());
    return answer;
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)

Aggregations

DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)15 UserDataAnswer (net.java.slee.resource.diameter.sh.events.UserDataAnswer)9 ProfileUpdateAnswer (net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer)8 SubscribeNotificationsAnswer (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)8 IOException (java.io.IOException)7 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)7 Answer (org.jdiameter.api.Answer)6 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)4 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)3 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)3 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)2 ProfileUpdateAnswerImpl (org.jdiameter.common.impl.app.sh.ProfileUpdateAnswerImpl)2 SubscribeNotificationsAnswerImpl (org.jdiameter.common.impl.app.sh.SubscribeNotificationsAnswerImpl)2 UserDataAnswerImpl (org.jdiameter.common.impl.app.sh.UserDataAnswerImpl)2 PushNotificationAnswer (net.java.slee.resource.diameter.sh.events.PushNotificationAnswer)1 Request (org.jdiameter.api.Request)1 PushNotificationRequestImpl (org.jdiameter.common.impl.app.sh.PushNotificationRequestImpl)1