use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.
the class CreditControlMessageFactoryImpl method createCreditControlRequest.
/*
* (non-Javadoc)
*
* @see net.java.slee.resource.diameter.cca.CreditControlMessageFactory#createCreditControlRequest(java.lang.String)
*/
public CreditControlRequest createCreditControlRequest(String sessionId) throws IllegalArgumentException {
try {
DiameterAvp sessionIdAvp;
sessionIdAvp = creditControlAvpFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, sessionId);
CreditControlRequest req = (CreditControlRequest) createCreditControlMessage(null, new DiameterAvp[] { sessionIdAvp });
addOrigin(req);
return req;
} catch (NoSuchAvpException e) {
throw new IllegalArgumentException(e);
}
}
use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.
the class CreditControlMessageFactoryImpl method createCreditControlAnswer.
/*
* (non-Javadoc)
*
* @see net.java.slee.resource.diameter.cca.CreditControlMessageFactory#createCreditControlAnswer
* (net.java.slee.resource.diameter.cca.events.CreditControlRequest)
*/
public CreditControlAnswer createCreditControlAnswer(CreditControlRequest request) {
// Create the answer from the request
CreditControlRequestImpl ccr = (CreditControlRequestImpl) request;
// DiameterAvp sessionIdAvp = null;
// try {
// sessionIdAvp = creditControlAvpFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, this.session.getSessionId());
// }
// catch (NoSuchAvpException e1) {
// logger.error("Session-Id AVP not found in message", e1);
// }
CreditControlAnswerImpl msg = (CreditControlAnswerImpl) createCreditControlMessage(ccr.getHeader(), new DiameterAvp[0]);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_HOST);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_REALM);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_HOST);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_REALM);
msg.setSessionId(request.getSessionId());
// Now copy the needed AVPs
DiameterAvp[] messageAvps = request.getAvps();
if (messageAvps != null) {
for (DiameterAvp a : messageAvps) {
try {
if (ids.contains(a.getCode())) {
msg.addAvp(a);
}
} catch (Exception e) {
logger.error("Failed to add AVP to answer. Code[" + a.getCode() + "]", e);
}
}
}
addOrigin(msg);
return msg;
}
use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.
the class ShServerMessageFactoryImpl method createProfileUpdateAnswer.
public ProfileUpdateAnswer createProfileUpdateAnswer(ProfileUpdateRequest request) {
List<DiameterAvp> avps = new ArrayList<DiameterAvp>();
DiameterAvp sessionIdAvp = null;
try {
sessionIdAvp = localFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, request.getSessionId());
avps.add(sessionIdAvp);
} catch (NoSuchAvpException e) {
logger.error("Unable to create Session-Id AVP.", e);
}
if (request.getUserIdentity() != null) {
avps.add(request.getUserIdentity());
}
Message msg = createShMessage(request.getHeader(), avps.toArray(new DiameterAvp[avps.size()]));
ProfileUpdateAnswerImpl answer = new ProfileUpdateAnswerImpl(msg);
answer.setRouteRecords(request.getRouteRecords());
addOrigin(answer);
return answer;
}
use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.
the class ShClientMessageFactoryImpl method createSubscribeNotificationsRequest.
public SubscribeNotificationsRequest createSubscribeNotificationsRequest() {
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, SubscribeNotificationsRequest.commandCode);
SubscribeNotificationsRequestImpl snr = new SubscribeNotificationsRequestImpl(msg);
addOrigin(snr);
return snr;
}
use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.
the class ShClientMessageFactoryImpl method createUserDataRequest.
public UserDataRequest createUserDataRequest() {
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, UserDataRequest.commandCode);
UserDataRequestImpl udr = new UserDataRequestImpl(msg);
addOrigin(udr);
return udr;
}
Aggregations