Exemplo n.º 1
0
  private void destroyCallManagers() {

    callMgr1.destroyCallManager();
    lineHandle1 = null;
    callMgr1 = null;
    callMgr2.destroyCallManager();
    lineHandle2 = null;
    callMgr2 = null;
  }
Exemplo n.º 2
0
  private void addProvisionedLines() {
    if (lineHandle1 == null) {
      lineHandle1 =
          callMgr1.addLine("sip:foo@" + localIp + ":5080", "Display Name", false, -1, null);
      assertTrue(lineHandle1 != null);
    }

    if (lineHandle2 == null) {
      lineHandle2 = callMgr2.addLine("sip:bar@" + localIp + ":5090", "Other Name", false, -1, null);
      assertTrue(lineHandle2 != null);
    }
  }
Exemplo n.º 3
0
  private void initializeCallManagers() {
    if (callMgr1 == null) {
      callMgr1 = new CallManager();
      try {

        FlibbleResult res =
            callMgr1.initialize(
                CallManager.AUTO_DISCOVER,
                5080, // port to bind to
                9100, // start media port range
                9150, // end media port range
                proxyAddress, // domain
                proxyAddress, // proxy address
                5061, // proxy port
                null, // stun server
                "Flibble UA",
                false,
                null,
                null);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    if (callMgr2 == null) {
      callMgr2 = new CallManager();
      try {
        FlibbleResult res =
            callMgr2.initialize(
                CallManager.AUTO_DISCOVER,
                5090, // port to bind to
                9200, // start media port range
                9250, // end media port range
                proxyAddress, // domain
                proxyAddress, // proxy address
                5060, // proxy port
                null, // stun server
                "Flibble UA",
                false,
                null,
                null);
      } catch (Exception e) {
        e.printStackTrace();
      }
      callMgr1.addListener(this);
      callMgr2.addListener(this);
    }
  }
Exemplo n.º 4
0
  public Call(Context context) {
    super(context);
    color = xacInteractiveCanvas.fgColorGreen;

    CallManager.setPhone(this);

    appLayout = new RelativeLayout(context);
    appLayout.setBackgroundColor(xacInteractiveCanvas.bgColorGreen);

    //		dispatchButtons(context);
    layoutViews = new RelativeLayout(context);
    appLayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent event) {
            posture = xacPostureSenseFeatureMaker.calculatePosture();
            if (posture != xacPostureSenseFeatureMaker.NOWATCH) {
              return false;
            }

            return true;
          }
        });
    layoutViews.setId(42);
    appLayout.addView(layoutViews);

    dispatchViews(context);

    layoutCallScreen = new RelativeLayout(context);
    layoutCallScreen.setBackgroundColor(0xDD000000);
    layoutCallScreen.setBackgroundResource(R.drawable.call_out);
    layoutCallScreen.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {

            posture = xacPostureSenseFeatureMaker.calculatePosture();
            if (posture == xacPostureSenseFeatureMaker.NONE) {
              if (event.getAction() == MotionEvent.ACTION_UP) {
                layoutCallScreen.setBackgroundColor(0xDD000000);
                appLayout.removeView(layoutCallScreen);
                isCalling = false;
                isInApp = false;
              }
            } else if (posture == xacPostureSenseFeatureMaker.NOWATCH) {
              doTouch(event);
            }

            return true;
          }
        });

    sup = "5 missed calls from Tiffany";
  }
Exemplo n.º 5
0
  @Override
  public void doTouch(MotionEvent event) {
    int action = event.getAction();
    PointerCoords coord = new PointerCoords();
    event.getPointerCoords(0, coord);

    switch (action) {
      case MotionEvent.ACTION_DOWN:
        xTouchDown = coord.x;
        yTouchDown = coord.y;
        break;
      case MotionEvent.ACTION_MOVE:
        break;
      case MotionEvent.ACTION_UP:
        float dx = coord.x - xTouchDown;
        float dy = coord.y - yTouchDown;
        if (Math.abs(dx) < TAPTHRS) {
          if (Math.abs(dx) < TAPTHRS && Math.abs(dy) < TAPTHRS) {
            if (isInApp) {
              CallManager.getOutOfApp();
              isInApp = false;
            } else {
              CallManager.getInApp();
              isInApp = true;
            }
          } else if (dy > TAPTHRS) {
            //					Log.d(LOGTAG, "down");
            if (isInApp) {
              CallManager.scrollDownApp();
            } else {
              CallManager.nextAppExtension();
            }
          } else if (dy < -TAPTHRS) {
            //					Log.d(LOGTAG, "up");
            if (isInApp) {
              CallManager.scrollUpApp();
            } else {
              CallManager.lastAppExtension();
            }
          }
        } else if (Math.abs(dy) < TAPTHRS) {
          if (dx > TAPTHRS) {
            Log.d(LOGTAG, "right");
            CallManager.nextItem();
          } else {
            Log.d(LOGTAG, "left");
            CallManager.lastItem();
          }
        }
        break;
    }
  }
  private void onProfileChanged(int newProfile) {
    LinphoneCore lc = LinphoneManager.getLc();
    lc.setUploadBandwidth(bandwidthes[newProfile][0]);
    lc.setDownloadBandwidth(bandwidthes[newProfile][1]);

    if (lc.isIncall()) {
      CallManager.getInstance().reinvite();
    } else {
      updateWithProfileSettings(lc, null);
    }
  }
Exemplo n.º 7
0
  /**
   * Checks if there is a call in progress. If true then shows a warning toast and finishes the
   * activity.
   *
   * @param activity activity doing a check.
   * @return <tt>true</tt> if there is call in progress and <tt>Activity</tt> was finished.
   */
  public static boolean checkCallInProgress(Activity activity) {
    if (CallManager.getActiveCallsCount() > 0) {
      logger.warn("Call is in progress");

      Toast t =
          Toast.makeText(activity, R.string.service_gui_WARN_CALL_IN_PROGRESS, Toast.LENGTH_SHORT);
      t.show();

      activity.finish();
      return true;
    } else {
      return false;
    }
  }
Exemplo n.º 8
0
  @Test
  public void blindTransfer() {
    // initialize call managers if need be
    addProvisionedLines();

    String callHandle = callMgr1.createCall(lineHandle1, uriA);
    assertTrue(callHandle != null);
    callMgr1.placeCall(callHandle, MediaSourceType.MEDIA_SOURCE_DUMMY, null, false, 100, 100);
    boolean ret =
        waitForCallEvent(callHandle, EventCode.CALL_CONNECTED, EventReason.CALL_NORMAL, 15000);
    assertTrue(ret);

    callMgr1.blindTransfer(callHandle, uriB);
    ret =
        waitForCallEvent(
            callHandle, EventCode.CALL_TRANSFER, EventReason.CALL_TRANSFER_AS_CONTROLLER, 15000);
    assertTrue(ret);

    ret =
        waitForCallEvent(
            callHandle, EventCode.CALL_DISCONNECTED, EventReason.CALL_DISCONNECT_LOCAL, 15000);
    assertTrue(ret);
  }
  public void switchCamera() {
    try {
      int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
      videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
      LinphoneManager.getLc().setVideoDevice(videoDeviceId);
      CallManager.getInstance().updateCall();

      // previous call will cause graph reconstruction -> regive preview
      // window
      if (mCaptureView != null) {
        LinphoneManager.getLc().setPreviewWindow(mCaptureView);
      }
    } catch (ArithmeticException ae) {
      Log.e("Cannot swtich camera : no camera");
    }
  }
Exemplo n.º 10
0
  /**
   * Creates new call to given <tt>destination</tt> using selected <tt>provider</tt>.
   *
   * @param context the android context
   * @param destination target callee name.
   * @param provider the provider that will be used to make a call.
   */
  public static void createCall(
      final Context context, final String destination, final ProtocolProviderService provider) {
    if (createCallThread != null) {
      logger.warn("Another call is already being created");
      return;
    } else if (CallManager.getActiveCallsCount() > 0) {
      logger.warn("Another call is in progress");
      return;
    }

    final long dialogId =
        ProgressDialogFragment.showProgressDialog(
            JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL),
            JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL_MSG, destination));

    createCallThread =
        new Thread("Create call thread") {
          public void run() {
            try {
              CallManager.createCall(provider, destination);
            } catch (Throwable t) {
              logger.error("Error creating the call: " + t.getMessage(), t);
              AndroidUtils.showAlertDialog(
                  context, context.getString(R.string.service_gui_ERROR), t.getMessage());
            } finally {
              if (DialogActivity.waitForDialogOpened(dialogId)) {
                DialogActivity.closeDialog(JitsiApplication.getGlobalContext(), dialogId);
              } else {
                logger.error("Failed to wait for the dialog: " + dialogId);
              }
              createCallThread = null;
            }
          }
        };

    createCallThread.start();
  }
 /**
  * Returns a collection of all currently in progress calls.
  *
  * @return a collection of all currently in progress calls.
  */
 public Collection<Call> getInProgressCalls() {
   return CallManager.getActiveCalls();
 }