Examples of Call


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

        CallListing listing = msg.getCallListing();
             
  String externalCallID = getExternalCallID(listing);

  Call externalCall = vm.getCall(externalCallID);

  Player externalPlayer = null;

  if (externalCall != null) {
      externalPlayer = externalCall.getPlayer();
  }

  String softphoneCallID = listing.getSoftphoneCallID();

  Call softphoneCall = null;

  Player softphonePlayer = null;

  AudioGroup audioGroup = null;

  String audioGroupId = null;

  VoiceManagerParameters parameters = vm.getVoiceManagerParameters();

  if (softphoneCallID != null) {
      softphoneCall = vm.getCall(softphoneCallID);

      if (softphoneCall != null) {
          softphonePlayer = softphoneCall.getPlayer();
      }
       
      audioGroupId = softphoneCallID + "_" + externalCallID;

      audioGroup = vm.getAudioGroup(audioGroupId);
  }

  logger.fine("EXTERNAL CALLID IS " + externalCallID + " " + msg
      + " softphone callID " + softphoneCallID + " softphone call "
      + softphoneCall + " softphone player " + softphonePlayer);

  if (message instanceof PlayTreatmentMessage) {
      PlayTreatmentMessage m = (PlayTreatmentMessage) message;

      logger.fine("play treatment " + m.getTreatment()
    + " to " + listing.getExternalCallID() + " echo " + m.echo());

            if (listing.simulateCalls() == true) {
    return;
      }

      try {
    externalCall.playTreatment(m.getTreatment());
      } catch (IOException e) {
    logger.warning("Unable to play treatment to " + externalCall + ":  "
        + e.getMessage());
      }

      if (m.echo() == false) {
    return;
      }

      logger.fine("echoing treatment to " + softphoneCallID);

      try {
    softphoneCall.playTreatment(m.getTreatment());
      } catch (IOException e) {
    logger.warning("Unable to play treatment to " + softphoneCall + ":  "
        + e.getMessage());
    sender.send(clientID, new CallEndedResponseMessage(
                    phoneCellMO.getCellID(), listing, true, "Softphone is not connected!"));
                return;
      }

      return;
  }

  if (msg instanceof PlaceCallMessage) {
            //Our phone cell is asking us to begin a new call.

      if (listing.simulateCalls() == false) {
    relock(sender);
      }

      logger.fine("Got place call message " + externalCallID);

      PlayerSetup playerSetup = new PlayerSetup();
      //playerSetup.x =  translation.x;
      //playerSetup.y =  translation.y;
      //playerSetup.z =  translation.z;
      playerSetup.isOutworlder = true;
      playerSetup.isLivePlayer = true;

            if (listing.simulateCalls() == false) {
          PhoneStatusListener phoneStatusListener =
        new PhoneStatusListener(phoneCellMO, listing, clientID);

          if (softphoneCall == null || softphonePlayer == null) {
        logger.warning("Softphone player is not connected!");
                  sender.send(clientID, new CallEndedResponseMessage(
      phoneCellMO.getCellID(), listing, false,
      "Softphone is not connected!"));
        return;
          }

    CallSetup setup = new CallSetup();
 
    CallParticipant cp = new CallParticipant();

    setup.cp = cp;

    setup.externalOutgoingCall = true;

    try {
        setup.bridgeInfo = vm.getVoiceBridge();
     } catch (IOException e) {
        logger.warning("Unable to get voice bridge for call " + cp + ":  "
      + e.getMessage());
        return;
    }

    cp.setPhoneNumber(listing.getContactNumber());
    cp.setName(listing.getContactName());
    cp.setCallId(externalCallID);
    cp.setConferenceId(parameters.conferenceId);
    cp.setVoiceDetection(true);
    cp.setDtmfDetection(true);
    cp.setVoiceDetectionWhileMuted(true);
    cp.setHandleSessionProgress(true);

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

        externalPlayer = vm.createPlayer(externalCallID, playerSetup);

    externalCall.setPlayer(externalPlayer);

    externalPlayer.setCall(externalCall);

                if (listing.isPrivate()) {
        /*
         * Allow caller and callee to hear each other
         */
        AudioGroupSetup audioGroupSetup = new AudioGroupSetup();
        audioGroupSetup.spatializer = new FullVolumeSpatializer();

        audioGroup = vm.createAudioGroup(audioGroupId, audioGroupSetup);
        audioGroup.addPlayer(externalPlayer,
            new AudioGroupPlayerInfo(true,
            AudioGroupPlayerInfo.ChatType.EXCLUSIVE));
        audioGroup.addPlayer(softphonePlayer,
            new AudioGroupPlayerInfo(true,
            AudioGroupPlayerInfo.ChatType.EXCLUSIVE));
    } else {
        AudioGroup defaultLivePlayerAudioGroup =
            parameters.livePlayerAudioGroup;

        defaultLivePlayerAudioGroup.addPlayer(externalPlayer,
            new AudioGroupPlayerInfo(true,
            AudioGroupPlayerInfo.ChatType.PUBLIC));

        AudioGroup defaultStationaryPlayerAudioGroup =
            parameters.stationaryPlayerAudioGroup;

        defaultStationaryPlayerAudioGroup.addPlayer(externalPlayer,
            new AudioGroupPlayerInfo(false,
            AudioGroupPlayerInfo.ChatType.PUBLIC));
    }

    logger.fine("done with audio groups");
            }
           
      if (externalCall != null) {
          externalCallID = externalCall.getId();
      }

      logger.fine("Setting actual call id to " + externalCallID);

      listing.setExternalCallID(externalCallID)// set actual call Id

            //Check implicit privacy settings
            if (listing.isPrivate()) {
                /** HARRISNOTE: We need our client name later in order to
                 * setup private spatializers. But because we didn't know
                 * our proper client name in the PhoneCell, we update the
                 * callListing now that we do.
                 **/
    listing.setPrivateClientName(externalCallID);

                /*
     * Set the call audio to whisper mode until the caller
     * chooses to join the call.
     */
                if (listing.simulateCalls() == false) {
                    //Mute the two participants to the outside world
                    logger.fine("attenuate other groups");
        softphonePlayer.attenuateOtherGroups(audioGroup, 0, 0);
                    logger.fine("back from attenuate other groups");
                }
            } else {
    Vector3f center = new Vector3f();

    phoneCellMO.getWorldBounds().getCenter(center);

          center.setY((float).5);

                new Orb(listing.getContactName(), listing.getContactName(),
        externalCallID, center, .1, listing.simulateCalls());
      }

            if (listing.simulateCalls() == false) {
                //Place the calls audio at the phones position
             Vector3f location = new Vector3f();

                location = phoneCellMO.getWorldTransform(null).getTranslation(location);

                externalPlayer.moved(location.x, location.y, location.z, 0);
            }
         
            /*
       * Send PLACE_CALL_RESPONSE message back to all the clients
       * to signal success.
       */
            sender.send(clientID, new PlaceCallResponseMessage(
    phoneCellMO.getCellID(), listing, true));

      logger.fine("back from notifying user");
      return;
  }

  if (msg instanceof JoinCallMessage) {
            //Our phone cell wants us to join the call into the world.
           
            if (listing.simulateCalls() == false) {
                //Stop any current ringing.
          try {
                    softphoneCall.stopTreatment("ring_tone.au");
          } catch (IOException e) {
        logger.fine("Unable to stop treatment to " + softphoneCall + ":  "
            + e.getMessage());
          }

View Full Code Here

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

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

  AudioGroup audioGroup;

  Call call = vm.getCall(callId);

  Player player = vm.getPlayer(callId);

  AudioGroup secretAudioGroup;

  WonderlandClientSender sender = WonderlandContext.getCommsManager().getSender(AudioManagerConnectionType.CONNECTION_TYPE);

  switch (code) {
  case CallStatus.ESTABLISHED:
      if (player == null) {
    logger.warning("Couldn't find player for " + status);
    return;
      }

      //vm.dump("all");
      player.setPrivateMixes(true);

      sender.send(new CallEstablishedMessage(callID));
      break;

  case CallStatus.MUTED:
      sender.send(new CallMutedMessage(callID, true));
      break;

  case CallStatus.UNMUTED:
      sender.send(new CallMutedMessage(callID, false));
      break;

        case CallStatus.STARTEDSPEAKING:
      if (player == null) {
    logger.warning("Couldn't find player for " + status);
    return;
      }

      secretAudioGroup = getSecretAudioGroup(player);

      if (playerIsChatting(player)) {
    VoiceChatHandler.getInstance().setSpeaking(player, callID, true, secretAudioGroup);
      }

      if (secretAudioGroup != null) {
    return;
      }

      sender.send(new CallSpeakingMessage(callID, true));
            break;

        case CallStatus.STOPPEDSPEAKING:
      if (player == null) {
    logger.warning("Couldn't find player for " + status);
    return;
      }

      secretAudioGroup = getSecretAudioGroup(player);

      if (playerIsChatting(player)) {
    VoiceChatHandler.getInstance().setSpeaking(player, callID, false, secretAudioGroup);
      }

      if (secretAudioGroup != null) {
    return;
      }

      sender.send(new CallSpeakingMessage(callID, false));
            break;

  case CallStatus.MIGRATED:
      if (isExternalCall) {
    return;
      }

      sender = WonderlandContext.getCommsManager().getSender(CellChannelConnectionType.CLIENT_TYPE);
      sender.send(clientID, new CallMigrateMessage(callID, true));
      break;

  case CallStatus.MIGRATE_FAILED:
      if (isExternalCall) {
    return;
      }

      sender.send(clientID, new CallMigrateMessage(callID, false));
      break;

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

if (false) {
      if (player != null) {
          AudioGroup[] audioGroups = player.getAudioGroups();

          for (int i = 0; i < audioGroups.length; i++) {
        audioGroups[i].removePlayer(player);
          }

    if (player.getSetup().isOutworlder) {
              vm.removePlayer(player);
    }
      } else {
    logger.warning("Couldn't find player for " + status);
      }
}

      done();
      sender.send(new CallEndedMessage(callID, status.getOption("Reason")));
            break;
   
  case CallStatus.BRIDGE_OFFLINE:
            logger.info("Bridge offline: " + status);
    // XXX need a way to tell the voice manager to reset all of the private mixes.
      Call c = vm.getCall(callId);

      if (callId == null || callId.length() == 0) {
                /*
                 * After the last BRIDGE_OFFLINE notification
                 * we have to tell the voice manager to restore
                 * all the pm's for live players.
                 */
                logger.fine("Restoring private mixes...");
      } else {
    if (c == null) {
        logger.warning("No call for " + callId);
        break;
    }

    Player p = c.getPlayer();

    if (p == null) {
        logger.warning("No player for " + callId);
        break;
    }

    try {
        c.end(true);
    } catch (IOException e) {
        logger.warning("Unable to end call " + callId);
    }

    try {
        AudioManagerConnectionHandler.setupCall(
       callId, c.getSetup(), -p.getX(), p.getY(), p.getZ(), p.getOrientation());
    } catch (IOException e) {
        logger.warning("Unable to setupCall " + c + " "
      + e.getMessage());
    }
      }
View Full Code Here

Examples of com.twilio.sdk.resource.instance.Call

  /* (non-Javadoc)
   * @see com.twilio.sdk.resource.ListResource#makeNew(com.twilio.sdk.TwilioRestClient, java.util.Map)
   */
  @Override
  protected Call makeNew(TwilioRestClient client, Map<String, Object> params) {
    return new Call(client, params);
  }
View Full Code Here

Examples of com.wordpress.salaboy.model.Call

        ContextTrackingProvider.configFile = "local-config-beans.xml";
        PersistenceService persistenceService = PersistenceServiceProvider.getPersistenceService();
        ContextTrackingService trackingService = ContextTrackingProvider.getTrackingService();
       
       
        Call call = new Call(1, 1, new Date());
        persistenceService.storeCall(call);
       
        assertNotSame("", call.getId());

        call = persistenceService.loadCall(call.getId());
        assertNotNull(call);

        Emergency emergency = new Emergency();
        persistenceService.storeEmergency(emergency);
        assertNotSame("", emergency.getId());

        emergency = persistenceService.loadEmergency(emergency.getId());
        assertNotNull(emergency);
       
        trackingService.attachEmergency(call.getId(), emergency.getId());

        Procedure procedure = new Procedure("MyProcedure");
        persistenceService.storeProcedure(procedure);
        assertNotSame("", procedure.getId());

        procedure = persistenceService.loadProcedure(procedure.getId());
        assertNotNull(procedure);

        trackingService.attachProcedure(emergency.getId(), procedure.getId());


        Vehicle vehicle = new Ambulance();

        persistenceService.storeVehicle(vehicle);
        assertNotSame("", vehicle.getId());

        vehicle = persistenceService.loadVehicle(vehicle.getId());
        assertNotNull(vehicle);


        trackingService.attachVehicle(procedure.getId(), vehicle.getId());

        Vehicle vehicle2 = new FireTruck();
        persistenceService.storeVehicle(vehicle2);
        assertNotSame("", vehicle2.getId());

        vehicle2 = persistenceService.loadVehicle(vehicle2.getId());
        assertNotNull(vehicle2);

        trackingService.attachVehicle(procedure.getId(), vehicle2.getId());

        ServiceChannel channel = new ServiceChannel("MyChannel");
        persistenceService.storeServiceChannel(channel);
        assertNotSame("", channel.getId());
       
        channel = persistenceService.loadServiceChannel(channel.getId());
        assertNotNull(channel);
       
        trackingService.attachServiceChannel(emergency.getId(), channel.getId());


        CypherParser parser = new CypherParser();
        ExecutionEngine engine = new ExecutionEngine(trackingService.getGraphDb());


        //Give me all the vehicle associated with the procedures that are part of the emergency that was created by this phoneCallId
        Query query = parser.parse("start n=(calls, 'callId:" + call.getId() + "')  match (n)-[r:CREATES]->(x)-[i:INSTANTIATE]-> (w) -[u:USE]->v  return v");

        ExecutionResult result = engine.execute(query);
        Iterator<Node> n_column = result.columnAs("v");

View Full Code Here

Examples of com.wordpress.salaboy.model.Call

        PersistenceServiceProvider.configFile = "remote-config-beans.xml";
        ContextTrackingProvider.configFile = "remote-config-beans.xml";
        PersistenceService persistenceService = PersistenceServiceProvider.getPersistenceService();
        ContextTrackingService trackingService = ContextTrackingProvider.getTrackingService();
        Call call = new Call(1, 1, new Date());
        persistenceService.storeCall(call);
       
        assertNotSame("", call.getId());

        call = persistenceService.loadCall(call.getId());
        assertNotNull(call);

        Emergency emergency = new Emergency();
        persistenceService.storeEmergency(emergency);
        assertNotSame("", emergency.getId());

        emergency = persistenceService.loadEmergency(emergency.getId());
        assertNotNull(emergency);
       
        trackingService.attachEmergency(call.getId(), emergency.getId());

        Procedure procedure = new Procedure("MyProcedure");
        persistenceService.storeProcedure(procedure);
        assertNotSame("", procedure.getId());

        procedure = persistenceService.loadProcedure(procedure.getId());
        assertNotNull(procedure);

        trackingService.attachProcedure(emergency.getId(), procedure.getId());


        Vehicle vehicle = new Ambulance();

        persistenceService.storeVehicle(vehicle);
        assertNotSame("", vehicle.getId());

        vehicle = persistenceService.loadVehicle(vehicle.getId());
        assertNotNull(vehicle);


        trackingService.attachVehicle(procedure.getId(), vehicle.getId());

        Vehicle vehicle2 = new FireTruck();
        persistenceService.storeVehicle(vehicle2);
        assertNotSame("", vehicle2.getId());

        vehicle2 = persistenceService.loadVehicle(vehicle2.getId());
        assertNotNull(vehicle2);

        trackingService.attachVehicle(procedure.getId(), vehicle2.getId());

        ServiceChannel channel = new ServiceChannel("MyChannel");
        persistenceService.storeServiceChannel(channel);
        assertNotSame("", channel.getId());
       
        channel = persistenceService.loadServiceChannel(channel.getId());
        assertNotNull(channel);
       
        trackingService.attachServiceChannel(emergency.getId(), channel.getId());


        CypherParser parser = new CypherParser();
        ExecutionEngine engine = new ExecutionEngine(trackingService.getGraphDb());


        //Give me all the vehicle associated with the procedures that are part of the emergency that was created by this phoneCallId
        HttpClient client = new HttpClient();
        PostMethod method = new PostMethod("http://localhost:7575/db/data/ext/CypherPlugin/graphdb/execute_query");
        method.setRequestHeader("Content-type", "application/json");
        method.setRequestHeader("Accept", "application/json");
        String content = "{\"query\": \"start n=(calls, 'callId:" + call.getId() + "')  match (n)-[r:CREATES]->(x)-[i:INSTANTIATE]-> (w) -[u:USE]->v  return v\"}";
        method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
        client.executeMethod(method);
       
        Gson gson = new Gson();
View Full Code Here

Examples of com.wordpress.salaboy.model.Call

        persistenceService = PersistenceServiceProvider.getPersistenceService();
        trackingService = ContextTrackingProvider.getTrackingService();
       
        HumanTaskServerService.getInstance().initTaskServer();

        call = new Call(1, 2, new Date());
        assertEquals(0, persistenceService.getAllCalls().size());
        persistenceService.storeCall(call);
        assertEquals(1, persistenceService.getAllCalls().size());
        emergency = new Emergency();
        emergency.setCall(call);
View Full Code Here

Examples of com.wordpress.salaboy.model.Call

        addXYEmergency(EmergencyType.UNDEFINED, null, x, y);
    }
    public void addXYEmergency(EmergencyType type,Integer nroOfPeople, int x, int y){
       
        System.out.println("x = " + xs[x] + " -> y =" + ys[y]);
        Call call = new Call(x, y, new Date(System.currentTimeMillis()));
       
        PersistenceServiceProvider.getPersistenceService().storeCall(call);
       
        int callSquare[] = {1, 1, 31, 1, 31, 31, 1, 31};
        BlockMap.emergencies.add(new Block(xs[call.getX()] * 16, ys[call.getY()] * 16, callSquare, "callId:" + call.getId()));
       
        GraphicableEmergency newEmergency = null;
       
        if (type == Emergency.EmergencyType.UNDEFINED){
            newEmergency = GraphicableFactory.newGenericEmergency(call);
           
        }else{
            newEmergency = GraphicableFactory.newEmergency(call, type, nroOfPeople);
        }
       
        emergencies.put(call.getId(), newEmergency);

        renderers.put(call.getId(), new ParticularEmergencyRenderer(this,newEmergency));
       
        try {
            MessageFactory.sendMessage(new IncomingCallMessage(call));
        } catch (HornetQException ex) {
            Logger.getLogger(WorldUI.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

Examples of com.wordpress.salaboy.model.Call


        fireTruck = new FireTruck("FireTruck 1");
        persistenceService.storeVehicle(fireTruck);

        call = new Call(1, 2, new Date());
        persistenceService.storeCall(call);

        emergency.setCall(call);
        emergency.setLocation(new Location(1, 2));
        emergency.setType(Emergency.EmergencyType.FIRE);
View Full Code Here

Examples of com.wordpress.salaboy.model.Call

public class AsyncStartProcedureWorkItemHandler implements WorkItemHandler, Serializable{

    @Override
    public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
        //Call Tracking Component for process?? or the ProcedureMGMTService can take care of that?
        Call call = (Call) wi.getParameter("call");
        String procedureName = (String) wi.getParameter("procedureName");
        Emergency emergency = (Emergency) wi.getParameter("emergency");
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("call", call);
        parameters.put("emergency", emergency);
View Full Code Here

Examples of com.wordpress.salaboy.model.Call

public class StartProcedureWorkItemHandler implements WorkItemHandler, Serializable{

    @Override
    public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
        //Call Tracking Component for process?? or the ProcedureMGMTService can take care of that?
        Call call = (Call) wi.getParameter("call");
        String procedureName = (String) wi.getParameter("procedureName");
        Emergency emergency = (Emergency) wi.getParameter("emergency");
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("call", call);
        parameters.put("emergency", emergency);
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.