Fixed call recording issue depending where in the code the call was started

This commit is contained in:
Sylvain Berfini 2018-12-03 13:17:15 +01:00
parent 82c2edfb58
commit b746eaad31
4 changed files with 27 additions and 23 deletions

View file

@ -569,22 +569,16 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
LinphoneService.instance().getApplicationContext());
if (mLc.isNetworkReachable()) {
try {
if (Version.isVideoCapable()) {
boolean prefVideoEnable = mPrefs.isVideoEnabled();
boolean prefInitiateWithVideo = mPrefs.shouldInitiateVideoCall();
CallManager.getInstance()
.inviteAddress(
lAddress,
prefVideoEnable && prefInitiateWithVideo,
isLowBandwidthConnection);
} else {
CallManager.getInstance()
.inviteAddress(lAddress, false, isLowBandwidthConnection);
}
} catch (CoreException e) {
return;
if (Version.isVideoCapable()) {
boolean prefVideoEnable = mPrefs.isVideoEnabled();
boolean prefInitiateWithVideo = mPrefs.shouldInitiateVideoCall();
CallManager.getInstance()
.inviteAddress(
lAddress,
prefVideoEnable && prefInitiateWithVideo,
isLowBandwidthConnection);
} else {
CallManager.getInstance().inviteAddress(lAddress, false, isLowBandwidthConnection);
}
} else if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance()

View file

@ -20,13 +20,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import org.linphone.LinphoneManager;
import org.linphone.LinphoneService;
import org.linphone.core.Address;
import org.linphone.core.Call;
import org.linphone.core.CallParams;
import org.linphone.core.Core;
import org.linphone.core.CoreException;
import org.linphone.mediastream.Log;
import org.linphone.utils.FileUtils;
import org.linphone.utils.LinphoneUtils;
/** Handle call updating, reinvites. */
public class CallManager {
@ -44,8 +45,15 @@ public class CallManager {
return BandwidthManager.getInstance();
}
public void inviteAddress(Address lAddress, boolean videoEnabled, boolean lowBandwidth)
throws CoreException {
public void inviteAddress(Address lAddress) {
boolean isLowBandwidthConnection =
!LinphoneUtils.isHighBandwidthConnection(
LinphoneService.instance().getApplicationContext());
inviteAddress(lAddress, false, isLowBandwidthConnection);
}
public void inviteAddress(Address lAddress, boolean videoEnabled, boolean lowBandwidth) {
Core lc = LinphoneManager.getLc();
CallParams params = lc.createCallParams(null);

View file

@ -65,6 +65,7 @@ import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.LinphoneService;
import org.linphone.R;
import org.linphone.call.CallManager;
import org.linphone.contacts.ContactAddress;
import org.linphone.contacts.ContactsManager;
import org.linphone.contacts.ContactsUpdatedListener;
@ -162,7 +163,7 @@ public class ChatMessagesFragment extends Fragment
if (oneParticipantOneDevice) {
ParticipantDevice device =
mChatRoom.getParticipants()[0].getDevices()[0];
LinphoneManager.getLc().inviteAddress(device.getAddress());
CallManager.getInstance().inviteAddress(device.getAddress());
} else {
LinphoneActivity.instance()
.goToContactDevicesInfos(getRemoteSipUri());
@ -860,7 +861,7 @@ public class ChatMessagesFragment extends Fragment
if (oneParticipantOneDevice) {
ParticipantDevice device =
mChatRoom.getParticipants()[0].getDevices()[0];
LinphoneManager.getLc().inviteAddress(device.getAddress());
CallManager.getInstance().inviteAddress(device.getAddress());
} else {
LinphoneActivity.instance().goToContactDevicesInfos(getRemoteSipUri());
}

View file

@ -32,6 +32,7 @@ import java.util.Arrays;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.call.CallManager;
import org.linphone.contacts.ContactsManager;
import org.linphone.contacts.LinphoneContact;
import org.linphone.core.Address;
@ -82,7 +83,7 @@ public class DevicesFragment extends Fragment {
long l) {
ParticipantDevice device =
(ParticipantDevice) mAdapter.getChild(groupPosition, childPosition);
LinphoneManager.getLc().inviteAddress(device.getAddress());
CallManager.getInstance().inviteAddress(device.getAddress());
return false;
}
});
@ -98,7 +99,7 @@ public class DevicesFragment extends Fragment {
// in this case groups are childs, so call on click
ParticipantDevice device =
(ParticipantDevice) mAdapter.getGroup(groupPosition);
LinphoneManager.getLc().inviteAddress(device.getAddress());
CallManager.getInstance().inviteAddress(device.getAddress());
return true;
}
return false;