Improved use of linphone specifics default proxy config values
This commit is contained in:
parent
c294a8ad1b
commit
1ee8e83621
6 changed files with 41 additions and 14 deletions
|
@ -155,7 +155,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
private final String mLPConfigXsd;
|
||||
|
||||
private final String mLinphoneFactoryConfigFile;
|
||||
private final String mDynamicConfigFile;
|
||||
private final String mLinphoneDynamicConfigFile, mDefaultDynamicConfigFile;
|
||||
private final String mChatDatabaseFile;
|
||||
private final String mRingSoundFile;
|
||||
private final String mCallLogDatabaseFile;
|
||||
|
@ -205,7 +205,8 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
mLPConfigXsd = mBasePath + "/lpconfig.xsd";
|
||||
mLinphoneFactoryConfigFile = mBasePath + "/linphonerc";
|
||||
configFile = mBasePath + "/.linphonerc";
|
||||
mDynamicConfigFile = mBasePath + "/assistant_create.rc";
|
||||
mLinphoneDynamicConfigFile = mBasePath + "/linphone_assistant_create.rc";
|
||||
mDefaultDynamicConfigFile = mBasePath + "/default_assistant_create.rc";
|
||||
mChatDatabaseFile = mBasePath + "/linphone-history.db";
|
||||
mCallLogDatabaseFile = mBasePath + "/linphone-log-history.db";
|
||||
mFriendsDatabaseFile = mBasePath + "/linphone-friends.db";
|
||||
|
@ -839,7 +840,10 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
copyIfNotExist(R.raw.linphonerc_default, configFile);
|
||||
copyFromPackage(R.raw.linphonerc_factory, new File(mLinphoneFactoryConfigFile).getName());
|
||||
copyIfNotExist(R.raw.lpconfig, mLPConfigXsd);
|
||||
copyFromPackage(R.raw.assistant_create, new File(mDynamicConfigFile).getName());
|
||||
copyFromPackage(
|
||||
R.raw.default_assistant_create, new File(mDefaultDynamicConfigFile).getName());
|
||||
copyFromPackage(
|
||||
R.raw.linphone_assistant_create, new File(mLinphoneDynamicConfigFile).getName());
|
||||
}
|
||||
|
||||
private void copyIfNotExist(int ressourceId, String target) throws IOException {
|
||||
|
@ -1551,8 +1555,12 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
dialog.show();
|
||||
}
|
||||
|
||||
public String getmDynamicConfigFile() {
|
||||
return mDynamicConfigFile;
|
||||
public String getDefaultDynamicConfigFile() {
|
||||
return mDefaultDynamicConfigFile;
|
||||
}
|
||||
|
||||
public String getLinphoneDynamicConfigFile() {
|
||||
return mLinphoneDynamicConfigFile;
|
||||
}
|
||||
|
||||
public boolean getCallGsmON() {
|
||||
|
|
|
@ -503,8 +503,11 @@ public class AssistantActivity extends Activity
|
|||
|
||||
public void linphoneLogIn(AccountCreator accountCreator) {
|
||||
LinphoneManager.getLc()
|
||||
.loadConfigFromXml(LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
.loadConfigFromXml(LinphoneManager.getInstance().getLinphoneDynamicConfigFile());
|
||||
configureProxyConfig(accountCreator);
|
||||
// Restore default values for proxy config
|
||||
LinphoneManager.getLc()
|
||||
.loadConfigFromXml(LinphoneManager.getInstance().getDefaultDynamicConfigFile());
|
||||
}
|
||||
|
||||
public void genericLogIn(
|
||||
|
|
|
@ -96,6 +96,7 @@ public class CreateAccountFragment extends Fragment
|
|||
LinphoneManager.getLc()
|
||||
.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
mAccountCreator.setListener(this);
|
||||
mAccountCreator.setDomain(getString(R.string.default_domain));
|
||||
|
||||
mInstruction = view.findViewById(R.id.message_create_account);
|
||||
|
||||
|
@ -339,9 +340,6 @@ public class CreateAccountFragment extends Fragment
|
|||
} else {
|
||||
if (mUseEmail.isChecked()) mAccountCreator.setPhoneNumber(null, null);
|
||||
if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
|
||||
LinphoneManager.getLc()
|
||||
.loadConfigFromXml(
|
||||
LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
mAccountCreator.isAccountExist();
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(
|
||||
|
@ -673,8 +671,6 @@ public class CreateAccountFragment extends Fragment
|
|||
LinphoneUtils.displayErrorAlert(
|
||||
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
} else {
|
||||
LinphoneManager.getLc()
|
||||
.loadConfigFromXml(LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
accountCreator.isAliasUsed();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -209,6 +209,7 @@ public class LinphoneLoginFragment extends Fragment
|
|||
}
|
||||
mAccountCreator.setUsername(mLogin.getText().toString());
|
||||
mAccountCreator.setPassword(mPassword.getText().toString());
|
||||
mAccountCreator.setDomain(getString(R.string.default_domain));
|
||||
mAccountCreator.isAccountExist();
|
||||
}
|
||||
|
||||
|
@ -276,8 +277,6 @@ public class LinphoneLoginFragment extends Fragment
|
|||
int status = getPhoneNumberStatus();
|
||||
boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
|
||||
if (isOk) {
|
||||
LinphoneManager.getLc()
|
||||
.loadConfigFromXml(LinphoneManager.getInstance().getmDynamicConfigFile());
|
||||
mAccountCreator.isAliasUsed();
|
||||
} else {
|
||||
mApply.setEnabled(true);
|
||||
|
|
22
app/src/main/res/raw/default_assistant_create.rc
Normal file
22
app/src/main/res/raw/default_assistant_create.rc
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config xmlns="http://www.linphone.org/xsds/lpconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd">
|
||||
<section name="proxy_default_values">
|
||||
<entry name="avpf" overwrite="true">0</entry>
|
||||
<entry name="dial_escape_plus" overwrite="true">0</entry>
|
||||
<entry name="publish" overwrite="true">0</entry>
|
||||
<entry name="quality_reporting_collector" overwrite="true"></entry>
|
||||
<entry name="quality_reporting_enabled" overwrite="true">0</entry>
|
||||
<entry name="quality_reporting_interval" overwrite="true">0</entry>
|
||||
<entry name="reg_expires" overwrite="true">3600</entry>
|
||||
<entry name="reg_identity" overwrite="true"></entry>
|
||||
<entry name="reg_proxy" overwrite="true"></entry>
|
||||
<entry name="reg_route" overwrite="true"></entry>
|
||||
<entry name="reg_sendregister" overwrite="true">1</entry>
|
||||
<entry name="nat_policy_ref" overwrite="true"></entry>
|
||||
<entry name="realm" overwrite="true"></entry>
|
||||
<entry name="conference_factory_uri" overwrite="true"></entry>
|
||||
</section>
|
||||
<section name="assistant">
|
||||
<entry name="domain" overwrite="true"></entry>
|
||||
</section>
|
||||
</config>
|
|
@ -24,7 +24,6 @@
|
|||
<entry name="rls_uri" overwrite="true">sips:rls@sip.linphone.org</entry>
|
||||
</section>
|
||||
<section name="assistant">
|
||||
<entry name="domain" overwrite="true">sip.linphone.org</entry>
|
||||
<entry name="password_max_length" overwrite="true">-1</entry>
|
||||
<entry name="password_min_length" overwrite="true">1</entry>
|
||||
<entry name="username_length" overwrite="true">-1</entry>
|
Loading…
Reference in a new issue