use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.
the class RfSessionActivityImpl method sendSyncMessage.
@Override
public DiameterMessage sendSyncMessage(DiameterMessage message) {
DiameterMessage answer = null;
Message receivedMessage = doSendMessage(message);
if (receivedMessage != null) {
if (!receivedMessage.isRequest()) {
if (receivedMessage.isError()) {
answer = new ErrorAnswerImpl(receivedMessage);
} else {
switch(receivedMessage.getCommandCode()) {
case RfAccountingRequest.commandCode:
answer = new RfAccountingRequestImpl(receivedMessage);
break;
default:
logger.error("Received an unknown type of Message for Rf Activity: " + receivedMessage);
break;
}
}
} else {
logger.error("Received a REQUEST message when expecting an ANSWER.");
}
} else {
logger.debug("No answer received. Returning null.");
}
return answer;
}
use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterRfResourceAdaptor method createEvent.
/**
* Create Event object from a JDiameter message (request or answer)
*
* @return a DiameterMessage object wrapping the request/answer
* @throws OperationNotSupportedException
*/
private DiameterMessage createEvent(Message message) {
if (message == null) {
throw new NullPointerException("Message argument cannot be null while creating event.");
}
int commandCode = message.getCommandCode();
if (message.isError()) {
return new ErrorAnswerImpl(message);
}
boolean isRequest = message.isRequest();
switch(commandCode) {
case // ACR/ACA
RfAccountingAnswer.commandCode:
return isRequest ? new RfAccountingRequestImpl(message) : new RfAccountingAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
Aggregations