Search in sources :

Example 1 with MultimediaAuthenticationRequest

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.

the class CxDxClientSessionImpl method createMultimediaAuthenticationRequest.

/* (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#createMultimediaAuthenticationRequest()
   */
public MultimediaAuthenticationRequest createMultimediaAuthenticationRequest() {
    // Create the request
    MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest(super.getSessionId());
    // Fill session related AVPs, if present
    fillSessionAVPs(mar);
    return mar;
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest)

Example 2 with MultimediaAuthenticationRequest

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.

the class CxDxMessageFactoryImpl method createMultimediaAuthenticationRequest.

/* (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxMessageFactory#createMultimediaAuthenticationRequest(java.lang.String)
   */
public MultimediaAuthenticationRequest createMultimediaAuthenticationRequest(String sessionId) throws IllegalArgumentException {
    MultimediaAuthenticationRequest mar = createMultimediaAuthenticationRequest();
    mar.setSessionId(sessionId);
    return mar;
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest)

Example 3 with MultimediaAuthenticationRequest

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.

the class CxDxServerSessionImpl method createMultimediaAuthenticationAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#createMultimediaAuthenticationAnswer()
   */
public MultimediaAuthenticationAnswer createMultimediaAuthenticationAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof MultimediaAuthenticationRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        MultimediaAuthenticationAnswer maa = (MultimediaAuthenticationAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, MultimediaAuthenticationAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(maa);
        return maa;
    } catch (InternalException e) {
        logger.error("Failed to create Multimedia-Authentication-Answer.", e);
    }
    return null;
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) MultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) InternalException(org.jdiameter.api.InternalException)

Example 4 with MultimediaAuthenticationRequest

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method isRequestMAR.

@Test
public void isRequestMAR() throws Exception {
    MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest();
    assertTrue("Request Flag in Multimedia-Authentication-Request is not set.", mar.getHeader().isRequest());
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with MultimediaAuthenticationRequest

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testMessageFactoryApplicationIdChangeMAR.

@Test
public void testMessageFactoryApplicationIdChangeMAR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((CxDxMessageFactoryImpl) cxdxMessageFactory).getApplicationId();
    boolean isAuth = originalAppId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isAcct = originalAppId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isVendor = originalAppId.getVendorId() != 0L;
    assertTrue("Invalid Application-Id (" + originalAppId + "). Should only, and at least, contain either Auth or Acct value.", (isAuth && !isAcct) || (!isAuth && isAcct));
    System.out.println("Default VENDOR-ID for CxDx is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    MultimediaAuthenticationRequest originalMAR = cxdxMessageFactory.createMultimediaAuthenticationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalMAR);
    // now we switch..
    originalMAR = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    MultimediaAuthenticationRequest changedMAR = cxdxMessageFactory.createMultimediaAuthenticationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedMAR);
    // revert back to default
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) CxDxMessageFactoryImpl(org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

MultimediaAuthenticationRequest (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest)11 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 MultimediaAuthenticationAnswer (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer)4 ApplicationId (org.jdiameter.api.ApplicationId)3 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)3 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 InternalException (org.jdiameter.api.InternalException)1