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()); LinphoneService.instance().getApplicationContext());
if (mLc.isNetworkReachable()) { if (mLc.isNetworkReachable()) {
try { if (Version.isVideoCapable()) {
if (Version.isVideoCapable()) { boolean prefVideoEnable = mPrefs.isVideoEnabled();
boolean prefVideoEnable = mPrefs.isVideoEnabled(); boolean prefInitiateWithVideo = mPrefs.shouldInitiateVideoCall();
boolean prefInitiateWithVideo = mPrefs.shouldInitiateVideoCall(); CallManager.getInstance()
CallManager.getInstance() .inviteAddress(
.inviteAddress( lAddress,
lAddress, prefVideoEnable && prefInitiateWithVideo,
prefVideoEnable && prefInitiateWithVideo, isLowBandwidthConnection);
isLowBandwidthConnection); } else {
} else { CallManager.getInstance().inviteAddress(lAddress, false, isLowBandwidthConnection);
CallManager.getInstance()
.inviteAddress(lAddress, false, isLowBandwidthConnection);
}
} catch (CoreException e) {
return;
} }
} else if (LinphoneActivity.isInstanciated()) { } else if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance() 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.LinphoneManager;
import org.linphone.LinphoneService;
import org.linphone.core.Address; import org.linphone.core.Address;
import org.linphone.core.Call; import org.linphone.core.Call;
import org.linphone.core.CallParams; import org.linphone.core.CallParams;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.CoreException;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.utils.FileUtils; import org.linphone.utils.FileUtils;
import org.linphone.utils.LinphoneUtils;
/** Handle call updating, reinvites. */ /** Handle call updating, reinvites. */
public class CallManager { public class CallManager {
@ -44,8 +45,15 @@ public class CallManager {
return BandwidthManager.getInstance(); return BandwidthManager.getInstance();
} }
public void inviteAddress(Address lAddress, boolean videoEnabled, boolean lowBandwidth) public void inviteAddress(Address lAddress) {
throws CoreException { boolean isLowBandwidthConnection =
!LinphoneUtils.isHighBandwidthConnection(
LinphoneService.instance().getApplicationContext());
inviteAddress(lAddress, false, isLowBandwidthConnection);
}
public void inviteAddress(Address lAddress, boolean videoEnabled, boolean lowBandwidth) {
Core lc = LinphoneManager.getLc(); Core lc = LinphoneManager.getLc();
CallParams params = lc.createCallParams(null); CallParams params = lc.createCallParams(null);

View file

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

View file

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