Search in sources :

Example 1 with NoSuchAvpException

use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.

the class ShServerMessageFactoryImpl method createUserDataAnswer.

public UserDataAnswer createUserDataAnswer(UserDataRequest request) {
    // Message msg = createShMessage(UserDataAnswer.commandCode, session !=
    // null ? session.getSessionId() : null, false);
    List<DiameterAvp> avps = new ArrayList<DiameterAvp>();
    DiameterAvp sessionIdAvp = null;
    try {
        sessionIdAvp = localFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, request.getSessionId());
        avps.add(sessionIdAvp);
    } catch (NoSuchAvpException e) {
        logger.error("Unable to create Session-Id AVP.", e);
    }
    if (request.getUserIdentity() != null)
        avps.add(request.getUserIdentity());
    Message msg = createShMessage(request.getHeader(), avps.toArray(new DiameterAvp[avps.size()]));
    UserDataAnswerImpl answer = new UserDataAnswerImpl(msg);
    answer.setRouteRecords(request.getRouteRecords());
    // add more :) ?
    addOrigin(answer);
    return answer;
}
Also used : UserDataAnswerImpl(org.mobicents.slee.resource.diameter.sh.events.UserDataAnswerImpl) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) ArrayList(java.util.ArrayList) NoSuchAvpException(net.java.slee.resource.diameter.base.NoSuchAvpException)

Example 2 with NoSuchAvpException

use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.

the class ShServerMessageFactoryImpl method createPushNotificationRequest.

public PushNotificationRequest createPushNotificationRequest() {
    List<DiameterAvp> avps = new ArrayList<DiameterAvp>();
    if (session != null)
        try {
            DiameterAvp sessionIdAvp = null;
            sessionIdAvp = localFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, session.getSessionId());
            avps.add(sessionIdAvp);
        } catch (NoSuchAvpException e) {
            logger.error("Unable to create Session-Id AVP.", e);
        }
    Message msg = createShMessage(null, avps.toArray(new DiameterAvp[avps.size()]));
    PushNotificationRequestImpl request = new PushNotificationRequestImpl(msg);
    addOrigin(request);
    return request;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) PushNotificationRequestImpl(org.mobicents.slee.resource.diameter.sh.events.PushNotificationRequestImpl) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) ArrayList(java.util.ArrayList) NoSuchAvpException(net.java.slee.resource.diameter.base.NoSuchAvpException)

Example 3 with NoSuchAvpException

use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.

the class ShServerMessageFactoryImpl method createSubscribeNotificationsAnswer.

public SubscribeNotificationsAnswer createSubscribeNotificationsAnswer(SubscribeNotificationsRequest request) {
    // Message msg = createShMessage(UserDataAnswer.commandCode, session !=
    // null ? session.getSessionId() : null, false);
    List<DiameterAvp> avps = new ArrayList<DiameterAvp>();
    DiameterAvp sessionIdAvp = null;
    try {
        sessionIdAvp = localFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, request.getSessionId());
        avps.add(sessionIdAvp);
    } catch (NoSuchAvpException e) {
        logger.error("Unable to create Session-Id AVP.", e);
    }
    if (request.getUserIdentity() != null) {
        avps.add(request.getUserIdentity());
    }
    Message msg = createShMessage(request.getHeader(), avps.toArray(new DiameterAvp[avps.size()]));
    SubscribeNotificationsAnswerImpl answer = new SubscribeNotificationsAnswerImpl(msg);
    answer.setRouteRecords(request.getRouteRecords());
    // add more :) ?
    addOrigin(answer);
    return answer;
}
Also used : SubscribeNotificationsAnswerImpl(org.mobicents.slee.resource.diameter.sh.events.SubscribeNotificationsAnswerImpl) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) ArrayList(java.util.ArrayList) NoSuchAvpException(net.java.slee.resource.diameter.base.NoSuchAvpException)

Example 4 with NoSuchAvpException

use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.

the class ShClientMessageFactoryImpl method createPushNotificationAnswer.

public PushNotificationAnswer createPushNotificationAnswer(PushNotificationRequest request) {
    DiameterAvp[] avps = new DiameterAvp[0];
    try {
        DiameterAvp sessionIdAvp = null;
        sessionIdAvp = baseAvpFactory.createAvp(0, DiameterAvpCodes.SESSION_ID, request.getSessionId());
        avps = new DiameterAvp[] { sessionIdAvp };
    } catch (NoSuchAvpException e) {
        logger.error("Unexpected failure trying to create Session-Id AVP.", e);
    }
    Message msg = createShMessage(request.getHeader(), avps, PushNotificationAnswer.commandCode);
    PushNotificationAnswerImpl pna = new PushNotificationAnswerImpl(msg);
    addOrigin(pna);
    return pna;
}
Also used : Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) NoSuchAvpException(net.java.slee.resource.diameter.base.NoSuchAvpException) PushNotificationAnswerImpl(org.mobicents.slee.resource.diameter.sh.events.PushNotificationAnswerImpl)

Example 5 with NoSuchAvpException

use of net.java.slee.resource.diameter.base.NoSuchAvpException in project jain-slee.diameter by RestComm.

the class ShClientMessageFactoryImpl method createProfileUpdateRequest.

public ProfileUpdateRequest createProfileUpdateRequest() {
    DiameterAvp[] avps = new DiameterAvp[0];
    if (session != null) {
        try {
            DiameterAvp sessionIdAvp = null;
            sessionIdAvp = baseAvpFactory.createAvp(0, DiameterAvpCodes.SESSION_ID, session.getSessionId());
            avps = new DiameterAvp[] { sessionIdAvp };
        } catch (NoSuchAvpException e) {
            logger.error("Unexpected failure trying to create Session-Id AVP.", e);
        }
    }
    Message msg = createShMessage(null, avps, ProfileUpdateRequest.commandCode);
    ProfileUpdateRequestImpl pur = new ProfileUpdateRequestImpl(msg);
    addOrigin(pur);
    return pur;
}
Also used : ProfileUpdateRequestImpl(org.mobicents.slee.resource.diameter.sh.events.ProfileUpdateRequestImpl) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) NoSuchAvpException(net.java.slee.resource.diameter.base.NoSuchAvpException)

Aggregations

NoSuchAvpException (net.java.slee.resource.diameter.base.NoSuchAvpException)10 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)10 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)8 Message (org.jdiameter.api.Message)8 ArrayList (java.util.ArrayList)4 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 CreditControlRequest (net.java.slee.resource.diameter.cca.events.CreditControlRequest)1 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)1 InternalException (org.jdiameter.api.InternalException)1 CreditControlAnswerImpl (org.mobicents.slee.resource.diameter.cca.events.CreditControlAnswerImpl)1 CreditControlRequestImpl (org.mobicents.slee.resource.diameter.cca.events.CreditControlRequestImpl)1 ProfileUpdateAnswerImpl (org.mobicents.slee.resource.diameter.sh.events.ProfileUpdateAnswerImpl)1 ProfileUpdateRequestImpl (org.mobicents.slee.resource.diameter.sh.events.ProfileUpdateRequestImpl)1 PushNotificationAnswerImpl (org.mobicents.slee.resource.diameter.sh.events.PushNotificationAnswerImpl)1 PushNotificationRequestImpl (org.mobicents.slee.resource.diameter.sh.events.PushNotificationRequestImpl)1 SubscribeNotificationsAnswerImpl (org.mobicents.slee.resource.diameter.sh.events.SubscribeNotificationsAnswerImpl)1 SubscribeNotificationsRequestImpl (org.mobicents.slee.resource.diameter.sh.events.SubscribeNotificationsRequestImpl)1 UserDataAnswerImpl (org.mobicents.slee.resource.diameter.sh.events.UserDataAnswerImpl)1 UserDataRequestImpl (org.mobicents.slee.resource.diameter.sh.events.UserDataRequestImpl)1