Example #1
0
  /** Mute or unmute the main conference from a particular call. */
  public static void setConferenceSilenced(String callId, boolean isSilenced) {
    synchronized (activeCalls) {
      for (int i = 0; i < activeCalls.size(); i++) {
        CallHandler call = (CallHandler) activeCalls.elementAt(i);

        CallParticipant cp = call.getCallParticipant();

        if (match(cp, callId)) {
          if (Logger.logLevel >= Logger.LOG_DETAIL) {
            String s = "";

            if (isSilenced == false) {
              s = "un";
            }

            Logger.println(cp.getCallId() + ":  silenceMainonference " + s + "muted");
          }

          ConferenceMember member = call.getMember();

          if (member != null) {
            member.setConferenceSilenced(isSilenced);
          }
        }
      }
    }
  }
Example #2
0
  /** Mute or unmute member in a whisperGroup */
  public static void setMuteWhisperGroup(String callId, boolean isMuted) {
    if (callId == null) {
      return;
    }

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

        CallParticipant cp = call.getCallParticipant();

        if (match(cp, callId)) {
          if (Logger.logLevel >= Logger.LOG_DETAIL) {
            String s = "";

            if (isMuted == false) {
              s = "un";
            }
            Logger.println(cp.getCallId() + ":  " + s + "muted");
          }

          MemberReceiver memberReceiver = call.getMemberReceiver();

          if (memberReceiver != null) {
            memberReceiver.setMuteWhisperGroup(isMuted);
          }
        }
      }
    }
  }
Example #3
0
  /**
   * Find a call by callId.
   *
   * <p>Calls are kept in the activeCalls list and uniquely identified by
   * <callId>::<name>@<phoneNumber> for a phone call and
   *
   * <p>This method searches for a call with the callId.
   */
  public static CallHandler findCall(String callId) {
    if (Logger.logLevel >= Logger.LOG_DETAIL) {
      Logger.println(
          "findCall:  looking for " + callId + ", " + activeCalls.size() + " active calls");
    }

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

        CallParticipant cp = call.getCallParticipant();

        if (Logger.logLevel >= Logger.LOG_DETAIL) {
          Logger.println("findCall:  looking for " + callId + " got " + cp.getCallId());
        }

        if (match(cp, callId)) {
          if (Logger.logLevel >= Logger.LOG_DETAIL) {
            Logger.println("findCall:  found " + callId);
          }

          return call;
        }
      }
    }
    return null;
  }
Example #4
0
  public void sendCallEventNotification(CallEvent callEvent) {
    if (cp.getCallId() != null) {
      callEvent.setCallId(cp.getCallId());
    } else {
      callEvent.setCallId("CallIdNotInitialized");
    }

    callEvent.setConferenceId(cp.getConferenceId());

    callEvent.setCallInfo(cp.getCallOwner());

    if (csa != null) {
      callEvent.setCallState(csa.getCallState());
    } else {
      callEvent.setCallState(new CallState(CallState.UNINITIALIZED));
    }

    synchronized (callEventListeners) {
      for (int i = 0; i < callEventListeners.size(); i++) {
        CallEventListener listener = (CallEventListener) callEventListeners.elementAt(i);
        listener.callEventNotification(callEvent);
      }
    }
  }
Example #5
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;
  }
Example #6
0
  public TreatmentManager playTreatmentToCall(
      String treatment, TreatmentDoneListener treatmentDoneListener) throws IOException {

    if (Logger.logLevel >= Logger.LOG_MOREINFO) {
      Logger.println("Playing treatment " + treatment + " to " + cp.getCallId());
    }

    TreatmentManager treatmentManager =
        new TreatmentManager(
            treatment,
            0,
            conferenceManager.getMediaInfo().getSampleRate(),
            conferenceManager.getMediaInfo().getChannels());

    if (treatmentDoneListener != null) {
      treatmentManager.addTreatmentDoneListener(treatmentDoneListener);
    }

    addTreatment(treatmentManager);
    return treatmentManager;
  }
Example #7
0
  /** Set flag to do voice detection while muted */
  public static void setVoiceDetectionWhileMuted(String callId, boolean voiceDetectionWhileMuted) {

    if (callId == null) {
      return;
    }

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

        CallParticipant cp = call.getCallParticipant();

        if (match(cp, callId)) {
          cp.setVoiceDetectionWhileMuted(voiceDetectionWhileMuted);

          if (Logger.logLevel >= Logger.LOG_DETAIL) {
            Logger.println(
                cp.getCallId() + " voice detection while muted is " + voiceDetectionWhileMuted);
          }
        }
      }
    }
  }