Search in sources :

Example 6 with UserIdentityAvpImpl

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

the class ShClientSubscriptionActivityImpl method fetchSessionData.

/**
 * @param request
 */
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) {
            if (this.userIdentity == null) {
                // FIXME: make this diff.
                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()));
            }
            if (this.authSessionState == null) {
                this.authSessionState = AuthSessionStateType.fromInt(AvpUtilities.getAvpAsInteger32(277, ((DiameterMessageImpl) msg).getGenericData().getAvps()));
            }
            stateMessages.add((DiameterMessageImpl) msg);
        } else {
            // FIXME: this should be up there... in incoming?
            if (destinationRealm == null) {
                this.remoteRealm = msg.getDestinationRealm();
            }
            if (msg instanceof SubscribeNotificationsRequest) {
                SubscribeNotificationsRequest snr = (SubscribeNotificationsRequest) msg;
                if (dataReferenceType == null || dataReferenceType.length == 0) {
                    dataReferenceType = snr.getDataReferences();
                }
                if (authSessionState == null && snr.hasAuthSessionState()) {
                    authSessionState = snr.getAuthSessionState();
                }
                if (userIdentity == null && snr.hasUserIdentity()) {
                    userIdentity = snr.getUserIdentity();
                }
            }
        }
    }
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) 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

UserIdentityAvpImpl (org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl)6 Test (org.junit.Test)4 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)4 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)2 AvpRepresentation (org.mobicents.diameter.dictionary.AvpRepresentation)2 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)2 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)1 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)1 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)1