use of org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionAnswerImpl 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.GqAbortSessionAnswerImpl in project jain-slee.diameter by RestComm.
the class GqMessageFactoryImpl method createGqAbortSessionAnswer.
@Override
public GqAbortSessionAnswer createGqAbortSessionAnswer(GqAbortSessionRequest asr) {
Message raw = createMessage(asr.getHeader(), new DiameterAvp[] {});
// this should be different ...
raw.setRequest(false);
// just in case. answers never have T flag set
raw.setReTransmitted(false);
GqAbortSessionAnswerImpl asa = new GqAbortSessionAnswerImpl(raw);
asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_HOST);
asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_REALM);
asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_HOST);
asa.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_REALM);
asa.setSessionId(asr.getSessionId());
addOrigin(asa);
return asa;
}
Aggregations