use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class ShClientActivityImpl method sendUserDataRequest.
public void sendUserDataRequest(UserDataRequest message) throws IOException {
try {
DiameterMessageImpl msg = (DiameterMessageImpl) message;
this.clientSession.sendUserDataRequest(new UserDataRequestImpl((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 org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class ShClientActivityImpl method sendProfileUpdateRequest.
public void sendProfileUpdateRequest(ProfileUpdateRequest message) throws IOException {
try {
DiameterMessageImpl msg = (DiameterMessageImpl) message;
clientSession.sendProfileUpdateRequest(new ProfileUpdateRequestImpl((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.getLocalizedMessage());
}
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class ShClientSubscriptionActivityImpl method sendSubscribeNotificationsRequest.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.ShClientSubscriptionActivity#sendSubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.server.events.SubscribeNotificationsRequest)
*/
public void sendSubscribeNotificationsRequest(SubscribeNotificationsRequest request) throws IOException {
try {
DiameterMessageImpl msg = (DiameterMessageImpl) request;
this.clientSession.sendSubscribeNotificationsRequest(new SubscribeNotificationsRequestImpl((Request) msg.getGenericData()));
fetchSessionData(msg, false);
} 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.getLocalizedMessage());
}
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl 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();
}
}
}
}
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class ShClientSubscriptionActivityImpl method sendPushNotificationAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.ShClientSubscriptionActivity#sendPushNotificationAnswer(net.java.slee.resource.diameter.sh.server.events.PushNotificationAnswer)
*/
public void sendPushNotificationAnswer(PushNotificationAnswer answer) throws IOException {
try {
DiameterMessageImpl msg = (DiameterMessageImpl) answer;
this.clientSession.sendPushNotificationAnswer(new PushNotificationAnswerImpl((Answer) msg.getGenericData()));
clean((DiameterShMessageImpl) answer);
fetchSessionData(answer, false);
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
// FIXME: extent this exception to add trace....
throw new IOException("Failed to send message, due to: " + e.getLocalizedMessage());
}
}
Aggregations