/** Returns a sublist of enabled gateways for this dialing rule. */ public List<Gateway> getEnabledGateways() { ArrayList<Gateway> enabled = new ArrayList<Gateway>(m_gateways.size()); for (Gateway gateway : m_gateways) { if (gateway.isEnabled()) { enabled.add(gateway); } } return enabled; }
@Override public Transform[] getTransforms() { CallPattern patternNormal = new CallPattern(StringUtils.EMPTY, CallDigits.VARIABLE_DIGITS); String user = patternNormal.calculatePattern(); List<Gateway> gateways = getGateways(); List<Transform> transforms = new ArrayList<Transform>(gateways.size()); ForkQueueValue q = new ForkQueueValue(gateways.size()); for (Gateway gateway : gateways) { FullTransform transform = new FullTransform(); transform.setUser(gateway.getCallPattern(user)); transform.setHost(gateway.getGatewayAddress()); String transport = gateway.getGatewayTransportUrlParam(); if (transport != null) { transform.setUrlParams(transport); } String[] fieldParams = new String[] {q.getSerial()}; transform.setFieldParams(fieldParams); transforms.add(transform); } return transforms.toArray(new Transform[transforms.size()]); }
/** * Attempts to apply standard transformations to patterns. It is used when generating * authorization rules For example 9xxxx -> 7{digits} results in 97xxxx * * <p>Default implementation inserts gateway specific prefixes. */ public String[] getTransformedPatterns(Gateway gateway) { String[] patterns = getPatterns(); String[] transformed = new String[patterns.length]; for (int i = 0; i < patterns.length; i++) { if (gateway != null) { transformed[i] = gateway.getCallPattern(patterns[i]); } else { transformed[i] = patterns[i]; } } return transformed; }