Examples of VoiceManager


Examples of com.sun.mpk20.voicelib.app.VoiceManager

  logger.finer("got status " + status);

        WonderlandClientSender sender = WonderlandContext.getCommsManager().getSender(
      CellChannelConnectionType.CLIENT_TYPE);

  VoiceManager vm = AppContext.getManager(VoiceManager.class);

  Call externalCall = null;

  if (listing.getExternalCallID() != null) {
      externalCall = vm.getCall(listing.getExternalCallID());
  }

  Call softphoneCall = vm.getCall(listing.getSoftphoneCallID());

  logger.fine("external call:  " + externalCall);
  logger.fine("softphone call:  " + softphoneCall);

        switch(status.getCode()) {
        case CallStatus.INVITED:
            //The call has been placed, the phone should be ringing
            /** HARRISDEBUG: It should be tested whether or not we'll catch
             * callStatus changes for calls which we've just set up.
             * If not, this code will have to be moved back to the
             * "messageReceived->PlaceCall" function.
             **/
            if (listing.isPrivate()) {
                //Start playing the phone ringing sound                   
    try {
                    softphoneCall.playTreatment("ring_tone.au");
          } catch (IOException e) {
        logger.warning("Unable to play treatment " + softphoneCall + ":  "
            + e.getMessage());
          }
            }
           
            sender.send(clientID, new CallInvitedResponseMessage(cellID, listing, true));
            break;

        //Something's picked up, the call has been connected
        case CallStatus.ESTABLISHED:
            if (listing.isPrivate()) {
                //Stop playing the phone ringing sound
    try {
                    softphoneCall.stopTreatment("ring_tone.au");
          } catch (IOException e) {
        logger.warning("Unable to stop treatment " + softphoneCall + ":  "
            + e.getMessage());
          }
            }

            sender.send(clientID, new CallEstablishedResponseMessage(cellID, listing, true));
            break;

        case CallStatus.ENDED:
      if (ended) {
    return;
      }

      ended = true;
 
      vm.removeCallStatusListener(this);

            //Stop the ringing
      if (softphoneCall != null) {
          try {
                    softphoneCall.stopTreatment("ring_tone.au");
          } catch (IOException e) {
        logger.warning(
      "Unable to stop treatment " + softphoneCall + ":  "
          + e.getMessage());
          }
      }
               
            String softphoneCallID = listing.getSoftphoneCallID();
               
            //This may appear redundant, but it's necessary for the VoiceManager
      // to remove its internal data structures.

            if (listing.simulateCalls() == false) {
    if (externalCall != null) {
        try {
                        vm.endCall(externalCall, true);
              } catch (IOException e) {
            logger.warning(
          "Unable to end call " + externalCall + ":  "
                + e.getMessage());
              }
    }

                if (listing.isPrivate()) {
        String audioGroupId = softphoneCallID + "_"
            + listing.getPrivateClientName();

        AudioGroup audioGroup = vm.getAudioGroup(audioGroupId);

        if (audioGroup != null) {
            if (softphoneCall.getPlayer() != null) {
                softphoneCall.getPlayer().attenuateOtherGroups(audioGroup,
              AudioGroup.DEFAULT_SPEAKING_ATTENUATION,
                  AudioGroup.DEFAULT_LISTEN_ATTENUATION);
            }

                  vm.removeAudioGroup(audioGroup);
        }
    }
            }
               
            sender.send(clientID, new CallEndedResponseMessage(cellID,
View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

    public static IncomingCallHandler getInstance() {
  if (incomingCallHandler != null) {
      return incomingCallHandler;
  }

  VoiceManager vm = AppContext.getManager(VoiceManager.class);

  incomingCallHandler = new IncomingCallHandler();

  vm.addCallStatusListener(incomingCallHandler);

  vm.addCallBeginEndListener(incomingCallHandler);

  return incomingCallHandler;
    }
View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

  return incomingCallHandler;
    }

    public void done() {
  VoiceManager vm = AppContext.getManager(VoiceManager.class);
  vm.removeCallStatusListener(incomingCallHandler);
  vm.removeCallBeginEndListener(incomingCallHandler);
    }
View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

  }

  /*
   * New incoming call
   */
  VoiceManager vm = AppContext.getManager(VoiceManager.class);
 
  CallSetup setup = new CallSetup();
  setup.incomingCall = true;

  setup.cp = new CallParticipant()
  setup.cp.setCallId(callId);
  setup.cp.setConferenceId(vm.getVoiceManagerParameters().conferenceId);

  String callInfo = status.getCallInfo();

  /*
   * When a call is internal from our PBX caller ID is
   *
   * <last name>,<first name>@<10 digit phone number>@<gateway IP address>
   *
   * When we get a call from an outside line, the caller ID is
   *
   * sip:<10 digit phone number>@<gateway IP address>@<10 digit phone number>@<gateway IP address>
   */
  String name;
  String phoneNumber;

  if (callInfo.startsWith("sip:")) {
      callInfo = callInfo.substring(4);
      String[] tokens = callInfo.split("@");

      name = tokens[0];
      phoneNumber = callInfo;
  } else {
      int ix = callInfo.indexOf("@");

      if (ix > 0) {
          name = callInfo.substring(0, ix);

          String[] tokens = name.split(",");

          if (tokens.length == 2) {
        name = tokens[1] + " " + tokens[0];
          } else {
        name = callInfo;
          }

          phoneNumber = callInfo.substring(ix + 1);
      } else {
    name = callInfo;
    phoneNumber = callInfo;
      }
  }

  setup.cp.setPhoneNumber(phoneNumber);
  setup.cp.setName(name);

  Call call;

  try {
      call = vm.createCall(callId, setup);
  } catch (IOException e) {
      logger.warning("Unable to create call " + callId + ": " + e.getMessage());
      return;
  }

View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

    setup.y = location.getY();
    setup.z = location.getZ();
    setup.isOutworlder = true;
    setup.isLivePlayer = true;

    VoiceManager vm = AppContext.getManager(VoiceManager.class);

    Player externalPlayer = vm.createPlayer(call.getId(), setup);

    call.setPlayer(externalPlayer);
    externalPlayer.setCall(call);

    VoiceManagerParameters parameters = vm.getVoiceManagerParameters();

                AudioGroup defaultLivePlayerAudioGroup = parameters.livePlayerAudioGroup;

                AudioGroupPlayerInfo groupInfo = new AudioGroupPlayerInfo(true,
                    AudioGroupPlayerInfo.ChatType.PUBLIC);
View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

         * Set a private spatializer for the given fullVolume radius
         * for all the other avatars in the cell.
         * For each cell already in the cell, set a private spatializer
         * for this cell.
         */
        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        Player player = vm.getPlayer(callId);

        logger.warning(callId + " entered cone " + name + " player " + player);

        if (player == null) {
            logger.warning("Can't find player for " + callId);
            return;
        }

        AudioGroup audioGroup = vm.getAudioGroup(name);

        if (audioGroup == null) {
      AudioGroupSetup setup = new AudioGroupSetup();

      setup.audioGroupListener = this;

      setup.spatializer = new FullVolumeSpatializer();

            setup.spatializer.setAttenuator(Spatializer.DEFAULT_MAXIMUM_VOLUME);

      //System.out.println("Creating audio group for " + name);

      audioGroup = vm.createAudioGroup(name, setup);
        }

  //System.out.println("CONE PROX Player:  " + player);

  boolean isSpeaking = (inPrivateChat(audioGroup, player) == false);
View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

    }

    private void cellExited(String callId) {
        logger.warning(callId + " exited cone " + name + " avatar cell ID " + callId);

        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        AudioGroup audioGroup = vm.getAudioGroup(name);

        if (audioGroup == null) {
            logger.warning("No audio group " + name);
            return;
        }

        Player player = vm.getPlayer(callId);

        if (player == null) {
            logger.warning("Can't find player for " + callId);
            return;
        }
View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

      sender.send(new ConeOfSilenceEnterExitMessage(name, player.getId(), false));
  }
    }

    public void remove() {
        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        AudioGroup audioGroup = vm.getAudioGroup(name);

  logger.warning("Remove " + audioGroup + " name " + name);

  if (audioGroup == null) {
      return;
  }

  vm.removeAudioGroup(audioGroup);
    }
View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

                                                     1000);

            return;
        }

        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        TreatmentGroup group = null;

  if (groupId != null && groupId.length() > 0) {
      group = vm.createTreatmentGroup(groupId);
  }
 
        for (int i = 0; i < treatments.length; i++) {
            TreatmentSetup setup = new TreatmentSetup();

      setup.treatmentCreatedListener = new TreatmentCreatedListenerImpl(cellID);

      setup.spatializer = getSpatializer(false);

            String treatment = treatments[i];

            String treatmentId = CallID.getCallID(cellID);

      String pattern = "wlcontent://";

            if (treatment.startsWith(pattern)) {
                /*
                 * We need to create a URL
                 */
                String path = treatment.substring(pattern.length());

                URL url;

                try {
                    path = path.replaceAll(" ", "%20");

                    url = new URL(new URL(serverURL), "webdav/content/" + path);

                    treatment = url.toString();
                } catch (MalformedURLException e) {
                    logger.warning("bad url:  " + e.getMessage());
                    return;
    }
      } else {
          pattern = "wls://";

          if (treatment.startsWith(pattern)) {
                    /*
                     * We need to create a URL from wls:<module>/path
                     */
                    treatment = treatment.substring(pattern.length())// skip past wls://

                    int ix = treatment.indexOf("/");

                    if (ix < 0) {
                        logger.warning("Bad treatment:  " + treatments[i]);
                        continue;
                    }

                    String moduleName = treatment.substring(0, ix);

                    String path = treatment.substring(ix + 1);

                    logger.fine("Module:  " + moduleName + " treatment " + treatment);

                    URL url;

                    try {
      path = path.replaceAll(" ", "%20");

                        url = new URL(new URL(serverURL),
                            "webdav/content/modules/installed/" + moduleName + "/audio/" + path);

                        treatment = url.toString();
                        logger.fine("Treatment: " + treatment);
                    } catch (MalformedURLException e) {
                        logger.warning("bad url:  " + e.getMessage());
                        continue;
                    }
                }
      }

            setup.treatment = treatment;

      vm.addCallStatusListener(this, treatmentId);

            if (setup.treatment == null || setup.treatment.length() == 0) {
                logger.warning("Invalid treatment '" + setup.treatment + "'");
                continue;
            }

            // OWL issue #60: make sure to use world location, not local
            // location
            Vector3f location = cellRef.get().getWorldTransform(null).getTranslation(null);

            setup.x = location.getX();
            setup.y = location.getY();
            setup.z = location.getZ();

            // do we need to start paused?
            if (playWhen.equals(PlayWhen.ALWAYS) == false) {
                setup.startPaused = true;
            }
           
            logger.info("Starting treatment " + setup.treatment + " at (" + setup.x
    + ":" + setup.y + ":" + setup.z + ")");

            System.out.println("Starting treatment " + setup.treatment + " at (" + setup.x
    + ":" + setup.y + ":" + setup.z + ")");
 
            try {
    Treatment t = vm.createTreatment(treatmentId, setup);

    if (group != null) {
                    group.addTreatment(t);
    }

View Full Code Here

Examples of com.sun.mpk20.voicelib.app.VoiceManager

      }

      parent = parent.getParent();
  }

        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        TreatmentGroup group = null;

  if (groupId != null) {
      group = vm.getTreatmentGroup(groupId);
  }

  if (group == null) {
      Treatment treatment = vm.getTreatment(CallID.getCallID(cellID));

      if (treatment == null) {
      //System.out.println("No treatment for " + CallID.getCallID(cellID));
    return;
      }

      endTreatment(treatment);
      return;
  }

  Treatment[] treatments = group.getTreatments().values().toArray(new Treatment[0]);

  for (int i = 0; i < treatments.length; i++) {
      //System.out.println("Ending treatment:  " + treatments[i]);
      endTreatment(treatments[i]);
      group.removeTreatment(treatments[i]);
  }

  try {
      vm.removeTreatmentGroup(group);
  } catch (IOException e) {
      logger.warning("Unable to remove treatment group " + group);
  }

  vm.dump("all");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.