use of org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterGqResourceAdaptor 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 // AAR/AAA
GqAARequest.COMMAND_CODE:
return isRequest ? new GqAARequestImpl(message) : new GqAAAnswerImpl(message);
case // ASR/ASA
GqAbortSessionRequest.COMMAND_CODE:
return isRequest ? new GqAbortSessionRequestImpl(message) : new GqAbortSessionAnswerImpl(message);
case // STR/STA
GqSessionTerminationRequest.COMMAND_CODE:
return isRequest ? new GqSessionTerminationRequestImpl(message) : new GqSessionTerminationAnswerImpl(message);
case // RAR/RAA
GqReAuthRequest.COMMAND_CODE:
return isRequest ? new GqReAuthRequestImpl(message) : new GqReAuthAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationAnswerImpl in project jain-slee.diameter by RestComm.
the class GqMessageFactoryImpl method createGqSessionTerminationAnswer.
@Override
public GqSessionTerminationAnswer createGqSessionTerminationAnswer(GqSessionTerminationRequest str) {
Message raw = createMessage(str.getHeader(), new DiameterAvp[] {});
// this should be different ...
raw.setRequest(false);
// just in case. answers never have T flag set
raw.setReTransmitted(false);
GqSessionTerminationAnswerImpl sta = new GqSessionTerminationAnswerImpl(raw);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_HOST);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_REALM);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_HOST);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_REALM);
sta.setSessionId(str.getSessionId());
addOrigin(sta);
return sta;
}
Aggregations