Search in sources :

Example 11 with CreditControlRequest

use of net.java.slee.resource.diameter.cca.events.CreditControlRequest in project jain-slee.diameter by RestComm.

the class CreditControlMessageFactoryImpl method createCreditControlRequest.

/*
   * (non-Javadoc)
   * 
   * @see net.java.slee.resource.diameter.cca.CreditControlMessageFactory#createCreditControlRequest(java.lang.String)
   */
public CreditControlRequest createCreditControlRequest(String sessionId) throws IllegalArgumentException {
    try {
        DiameterAvp sessionIdAvp;
        sessionIdAvp = creditControlAvpFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, sessionId);
        CreditControlRequest req = (CreditControlRequest) createCreditControlMessage(null, new DiameterAvp[] { sessionIdAvp });
        addOrigin(req);
        return req;
    } catch (NoSuchAvpException e) {
        throw new IllegalArgumentException(e);
    }
}
Also used : DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) CreditControlRequest(net.java.slee.resource.diameter.cca.events.CreditControlRequest) NoSuchAvpException(net.java.slee.resource.diameter.base.NoSuchAvpException)

Example 12 with CreditControlRequest

use of net.java.slee.resource.diameter.cca.events.CreditControlRequest in project jain-slee.diameter by RestComm.

the class CreditControlMessageFactoryImpl method createCreditControlRequest.

/*
   * (non-Javadoc)
   * 
   * @see net.java.slee.resource.diameter.cca.CreditControlMessageFactory#createCreditControlRequest()
   */
public CreditControlRequest createCreditControlRequest() {
    CreditControlRequest req = (CreditControlRequest) createCreditControlMessage(null, new DiameterAvp[0]);
    req.setOriginRealm(new DiameterIdentity(stack.getMetaData().getLocalPeer().getRealmName()));
    req.setOriginHost(new DiameterIdentity(stack.getMetaData().getLocalPeer().getUri().getFQDN().toString()));
    if (session != null) {
        req.setSessionId(session.getSessionId());
    }
    return req;
}
Also used : DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) DiameterIdentity(net.java.slee.resource.diameter.base.events.avp.DiameterIdentity) CreditControlRequest(net.java.slee.resource.diameter.cca.events.CreditControlRequest)

Aggregations

CreditControlRequest (net.java.slee.resource.diameter.cca.events.CreditControlRequest)12 Test (org.junit.Test)6 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)6 IOException (java.io.IOException)4 DiameterException (net.java.slee.resource.diameter.base.DiameterException)4 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)4 Request (org.jdiameter.api.Request)4 JCreditControlRequestImpl (org.jdiameter.common.impl.app.cca.JCreditControlRequestImpl)4 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)4 CreditControlAnswer (net.java.slee.resource.diameter.cca.events.CreditControlAnswer)3 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)2 NoSuchAvpException (net.java.slee.resource.diameter.base.NoSuchAvpException)1 DiameterIdentity (net.java.slee.resource.diameter.base.events.avp.DiameterIdentity)1