use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class CxDxServerSessionImpl method sendMultimediaAuthenticationAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendMultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer)
*/
public void sendMultimediaAuthenticationAnswer(MultimediaAuthenticationAnswer multimediaAuthenticationAnswer) throws IOException {
DiameterMessageImpl msg = (DiameterMessageImpl) multimediaAuthenticationAnswer;
JMultimediaAuthAnswerImpl answer = new JMultimediaAuthAnswerImpl((Answer) msg.getGenericData());
try {
appSession.sendMultimediaAuthAnswer(answer);
} catch (org.jdiameter.api.validation.AvpNotAllowedException anae) {
throw new AvpNotAllowedException(anae.getMessage(), anae.getAvpCode(), anae.getVendorId());
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to send message.", e);
}
throw new IOException(e.getMessage());
}
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class CreditControlClientSessionImpl method sendInitialCreditControlRequest.
/*
* (non-Javadoc)
*
* @seenet.java.slee.resource.diameter.cca.CreditControlClientSession#
* sendInitialCreditControlRequest
* (net.java.slee.resource.diameter.cca.events.CreditControlRequest)
*/
public void sendInitialCreditControlRequest(CreditControlRequest ccr) throws IOException {
// FIXME: should this affect FSM ?
ccr.setCcRequestType(CcRequestType.INITIAL_REQUEST);
validateState(ccr);
DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
try {
session.sendCreditControlRequest(new JCreditControlRequestImpl((Request) msg.getGenericData()));
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
throw new IOException("Failed to send message, due to: " + e);
}
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class CreditControlClientSessionImpl method sendTerminationCreditControlRequest.
/*
* (non-Javadoc)
*
* @seenet.java.slee.resource.diameter.cca.CreditControlClientSession#
* sendTerminationCreditControlRequest
* (net.java.slee.resource.diameter.cca.events.CreditControlRequest)
*/
public void sendTerminationCreditControlRequest(CreditControlRequest ccr) throws IOException {
// This should not be used to terminate sub-sessions!
// FIXME: Should this come already in the CCR?
ccr.setCcRequestType(CcRequestType.TERMINATION_REQUEST);
validateState(ccr);
DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
try {
session.sendCreditControlRequest(new JCreditControlRequestImpl((Request) msg.getGenericData()));
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
throw new IOException("Failed to send message, due to: " + e);
}
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class CreditControlServerSessionImpl method sendCreditControlAnswer.
/*
* (non-Javadoc)
*
* @see net.java.slee.resource.diameter.cca.CreditControlServerSession#sendCreditControlAnswer(net.java.slee.resource.diameter.cca.events.CreditControlAnswer)
*/
public void sendCreditControlAnswer(CreditControlAnswer cca) throws IOException {
fetchCurrentState(cca);
DiameterMessageImpl msg = (DiameterMessageImpl) cca;
try {
session.sendCreditControlAnswer(new JCreditControlAnswerImpl((Answer) msg.getGenericData()));
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
AvpNotAllowedException anae = new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
throw anae;
} catch (Exception e) {
e.printStackTrace();
IOException ioe = new IOException("Failed to send message, due to: " + e);
throw ioe;
}
}
use of org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl in project jain-slee.diameter by RestComm.
the class ValidatorImpl method validate.
// NOTE: this class possibly should be Singleton, however some impl may use something more to perform validation
// hence, its not static, each RA provides instance through RA Sbb Interface.
/*
* (non-Javadoc)
*
* @see
* net.java.slee.resource.diameter.Validator#validate(net.java.slee.resource
* .diameter.base.events.DiameterMessage)
*/
@Override
public void validate(DiameterMessage msg) throws AvpNotAllowedException {
Dictionary dictionary = DictionarySingleton.getDictionary();
if (dictionary.isConfigured() && dictionary.isEnabled()) {
DiameterCommand com = msg.getCommand();
MessageRepresentation rep = dictionary.getMessage(com.getCode(), com.getApplicationId(), com.isRequest());
if (rep != null) {
DiameterMessageImpl impl = (DiameterMessageImpl) msg;
try {
rep.validate(impl.getGenericData(), ValidatorLevel.ALL);
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Failed to validate message.", e, e.getAvpCode(), e.getVendorId());
}
}
}
}
Aggregations