use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.
the class ShClientMessageFactoryImpl method createPushNotificationAnswer.
public PushNotificationAnswer createPushNotificationAnswer(PushNotificationRequest request) {
DiameterAvp[] avps = new DiameterAvp[0];
try {
DiameterAvp sessionIdAvp = null;
sessionIdAvp = baseAvpFactory.createAvp(0, DiameterAvpCodes.SESSION_ID, request.getSessionId());
avps = new DiameterAvp[] { sessionIdAvp };
} catch (NoSuchAvpException e) {
logger.error("Unexpected failure trying to create Session-Id AVP.", e);
}
Message msg = createShMessage(request.getHeader(), avps, PushNotificationAnswer.commandCode);
PushNotificationAnswerImpl pna = new PushNotificationAnswerImpl(msg);
addOrigin(pna);
return pna;
}
use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.
the class ShClientMessageFactoryImpl method createProfileUpdateRequest.
public ProfileUpdateRequest createProfileUpdateRequest() {
DiameterAvp[] avps = new DiameterAvp[0];
if (session != null) {
try {
DiameterAvp sessionIdAvp = null;
sessionIdAvp = baseAvpFactory.createAvp(0, DiameterAvpCodes.SESSION_ID, session.getSessionId());
avps = new DiameterAvp[] { sessionIdAvp };
} catch (NoSuchAvpException e) {
logger.error("Unexpected failure trying to create Session-Id AVP.", e);
}
}
Message msg = createShMessage(null, avps, ProfileUpdateRequest.commandCode);
ProfileUpdateRequestImpl pur = new ProfileUpdateRequestImpl(msg);
addOrigin(pur);
return pur;
}
use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.
the class ShClientMessageFactoryImpl method addAvp.
protected void addAvp(DiameterAvp avp, AvpSet set) {
if (avp instanceof GroupedAvp) {
AvpSet avpSet = set.addGroupedAvp(avp.getCode(), avp.getVendorId(), avp.getMandatoryRule() == 1, avp.getProtectedRule() == 1);
DiameterAvp[] groupedAVPs = ((GroupedAvp) avp).getExtensionAvps();
for (DiameterAvp avpFromGroup : groupedAVPs) {
addAvp(avpFromGroup, avpSet);
}
} else if (avp != null)
set.addAvp(avp.getCode(), avp.byteArrayValue(), avp.getVendorId(), avp.getMandatoryRule() == 1, avp.getProtectedRule() == 1);
}
use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.
the class ShClientMessageFactoryImpl method createMessage.
protected Message createMessage(DiameterHeader header, DiameterAvp[] avps, int commandCode) throws AvpNotAllowedException {
try {
Message msg = createRawMessage(header, commandCode);
AvpSet set = msg.getAvps();
for (DiameterAvp avp : avps) {
addAvp(avp, set);
}
return msg;
} catch (Exception e) {
logger.error("Unexpected failure trying to create Sh Message.", e);
}
return null;
}
use of net.java.slee.resource.diameter.base.events.avp.DiameterAvp in project jain-slee.diameter by RestComm.
the class S13ServerSessionImpl method createMEIdentityCheckAnswer.
public MEIdentityCheckAnswer createMEIdentityCheckAnswer() {
// Make sure we have the correct type of Request
if (!(lastRequest instanceof MEIdentityCheckRequest)) {
logger.warn("Invalid type of answer for this activity.");
return null;
}
try {
// Create the answer
MEIdentityCheckAnswer eca = (MEIdentityCheckAnswer) this.s13MessageFactory.createS13Message(lastRequest.getHeader(), new DiameterAvp[] {}, MEIdentityCheckAnswer.COMMAND_CODE, s13MessageFactory.getApplicationId());
// Fill session related AVPs, if present
fillSessionAVPs(eca);
return eca;
} catch (InternalException e) {
logger.error("Failed to create Authentication-Information-Answer.", e);
}
return null;
}
Aggregations