public static DiameterIdentity getAvpAsDiameterIdentity(int avpCode, AvpSet set) { try { Avp avp = set.getAvp(avpCode); return avp != null ? new DiameterIdentity(avp.getDiameterIdentity()) : null; } catch (AvpDataException e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " as type OctetString.", e); } return null; } }
public static DiameterIdentity getAvpAsDiameterIdentity(int avpCode, AvpSet set) { try { Avp avp = set.getAvp(avpCode); return avp != null ? new DiameterIdentity(avp.getDiameterIdentity()) : null; } catch (AvpDataException e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " as type OctetString.", e); } return null; } }
private void addRoutingInfo(MessageImpl request) { for (Avp a :request.getAvps()) { if (a.getCode() == Avp.ORIGIN_HOST) { try { routingInfo[0] = a.getDiameterIdentity(); if (routingInfo[1] != null) { return; } } catch (AvpDataException e) { logger.error("Unable to read Origin-Host AVP value for storing Routing Info", e); } } else if (a.getCode() == Avp.ORIGIN_REALM) { try { routingInfo[1] = a.getDiameterIdentity(); if (routingInfo[0] != null) { return; } } catch (AvpDataException e) { logger.error("Unable to read Origin-Realm AVP value for storing Routing Info", e); } } } }
public static DiameterIdentity[] getAvpsAsDiameterIdentity(int avpCode, AvpSet set) { try { AvpSet avpSet = set.getAvps(avpCode); DiameterIdentity[] values = new DiameterIdentity[avpSet.size()]; int i = 0; for(Avp avp : avpSet) { values[i++] = new DiameterIdentity(avp.getDiameterIdentity()); } return values; } catch (AvpDataException e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " as type DiameterIdentity.", e); } return new DiameterIdentity[0]; } }
@Override public Realm matchRealm(IRequest request) { try { // once again casting... IMessage req = (IMessage) request; String destinationRealm = req.getAvps().getAvp(Avp.DESTINATION_REALM).getDiameterIdentity(); // we have req, we need match, not dummy longest from right BS match. return this.matchRealm(req, destinationRealm); } catch (Exception e) { logger.error("Unable to read Destination-Realm AVP to match realm to request", e); } return null; }
public static DiameterIdentity[] getAvpsAsDiameterIdentity(int avpCode, AvpSet set) { try { AvpSet avpSet = set.getAvps(avpCode); DiameterIdentity[] values = new DiameterIdentity[avpSet.size()]; int i = 0; for(Avp avp : avpSet) { values[i++] = new DiameterIdentity(avp.getDiameterIdentity()); } return values; } catch (AvpDataException e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " as type DiameterIdentity.", e); } return new DiameterIdentity[0]; } }
@Override public String getDuplicationKey() { try { return getDuplicationKey(getAvps().getAvp(Avp.ORIGIN_HOST).getDiameterIdentity(), getEndToEndIdentifier()); } catch (AvpDataException e) { throw new IllegalArgumentException(e); } }
@Override public String getOriginHost() throws AvpDataException { Avp originHostAvp = message.getAvps().getAvp(ORIGIN_HOST); if (originHostAvp != null) { return originHostAvp.getDiameterIdentity(); } else { throw new AvpDataException("Avp ORIGIN_HOST not found"); } }
@Override public String getDestinationHost() throws AvpDataException { Avp destHostAvp = message.getAvps().getAvp(DESTINATION_HOST); if (destHostAvp != null) { return destHostAvp.getDiameterIdentity(); } else { throw new AvpDataException("Avp DESTINATION_HOST not found"); } }
@Override public String getDestinationRealm() throws AvpDataException { Avp destRealmAvp = message.getAvps().getAvp(DESTINATION_REALM); if (destRealmAvp != null) { return destRealmAvp.getDiameterIdentity(); } else { throw new AvpDataException("Avp DESTINATION_REALM not found"); } } }
@Override public String getOriginRealm() throws AvpDataException { Avp originRealmAvp = message.getAvps().getAvp(ORIGIN_REALM); if (originRealmAvp != null) { return originRealmAvp.getDiameterIdentity(); } else { throw new AvpDataException("Avp ORIGIN_REALM not found"); } }
protected void send(Event.Type type, AppEvent event) throws InternalException { //This is called from app thread, it may be due to callback from our delivery thread, but we dont care try { sendAndStateLock.lock(); if (type != null) { handleEvent(new Event(type, event)); } session.send(event.getMessage(), this); // Store last destination information AvpSet avps = event.getMessage().getAvps(); Avp destRealmAvp = avps.getAvp(Avp.DESTINATION_REALM); if (destRealmAvp != null) { sessionData.setDestinationRealm(destRealmAvp.getDiameterIdentity()); } Avp destHostAvp = avps.getAvp(Avp.DESTINATION_HOST); if (destHostAvp != null) { sessionData.setDestinationHost(destHostAvp.getDiameterIdentity()); } } catch (Exception e) { throw new InternalException(e); } finally { sendAndStateLock.unlock(); } }
protected void send(Event.Type type, AppEvent event) throws InternalException { //This is called from app thread, it may be due to callback from our delivery thread, but we dont care try { sendAndStateLock.lock(); if (type != null) { handleEvent(new Event(type, event)); } session.send(event.getMessage(), this); // Store last destination information AvpSet avps = event.getMessage().getAvps(); Avp destRealmAvp = avps.getAvp(Avp.DESTINATION_REALM); if (destRealmAvp != null) { sessionData.setDestinationRealm(destRealmAvp.getDiameterIdentity()); } Avp destHostAvp = avps.getAvp(Avp.DESTINATION_HOST); if (destHostAvp != null) { sessionData.setDestinationHost(destHostAvp.getDiameterIdentity()); } } catch (Exception e) { throw new InternalException(e); } finally { sendAndStateLock.unlock(); } }
@Override public void sendAccountRequest(RfAccountingRequest accountRequest) throws InternalException, IllegalStateException, RouteException, OverloadException { try { sendAndStateLock.lock(); handleEvent(new Event(accountRequest)); try { session.send(accountRequest.getMessage(), this); // Store last destination information sessionData.setDestinationRealm(accountRequest.getMessage().getAvps().getAvp(Avp.DESTINATION_REALM).getDiameterIdentity()); Avp destHostAvp = accountRequest.getMessage().getAvps().getAvp(Avp.DESTINATION_HOST); if (destHostAvp != null) { sessionData.setDestinationHost(destHostAvp.getDiameterIdentity()); } } catch (Throwable t) { logger.debug("Failed to send ACR.", t); handleEvent(new Event(Event.Type.FAILED_SEND_RECORD, accountRequest)); } } catch (Exception exc) { throw new InternalException(exc); } finally { sendAndStateLock.unlock(); } }
@Override public void sendAccountRequest(AccountRequest accountRequest) throws InternalException, IllegalStateException, RouteException, OverloadException { try { sendAndStateLock.lock(); handleEvent(new Event(accountRequest)); try { session.send(accountRequest.getMessage(), this); // Store last destination information sessionData.setDestinationRealm(accountRequest.getMessage().getAvps().getAvp(Avp.DESTINATION_REALM).getDiameterIdentity()); Avp destHostAvp = accountRequest.getMessage().getAvps().getAvp(Avp.DESTINATION_HOST); if (destHostAvp != null) { sessionData.setDestinationHost(destHostAvp.getDiameterIdentity()); } } catch (Throwable t) { logger.debug("Failed to send ACR.", t); handleEvent(new Event(Event.Type.FAILED_SEND_RECORD, accountRequest)); } } catch (Exception exc) { throw new InternalException(exc); } finally { sendAndStateLock.unlock(); } }
destinationHost = new DiameterIdentity(avp.getDiameterIdentity()); destinationRealm = new DiameterIdentity(avp.getDiameterIdentity());
private DiameterActivity createActivity(final Message message) throws CreateActivityException { DiameterActivity activity = activities.get(getActivityHandle(message.getSessionId())); if (activity == null) { if (message.isRequest()) { return createGxServerSessionActivity((Request) message); } else { final AvpSet avps = message.getAvps(); Avp avp = null; DiameterIdentity destinationHost = null; DiameterIdentity destinationRealm = null; if ((avp = avps.getAvp(Avp.DESTINATION_HOST)) != null) { try { destinationHost = new DiameterIdentity(avp.getDiameterIdentity()); } catch (AvpDataException e) { tracer.severe("Failed to extract Destination-Host from Message.", e); } } if ((avp = avps.getAvp(Avp.DESTINATION_REALM)) != null) { try { destinationRealm = new DiameterIdentity(avp.getDiameterIdentity()); } catch (AvpDataException e) { tracer.severe("Failed to extract Destination-Realm from Message.", e); } } return (DiameterActivity) createGxClientSessionActivity(destinationHost, destinationRealm); } } return activity; }
destinationHost = new DiameterIdentity(avp.getDiameterIdentity()); destinationRealm = new DiameterIdentity(avp.getDiameterIdentity());
destinationHost = new DiameterIdentity(avp.getDiameterIdentity()); destinationRealm = new DiameterIdentity(avp.getDiameterIdentity());
destinationHost = new DiameterIdentity(avp.getDiameterIdentity()); destinationRealm = new DiameterIdentity(avp.getDiameterIdentity());