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);
}
}
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;
}
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());
}
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();
}
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 };
}
Aggregations