use of org.jdiameter.api.InternalException in project jain-slee.diameter by RestComm.
the class CxDxClientSessionImpl method createPushProfileAnswer.
/* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#createPushProfileAnswer()
*/
public PushProfileAnswer createPushProfileAnswer() {
// Make sure we have the correct type of Request
if (!(lastRequest instanceof PushProfileRequest)) {
logger.warn("Invalid type of answer for this activity.");
return null;
}
try {
// Create the answer
PushProfileAnswer ppa = (PushProfileAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, PushProfileAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
// Fill session related AVPs, if present
fillSessionAVPs(ppa);
return ppa;
} catch (InternalException e) {
logger.error("Failed to create Push-Profile-Answer.", e);
}
return null;
}
use of org.jdiameter.api.InternalException in project jain-slee.diameter by RestComm.
the class CxDxServerSessionImpl method createMultimediaAuthenticationAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#createMultimediaAuthenticationAnswer()
*/
public MultimediaAuthenticationAnswer createMultimediaAuthenticationAnswer() {
// Make sure we have the correct type of Request
if (!(lastRequest instanceof MultimediaAuthenticationRequest)) {
logger.warn("Invalid type of answer for this activity.");
return null;
}
try {
// Create the answer
MultimediaAuthenticationAnswer maa = (MultimediaAuthenticationAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, MultimediaAuthenticationAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
// Fill session related AVPs, if present
fillSessionAVPs(maa);
return maa;
} catch (InternalException e) {
logger.error("Failed to create Multimedia-Authentication-Answer.", e);
}
return null;
}
use of org.jdiameter.api.InternalException in project jain-slee.diameter by RestComm.
the class GqMessageFactoryImpl method createRawMessage.
protected Message createRawMessage(DiameterHeader header) {
if (header == null) {
return null;
}
int commandCode = 0;
long endToEndId = 0;
long hopByHopId = 0;
boolean isRequest = true;
boolean isProxiable = true;
boolean isError = false;
boolean isPotentiallyRetransmitted = false;
commandCode = header.getCommandCode();
endToEndId = header.getEndToEndId();
hopByHopId = header.getHopByHopId();
isRequest = header.isRequest();
isProxiable = header.isProxiable();
isError = header.isError();
isPotentiallyRetransmitted = header.isPotentiallyRetransmitted();
Message msg = null;
try {
msg = stack.getSessionFactory().getNewRawSession().createMessage(commandCode, gqAppId, hopByHopId, endToEndId);
// Set the message flags from header (or default)
msg.setRequest(isRequest);
msg.setProxiable(isProxiable);
msg.setError(isError);
msg.setReTransmitted(isRequest && isPotentiallyRetransmitted);
} catch (IllegalDiameterStateException e) {
logger.error("Failed to get session factory for message creation.", e);
} catch (InternalException e) {
logger.error("Failed to create new raw session for message creation.", e);
}
return msg;
}
use of org.jdiameter.api.InternalException in project jain-slee.diameter by RestComm.
the class RoMessageFactoryImpl method createRawMessage.
protected Message createRawMessage(DiameterHeader header) {
int commandCode = 0;
long endToEndId = 0;
long hopByHopId = 0;
boolean isRequest = true;
boolean isProxiable = true;
boolean isError = false;
boolean isPotentiallyRetransmitted = false;
if (header != null) {
// Answer
commandCode = header.getCommandCode();
endToEndId = header.getEndToEndId();
hopByHopId = header.getHopByHopId();
isRequest = header.isRequest();
isProxiable = header.isProxiable();
isError = header.isError();
isPotentiallyRetransmitted = header.isPotentiallyRetransmitted();
// aid = ApplicationId.createByAuthAppId(header.getApplicationId());
} else {
commandCode = RoCreditControlRequest.commandCode;
// endToEndId = (long) (Math.random()*1000000);
// hopByHopId = (long) (Math.random()*1000000)+1;
}
Message msg = null;
try {
if (header != null) {
msg = stack.getSessionFactory().getNewRawSession().createMessage(commandCode, roAppId, hopByHopId, endToEndId);
} else {
msg = stack.getSessionFactory().getNewRawSession().createMessage(commandCode, roAppId);
}
} catch (IllegalDiameterStateException e) {
logger.error("Failed to get session factory for message creation.", e);
} catch (InternalException e) {
logger.error("Failed to create new raw session for message creation.", e);
}
// Set the message flags from header (or default)
msg.setRequest(isRequest);
msg.setProxiable(isProxiable);
msg.setError(isError);
msg.setReTransmitted(isRequest && isPotentiallyRetransmitted);
return msg;
}
use of org.jdiameter.api.InternalException in project jain-slee.diameter by RestComm.
the class S6aClientSessionImpl method createDeleteSubscriberDataAnswer.
public DeleteSubscriberDataAnswer createDeleteSubscriberDataAnswer() {
// Make sure we have the correct type of Request
if (!(lastRequest instanceof DeleteSubscriberDataRequest)) {
logger.warn("Invalid type of answer for this activity.");
return null;
}
try {
// Create the answer
DeleteSubscriberDataAnswer dsa = (DeleteSubscriberDataAnswer) this.s6aMessageFactory.createS6aMessage(lastRequest.getHeader(), new DiameterAvp[] {}, DeleteSubscriberDataAnswer.COMMAND_CODE, s6aMessageFactory.getApplicationId());
// Fill session related AVPs, if present
fillSessionAVPs(dsa);
return dsa;
} catch (InternalException e) {
logger.error("Failed to create Delete-Subscriber-Data-Answer.", e);
}
return null;
}
Aggregations