use of org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl 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.GqAbortSessionRequestImpl in project jain-slee.diameter by RestComm.
the class GqMessageFactoryImpl method createGqAbortSessionRequest.
@Override
public GqAbortSessionRequest createGqAbortSessionRequest(String sessionId) {
Message raw = createRequest(GqAbortSessionRequest.COMMAND_CODE, new DiameterAvp[] {});
GqAbortSessionRequest asr = new GqAbortSessionRequestImpl(raw);
asr.setSessionId(sessionId);
addOrigin(asr);
return asr;
}
use of org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl in project jain-slee.diameter by RestComm.
the class GqMessageFactoryImpl method createGqAbortSessionRequest.
@Override
public GqAbortSessionRequest createGqAbortSessionRequest() {
Message raw = createRequest(GqAbortSessionRequest.COMMAND_CODE, new DiameterAvp[] {});
GqAbortSessionRequest asr = new GqAbortSessionRequestImpl(raw);
if (sessionId != null) {
asr.setSessionId(sessionId);
}
addOrigin(asr);
return asr;
}
use of org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl in project jain-slee.diameter by RestComm.
the class GqSessionActivityImpl 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 GqAARequest.COMMAND_CODE:
answer = new GqAARequestImpl(receivedMessage);
break;
case GqAbortSessionRequest.COMMAND_CODE:
answer = new GqAbortSessionRequestImpl(receivedMessage);
break;
case GqReAuthRequest.COMMAND_CODE:
answer = new GqReAuthRequestImpl(receivedMessage);
break;
case GqSessionTerminationRequest.COMMAND_CODE:
answer = new GqSessionTerminationRequestImpl(receivedMessage);
break;
default:
logger.error("Received an unknown type of Message for Gq' Activity: " + receivedMessage);
break;
}
}
} else {
logger.error("Received a REQUEST message when expecting an ANSWER.");
}
} else {
logger.debug("No answer received. Returning null.");
}
return answer;
}
Aggregations