Пример #1
0
  private void destroyCallManagers() {

    callMgr1.destroyCallManager();
    lineHandle1 = null;
    callMgr1 = null;
    callMgr2.destroyCallManager();
    lineHandle2 = null;
    callMgr2 = null;
  }
Пример #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);
    }
  }
Пример #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);
    }
  }
Пример #4
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);
  }