mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
improve activation
This commit is contained in:
parent
c0a974ad22
commit
2b746ec7c8
8 changed files with 126 additions and 57 deletions
|
|
@ -1,11 +1,10 @@
|
|||
[net]
|
||||
download_bw=512
|
||||
upload_bw=512
|
||||
download_bw=0
|
||||
upload_bw=0
|
||||
|
||||
[sip]
|
||||
contact="Linphone Android" <sip:linphone.android@unknown-host>
|
||||
use_info=0
|
||||
use_ipv6=0
|
||||
keepalive_period=30000
|
||||
|
||||
[video]
|
||||
|
|
@ -14,12 +13,13 @@ size=vga
|
|||
[app]
|
||||
tunnel=disabled
|
||||
push_notification=1
|
||||
debug=0
|
||||
debug=1
|
||||
debug_popup_magic=#1234
|
||||
|
||||
[tunnel]
|
||||
host=
|
||||
port=443
|
||||
|
||||
[misc]
|
||||
log_collection_upload_server_url=https://www.linphone.org:444/lft.php
|
||||
file_transfer_server_url=https://www.linphone.org:444/lft.php
|
||||
lfile_transfer_server_url=https://sip1.msiorange.com/file_sharing/upload.php
|
||||
log_collection_upload_server_url=https://sip1.msiorange.com/file_sharing/upload.php
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
[net]
|
||||
download_bw=0
|
||||
upload_bw=0
|
||||
|
||||
[sip]
|
||||
contact="Linphone Android" <sip:linphone.android@unknown-host>
|
||||
use_info=0
|
||||
use_ipv6=1
|
||||
keepalive_period=30000
|
||||
sip_port=-1
|
||||
sip_tcp_port=-1
|
||||
sip_tls_port=-1
|
||||
|
||||
[video]
|
||||
size=vga
|
||||
|
|
@ -13,12 +13,13 @@ size=vga
|
|||
[app]
|
||||
tunnel=disabled
|
||||
push_notification=1
|
||||
auto_start=1
|
||||
debug=1
|
||||
debug_popup_magic=#1234
|
||||
|
||||
[tunnel]
|
||||
host=
|
||||
port=443
|
||||
|
||||
[misc]
|
||||
log_collection_upload_server_url=https://www.linphone.org:444/lft.php
|
||||
file_transfer_server_url=https://www.linphone.org:444/lft.php
|
||||
lfile_transfer_server_url=https://sip1.msiorange.com/file_sharing/upload.php
|
||||
log_collection_upload_server_url=https://sip1.msiorange.com/file_sharing/upload.php
|
||||
|
|
@ -4,10 +4,6 @@
|
|||
#Paths to resources must be set from LinphoneManager, after creating LinphoneCore.
|
||||
[net]
|
||||
mtu=1300
|
||||
#Because dynamic bitrate adaption can increase bitrate, we must allow "no limit"
|
||||
download_bw=0
|
||||
upload_bw=0
|
||||
force_ice_disablement=0
|
||||
|
||||
[sip]
|
||||
guess_hostname=1
|
||||
|
|
@ -20,11 +16,6 @@ use_cpim=1
|
|||
linphone_specs=groupchat
|
||||
|
||||
[rtp]
|
||||
audio_rtp_port=7076
|
||||
video_rtp_port=9078
|
||||
audio_jitt_comp=60
|
||||
video_jitt_comp=60
|
||||
nortp_timeout=30
|
||||
disable_upnp=1
|
||||
|
||||
[sound]
|
||||
|
|
@ -39,13 +30,12 @@ ec_calibrator_cool_tones=1
|
|||
[misc]
|
||||
max_calls=10
|
||||
history_max_size=100
|
||||
store_friends=0
|
||||
|
||||
[app]
|
||||
activation_code_length=4
|
||||
show_login_view=1
|
||||
friendlist_subscription_enabled=1
|
||||
debug_popup_magic=#1234
|
||||
|
||||
|
||||
[assistant]
|
||||
password_max_length=-1
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
<bool name="display_contact_organization">true</bool>
|
||||
|
||||
<!-- Others Parameters-->
|
||||
<string name="about_bugreport_email">linphone-android@belledonne-communications.com</string>
|
||||
<string name="about_bugreport_email">admin@msiorange.com</string>
|
||||
<bool name="enable_call_notification">true</bool>
|
||||
<bool name="kill_service_with_task_manager">true</bool>
|
||||
<string name="notification_service_channel_id">linphone_notification_service_id</string>
|
||||
|
|
|
|||
|
|
@ -216,6 +216,12 @@
|
|||
<item>Cancel</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="popup_send_log_2">
|
||||
<item>Send logs</item>
|
||||
<item>Cancel</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string name="pref_use_lime_encryption_key">pref_use_lime_encryption_key</string>
|
||||
<string name="pref_device_ringtone_key">pref_device_ringtone_key</string>
|
||||
<string name="pref_auto_answer_key">pref_auto_answer_key</string>
|
||||
|
|
|
|||
|
|
@ -578,22 +578,24 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
try {
|
||||
mTimer.cancel();
|
||||
destroyLinphoneCore();
|
||||
try {
|
||||
InputStream backup = new FileInputStream(linphoneRcBack);
|
||||
if (backup != null) {
|
||||
File rcfile = new File(linphoneRcPath);
|
||||
if (rcfile.exists()) {
|
||||
LinphoneUtils.copyToFile(backup, rcfile);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
File backupFile = new File(linphoneRcBack);
|
||||
if (backupFile.exists()) {
|
||||
InputStream backup = new FileInputStream(backupFile);
|
||||
File rcfile = new File(linphoneRcPath);
|
||||
if (rcfile.exists()) {
|
||||
LinphoneUtils.copyToFile(backup, rcfile);
|
||||
}
|
||||
backupFile.delete();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
|
||||
mServiceContext.unregisterReceiver(mNetworkReceiver);
|
||||
|
|
@ -620,7 +622,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
dozeManager(false);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
Log.e(iae);
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.e(e);
|
||||
}
|
||||
mLc = null;
|
||||
|
|
@ -634,11 +636,11 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
sExited = false;
|
||||
}
|
||||
|
||||
private synchronized void startLibLinphone(Context c) {
|
||||
private synchronized void startLibLinphone(Context c, Config config) {
|
||||
|
||||
try {
|
||||
copyAssetsFromPackage();
|
||||
//traces alway start with traces enable to not missed first initialization
|
||||
mLc = Factory.instance().createCore(mConfigFile, mLinphoneFactoryConfigFile, c);
|
||||
mLc = Factory.instance().createCoreWithConfig(config, c);
|
||||
mLc.addListener(this);
|
||||
mLc.start();
|
||||
TimerTask lTask = new TimerTask() {
|
||||
|
|
@ -662,6 +664,14 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized void startLibLinphone(Context c) {
|
||||
try {
|
||||
copyAssetsFromPackage();
|
||||
startLibLinphone(c, Factory.instance().createConfigWithFactory(mConfigFile, mLinphoneFactoryConfigFile));
|
||||
} catch (Exception e) {
|
||||
Log.e(e, "Cannot start linphone");
|
||||
}
|
||||
}
|
||||
private void initPushNotificationsService() {
|
||||
if (getString(R.string.push_type).equals("google")) {
|
||||
try {
|
||||
|
|
@ -1670,6 +1680,12 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
|
||||
LinphonePreferences prefs = LinphonePreferences.instance();
|
||||
final String linphoneRcBack = mServiceContext.getFilesDir().getAbsolutePath() + "/linphonerc.back";
|
||||
//Obiane spec
|
||||
if (state != ConfiguringState.Failed) {
|
||||
File backup = new File(linphoneRcBack);
|
||||
if (backup.exists()) backup.delete();
|
||||
if (savedList != null) lc.removeFriendList(savedList);
|
||||
}
|
||||
if (state == ConfiguringState.Successful) {
|
||||
if (prefs.isProvisioningLoginViewEnabled()) {
|
||||
ProxyConfig proxyConfig = lc.createProxyConfig();
|
||||
|
|
@ -1677,9 +1693,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
wizardLoginViewDomain = (addr != null) ? addr.getDomain() : "";
|
||||
}
|
||||
prefs.setPushNotificationEnabled(prefs.isPushNotificationEnabled());
|
||||
if (savedList != null) lc.removeFriendList(savedList);
|
||||
File backup = new File(linphoneRcBack);
|
||||
if (backup.exists()) backup.delete();
|
||||
} else if (state == ConfiguringState.Failed) {
|
||||
final CoreListener listener = this;
|
||||
Handler mainHandler = new Handler(mServiceContext.getMainLooper());
|
||||
|
|
@ -1693,14 +1706,10 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
destroyCore();
|
||||
Config cfg = Factory.instance().createConfig(linphoneRcPath);
|
||||
cfg.setString("misc", "config-uri", "");
|
||||
cfg.sync();
|
||||
startLibLinphone(mServiceContext);
|
||||
startLibLinphone(mServiceContext, cfg);
|
||||
sExited = false;
|
||||
mLc.setProvisioningUri(remoteProvisioning);
|
||||
File backup = new File(linphoneRcBack);
|
||||
if (backup.exists()) {
|
||||
backup.delete();
|
||||
}
|
||||
|
||||
if (ContactsManager.getInstance() != null) ContactsManager.getInstance().fetchContactsAsync();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.core.AuthInfo;
|
||||
|
|
@ -27,6 +28,7 @@ import org.linphone.core.ConfiguringState;
|
|||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.LogCollectionState;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
import org.linphone.core.RegistrationState;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
|
@ -35,7 +37,9 @@ import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
|||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
|
|
@ -69,6 +73,7 @@ import javax.crypto.spec.PBEKeySpec;
|
|||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import static android.os.SystemClock.sleep;
|
||||
import static org.linphone.core.LogCollectionState.*;
|
||||
|
||||
public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener {
|
||||
private static RemoteProvisioningLoginActivity instance;
|
||||
|
|
@ -81,6 +86,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
private LinearLayout bottom;
|
||||
private RelativeLayout layout_button;
|
||||
private CoreListenerStub mListener;
|
||||
private CoreListenerStub mListener2;
|
||||
private SurfaceView mQrcodeView;
|
||||
private ImageView mImageMask;
|
||||
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||
|
|
@ -89,6 +95,58 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
private boolean backCamera = true;
|
||||
private int PERMISSION_CAMERA = 108;
|
||||
|
||||
//temp to trouble shoot provisionning issues
|
||||
public void displayDebugPopup(){
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
|
||||
mListener2 = new CoreListenerStub() {
|
||||
@Override
|
||||
public void onLogCollectionUploadStateChanged(Core lc, Core.LogCollectionUploadState state, String info) {
|
||||
if (state == Core.LogCollectionUploadState.Delivered) {
|
||||
final String appName = LinphoneService.instance().getApplicationContext().getString(R.string.app_name);
|
||||
|
||||
Intent i = new Intent(Intent.ACTION_SEND);
|
||||
i.putExtra(Intent.EXTRA_EMAIL, new String[]{ LinphoneService.instance().getApplicationContext().getString(R.string.about_bugreport_email) });
|
||||
i.putExtra(Intent.EXTRA_SUBJECT, appName + " Logs");
|
||||
i.putExtra(Intent.EXTRA_TEXT, info);
|
||||
i.setType("application/zip");
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
try {
|
||||
LinphoneService.instance().getApplicationContext().startActivity(Intent.createChooser(i, "Send mail...").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
} catch (android.content.ActivityNotFoundException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
} else if (state == Core.LogCollectionUploadState.NotDelivered) {
|
||||
Toast.makeText(RemoteProvisioningLoginActivity.this, "Error, do not managed to send logs", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
alertDialog.setTitle("Sorry, an unexpected error occured, please help us troubleshooting.");
|
||||
if(LinphonePreferences.instance().isDebugEnabled()) {
|
||||
alertDialog.setItems(getResources().getStringArray(R.array.popup_send_log_2), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if(which == 0) {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.uploadLogCollection();
|
||||
lc.addListener(mListener2);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
alertDialog.setItems(getResources().getStringArray(R.array.popup_enable_log), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if(which == 0) {
|
||||
LinphonePreferences.instance().setDebugEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
alertDialog.show();
|
||||
}
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -144,9 +202,18 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
@Override
|
||||
public void onConfiguringStatus(Core lc, final ConfiguringState state, String message) {
|
||||
if (state == ConfiguringState.Successful) {
|
||||
//TODO
|
||||
//in case of obiane, we can make sure configuration is ok starting from this point
|
||||
LinphonePreferences.instance().firstLaunchSuccessful();
|
||||
LinphonePreferences.instance().getConfig().sync();
|
||||
startActivity(new Intent().setClass(RemoteProvisioningLoginActivity.this, LinphoneActivity.class).setData(getIntent().getData()));
|
||||
finish();
|
||||
} else if (state == ConfiguringState.Failed) {
|
||||
//to make sure we do not retry by acident
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(null);
|
||||
LinphonePreferences.instance().getConfig().sync();
|
||||
Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
||||
|
||||
instance.displayDebugPopup();
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -408,12 +475,7 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
LinphoneManager.getLc().addAuthInfo(auth);
|
||||
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||
|
||||
//TODO
|
||||
LinphoneManager.getLc().iterate();
|
||||
sleep(1000);
|
||||
LinphoneManager.getLc().iterate();
|
||||
//TODO
|
||||
LinphonePreferences.instance().getConfig().sync();
|
||||
|
||||
LinphoneManager.getInstance().restartCore();
|
||||
LinphoneManager.getLc().addListener(mListener);
|
||||
|
|
|
|||
|
|
@ -113,9 +113,10 @@ public class Digit extends Button implements AddressAware {
|
|||
i.putExtra(Intent.EXTRA_SUBJECT, appName + " Logs");
|
||||
i.putExtra(Intent.EXTRA_TEXT, info);
|
||||
i.setType("application/zip");
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
try {
|
||||
LinphoneService.instance().getApplicationContext().startActivity(Intent.createChooser(i, "Send mail..."));
|
||||
LinphoneService.instance().getApplicationContext().startActivity(Intent.createChooser(i, "Send mail...").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
lc.removeListener(mListener);
|
||||
} catch (android.content.ActivityNotFoundException ex) {
|
||||
Log.e(ex);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue