use of org.mobicents.slee.resource.diameter.rf.events.RfAccountingRequestImpl in project jain-slee.diameter by RestComm.
the class RfMessageFactoryImpl method createRfAccountingMessage.
protected RfAccountingMessage createRfAccountingMessage(DiameterHeader diameterHeader, DiameterAvp[] avps) throws IllegalArgumentException {
// List<DiameterAvp> list = (List<DiameterAvp>) this.avpList.clone();
boolean isRequest = diameterHeader == null;
RfAccountingMessage msg = null;
if (!isRequest) {
Message raw = createMessage(diameterHeader, avps);
raw.setProxiable(diameterHeader.isProxiable());
raw.setRequest(false);
// just in case. answers never have T flag set
raw.setReTransmitted(false);
msg = new RfAccountingAnswerImpl(raw);
} else {
Message raw = createMessage(null, avps);
raw.setProxiable(true);
raw.setRequest(true);
msg = new RfAccountingRequestImpl(raw);
}
return msg;
}
use of org.mobicents.slee.resource.diameter.rf.events.RfAccountingRequestImpl 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.rf.events.RfAccountingRequestImpl 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