예제 #1
0
 public void refresh(ContentResolver cr) {
   this.numbersOrAddresses = Compatibility.extractContactNumbersAndAddresses(id, cr);
   LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
   if (lc != null && lc.getFriendList() != null) {
     for (LinphoneFriend friend : lc.getFriendList()) {
       if (id.equals(friend.getRefKey())) {
         hasFriends = true;
         this.numbersOrAddresses.add(friend.getAddress().asStringUriOnly());
       }
     }
   }
   this.name = Compatibility.refreshContactName(cr, id);
 }
예제 #2
0
  @Override
  protected void runTest() throws Throwable {
    // multicast begin
    mCore.enableAudioMulticast(true);
    Assert.assertEquals(true, mCore.audioMulticastEnabled());
    mCore.enableAudioMulticast(false);
    Assert.assertEquals(false, mCore.audioMulticastEnabled());

    mCore.enableVideoMulticast(true);
    Assert.assertEquals(true, mCore.videoMulticastEnabled());
    mCore.enableVideoMulticast(false);
    Assert.assertEquals(false, mCore.videoMulticastEnabled());

    LinphoneCallParams params = mCore.createCallParams(null);
    params.enableAudioMulticast(true);
    Assert.assertEquals(true, params.audioMulticastEnabled());
    params.enableAudioMulticast(false);
    Assert.assertEquals(false, params.audioMulticastEnabled());

    params.enableVideoMulticast(true);
    Assert.assertEquals(true, params.videoMulticastEnabled());
    params.enableVideoMulticast(false);
    Assert.assertEquals(false, params.videoMulticastEnabled());

    String ip = "224.3.2.1";
    mCore.setAudioMulticastAddr(ip);
    Assert.assertEquals(ip, mCore.getAudioMulticastAddr());

    ip = "224.3.2.3";
    mCore.setVideoMulticastAddr(ip);
    Assert.assertEquals(ip, mCore.getVideoMulticastAddr());

    mCore.setAudioMulticastTtl(3);
    Assert.assertEquals(3, mCore.getAudioMulticastTtl());

    mCore.setVideoMulticastTtl(4);
    Assert.assertEquals(4, mCore.getVideoMulticastTtl());
    // multicast end

    // Test setPrimaryContact
    String address = "Linphone Android <sip:linphone.android@unknown-host>";
    mCore.setPrimaryContact(address);
    Assert.assertEquals(
        LinphoneCoreFactory.instance().createLinphoneAddress(address).getDisplayName(),
        LinphoneCoreFactory.instance()
            .createLinphoneAddress(mCore.getPrimaryContact())
            .getDisplayName());
    Assert.assertEquals(
        LinphoneCoreFactory.instance().createLinphoneAddress(address).getUserName(),
        LinphoneCoreFactory.instance()
            .createLinphoneAddress(mCore.getPrimaryContact())
            .getUserName());

    // Test setPayloadTypeNumber
    mCore.setPayloadTypeNumber(mCore.findPayloadType("PCMU"), 12);
    Assert.assertEquals(mCore.getPayloadTypeNumber(mCore.findPayloadType("PCMU")), 12);

    PayloadType[] audioCodecs = mCore.getAudioCodecs();
    int audioCodecsNb = audioCodecs.length;
    if (audioCodecsNb >= 1) {
      PayloadType[] newAudioCodecs = new PayloadType[audioCodecsNb - 1];
      System.arraycopy(audioCodecs, 1, newAudioCodecs, 0, audioCodecsNb - 1);
      mCore.setAudioCodecs(newAudioCodecs);
      audioCodecs = mCore.getAudioCodecs();
      Assert.assertEquals(audioCodecs.length, audioCodecsNb - 1);
    }

    // Test LinphoneFriend ref key
    String key = "12";
    LinphoneFriend friend =
        LinphoneCoreFactory.instance().createLinphoneFriend("sip:[email protected]");
    friend.setRefKey(key);
    Assert.assertEquals(friend.getRefKey(), key);

    MediastreamerAndroidContext.enableFilterFromName("MSUlawEnc", false);
    Assert.assertFalse(MediastreamerAndroidContext.filterFromNameEnabled("MSUlawEnc"));
    MediastreamerAndroidContext.enableFilterFromName("MSUlawEnc", true);
  }