Search in sources :

Example 11 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(long resultCode, boolean isExperimentalResult) {
    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, 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 : 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 12 with DiameterShMessageImpl

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

the class ShServerSubscriptionActivityImpl method sendSubscribeNotificationsAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#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) {
        if (logger.isDebugEnabled()) {
            logger.debug("Failed to send message.", 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 13 with DiameterShMessageImpl

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

the class ShServerSubscriptionActivityImpl method createSubscribeNotificationsAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#createSubscribeNotificationsAnswer()
   */
public SubscribeNotificationsAnswer createSubscribeNotificationsAnswer() {
    SubscribeNotificationsAnswer answer = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == SubscribeNotificationsRequest.commandCode) {
            SubscribeNotificationsRequest msg = (SubscribeNotificationsRequest) stateMessages.get(index);
            answer = this.messageFactory.createSubscribeNotificationsAnswer(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 : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) SubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)

Example 14 with DiameterShMessageImpl

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

the class ShServerSubscriptionActivityImpl method sendPushNotificationRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#sendPushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest)
   */
public void sendPushNotificationRequest(PushNotificationRequest message) throws IOException {
    try {
        DiameterShMessageImpl msg = (DiameterShMessageImpl) message;
        fetchSessionData(msg, false);
        this.serverSession.sendPushNotificationRequest(new PushNotificationRequestImpl((Request) 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 : PushNotificationRequestImpl(org.jdiameter.common.impl.app.sh.PushNotificationRequestImpl) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) Request(org.jdiameter.api.Request) PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) 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 15 with DiameterShMessageImpl

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

the class ShClientSubscriptionActivityImpl method createPushNotificationAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.ShClientSubscriptionActivity#createPushNotificationAnswer()
   */
public PushNotificationAnswer createPushNotificationAnswer() {
    PushNotificationAnswer pna = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == PushNotificationAnswer.commandCode) {
            PushNotificationRequest msg = (PushNotificationRequest) stateMessages.get(index);
            pna = this.messageFactory.createPushNotificationAnswer(msg);
            if (pna.getAuthSessionState() == null && this.authSessionState != null) {
                pna.setAuthSessionState(this.authSessionState);
            }
            ((DiameterShMessageImpl) pna).setData(msg);
            break;
        }
    }
    return pna;
}
Also used : PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) PushNotificationAnswer(net.java.slee.resource.diameter.sh.events.PushNotificationAnswer)

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