use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class AuthServerSessionActivityImpl method sendReAuthRequest.
public void sendReAuthRequest(ReAuthRequest request) throws IOException {
try {
// super.sendMessage(request);
DiameterMessageImpl msg = (DiameterMessageImpl) request;
this.serverSession.sendReAuthRequest(new ReAuthRequestImpl(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 AuthServerSessionActivityImpl method sendSessionTerminationAnswer.
public void sendSessionTerminationAnswer(SessionTerminationAnswer request) throws IOException {
try {
// super.sendMessage(request);
DiameterMessageImpl msg = (DiameterMessageImpl) request;
this.serverSession.sendSessionTerminationAnswer(new SessionTermAnswerImpl((Answer) 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 DiameterActivityImpl method doSendMessage.
protected Message doSendMessage(DiameterMessage message) {
Message receivedMessage = null;
try {
if (message instanceof DiameterMessageImpl) {
Future<Message> future = this.session.send(((DiameterMessageImpl) message).getGenericData());
receivedMessage = future.get();
} else {
throw new OperationNotSupportedException("Trying to send wrong type of message? [" + message.getClass() + "] \n" + message);
}
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
logger.error("Failure sending sync request.", e);
}
return receivedMessage;
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class DiameterActivityImpl method sendMessage.
public void sendMessage(DiameterMessage message) throws IOException {
try {
if (message instanceof DiameterMessageImpl) {
DiameterMessageImpl msg = (DiameterMessageImpl) message;
this.session.send(msg.getGenericData(), this.eventListener);
} else {
throw new OperationNotSupportedException("Trying to send wrong type of message? [" + message.getClass() + "] \n" + message);
}
} 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 ShServerActivityImpl method fetchSessionData.
// #########################
// # DiameterActivityImpl
// #########################
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) {
boolean changed = false;
if (remoteRealm == null) {
remoteRealm = msg.getOriginRealm();
changed = true;
}
if (remoteHost == null) {
changed = true;
remoteHost = msg.getOriginHost();
}
if (this.userIdentity == null) {
changed = true;
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()));
}
// FIXME: is this true?
if (this.authSessionState == null) {
changed = true;
this.authSessionState = AuthSessionStateType.fromInt(AvpUtilities.getAvpAsInteger32(277, ((DiameterMessageImpl) msg).getGenericData().getAvps()));
}
stateMessages.add((DiameterMessageImpl) msg);
if (changed) {
super.baseListener.update(getActivityHandle(), this);
}
} else {
// FIXME, do more :)
}
}
}
Aggregations