Search in sources :

Example 6 with SubscribeNotificationsRequest

use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.

the class ShClientActivityImpl method sendSubscribeNotificationsRequest.

public void sendSubscribeNotificationsRequest(SubscribeNotificationsRequest message) throws IOException {
    // FIXME: IMHO this should not be here.
    try {
        DiameterMessageImpl msg = (DiameterMessageImpl) message;
        this.clientSession.sendSubscribeNotificationsRequest(new SubscribeNotificationsRequestImpl((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 : Request(org.jdiameter.api.Request) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) SubscribeNotificationsRequestImpl(org.jdiameter.common.impl.app.sh.SubscribeNotificationsRequestImpl) 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 7 with SubscribeNotificationsRequest

use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.

the class ShClientMessageFactoryImpl method createSubscribeNotificationsRequest.

public SubscribeNotificationsRequest createSubscribeNotificationsRequest(UserIdentityAvp userIdentity, DataReferenceType reference, SubsReqType subscriptionType) {
    SubscribeNotificationsRequest snr = this.createSubscribeNotificationsRequest();
    snr.setUserIdentity(userIdentity);
    snr.setDataReference(reference);
    snr.setSubsReqType(subscriptionType);
    return snr;
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)

Example 8 with SubscribeNotificationsRequest

use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.

the class ShServerFactoriesTest method isProxiableCopiedSNA.

@Test
public void isProxiableCopiedSNA() throws Exception {
    SubscribeNotificationsRequest snr = shClientFactory.createSubscribeNotificationsRequest();
    SubscribeNotificationsAnswer sna = shServerFactory.createSubscribeNotificationsAnswer(snr);
    assertEquals("The 'P' bit is not copied from request in Subscribe-Notifications-Answer, it should. [RFC3588/6.2]", snr.getHeader().isProxiable(), sna.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) snr).getGenericData().setProxiable(!snr.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Subscribe-Notifications-Request, it should.", snr.getHeader().isProxiable() != sna.getHeader().isProxiable());
    sna = shServerFactory.createSubscribeNotificationsAnswer(snr);
    assertEquals("The 'P' bit is not copied from request in Subscribe-Notifications-Answer, it should. [RFC3588/6.2]", snr.getHeader().isProxiable(), sna.getHeader().isProxiable());
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) SubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 9 with SubscribeNotificationsRequest

use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.

the class HSSClientChildSbb method subscribeIMSUserState.

public String subscribeIMSUserState(String publicIdentity, int subscriptionRequestType, String destinationRealm, String destinationHost) throws IOException {
    UserIdentityAvp publicIdentityAvp = createUserIdentityAvp(publicIdentity, null);
    SubscribeNotificationsRequest snr = diameterShClientMessageFactory.createSubscribeNotificationsRequest(publicIdentityAvp, DataReferenceType.IMS_USER_STATE, SubsReqType.fromInt(subscriptionRequestType));
    snr.setAuthSessionState(AuthSessionStateType.NO_STATE_MAINTAINED);
    // Set destination -- Realm is mandatory, host is optional
    snr.setDestinationRealm(new DiameterIdentity(destinationRealm));
    if (destinationHost != null) {
        snr.setDestinationHost(new DiameterIdentity(destinationHost));
    }
    ShClientActivity activity = getShClientActivity();
    activity.sendSubscribeNotificationsRequest(snr);
    // Store request for future matching
    storeRequestInACI(activity, snr);
    // Return Session-Id, may be used as identifier
    return activity.getSessionId();
}
Also used : ShClientActivity(net.java.slee.resource.diameter.sh.client.ShClientActivity) SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) DiameterIdentity(net.java.slee.resource.diameter.base.events.avp.DiameterIdentity) UserIdentityAvp(net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)

Example 10 with SubscribeNotificationsRequest

use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.

the class HSSClientChildSbb method getUserIdentityValues.

private String[] getUserIdentityValues(DiameterShMessage shMessage) {
    UserIdentityAvp uIdAvp = null;
    if (shMessage instanceof UserDataRequest) {
        uIdAvp = ((UserDataRequest) shMessage).getUserIdentity();
    } else if (shMessage instanceof ProfileUpdateRequest) {
        uIdAvp = ((ProfileUpdateRequest) shMessage).getUserIdentity();
    } else if (shMessage instanceof SubscribeNotificationsRequest) {
        uIdAvp = ((SubscribeNotificationsRequest) shMessage).getUserIdentity();
    } else if (shMessage instanceof PushNotificationRequest) {
        uIdAvp = ((PushNotificationRequest) shMessage).getUserIdentity();
    }
    String publicIdentity = null;
    String msisdn = null;
    if (uIdAvp != null) {
        publicIdentity = uIdAvp.getPublicIdentity();
        msisdn = uIdAvp.getMsisdn();
        if (publicIdentity == null && msisdn == null) {
            tracer.warning("Unable to retrieve Public User/Service Identity OR MSISDN. At least one of them should be present.");
        }
    } else {
        tracer.warning("User-Identity AVP missing in Diameter Sh Message.");
    }
    return new String[] { publicIdentity, msisdn };
}
Also used : UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) UserIdentityAvp(net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)

Aggregations

SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)23 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 SubscribeNotificationsAnswer (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)7 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)7 DiameterIdentity (net.java.slee.resource.diameter.base.events.avp.DiameterIdentity)5 ShClientActivity (net.java.slee.resource.diameter.sh.client.ShClientActivity)5 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)4 IOException (java.io.IOException)3 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)3 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)3 Request (org.jdiameter.api.Request)3 SubscribeNotificationsRequestImpl (org.jdiameter.common.impl.app.sh.SubscribeNotificationsRequestImpl)3 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)2 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)2 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)2 UserIdentityAvpImpl (org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl)2 AvpRepresentation (org.mobicents.diameter.dictionary.AvpRepresentation)1 ShClientMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl)1