Beispiel #1
0
  private static boolean match(CallParticipant cp, String callId) {
    if (cp.getCallId().equals(callId)) {
      return true;
    }

    if (ConferenceManager.allowShortNames() == false) {
      return false;
    }

    String name = cp.getName();

    if (name != null) {
      if (name.equals(callId)) {
        return true;
      }

      name = name.replaceAll(" ", "_");

      if (name.equals(callId)) {
        return true;
      }
    }

    String number = cp.getPhoneNumber();

    if (number == null) {
      return false;
    }

    if (number.equals(callId)) {
      return true;
    }

    if (number.indexOf("sip:") == 0) {
      int ix = number.indexOf("@");

      if (ix >= 0) {
        number = number.substring(4, ix);

        if (number.equals(callId)) {
          return true;
        }
      }
    }

    return false;
  }
Beispiel #2
0
  /** For debugging... */
  public static boolean tooManyDuplicateCalls(String phoneNumber) {
    synchronized (activeCalls) {
      int n = 0;

      for (int i = 0; i < activeCalls.size(); i++) {
        CallHandler call = (CallHandler) activeCalls.elementAt(i);

        CallParticipant cp = call.getCallParticipant();

        if (cp.getPhoneNumber().equals(phoneNumber)) {
          n++;
        }
      }

      if (n > duplicateCallLimit) {
        return true;
      }

      return false;
    }
  }