Add new options in call settings
-Time before auto-answering -Fix time before timeout for incoming call
This commit is contained in:
parent
b4292e61dc
commit
fa80a82bbb
8 changed files with 70 additions and 15 deletions
|
@ -7,7 +7,6 @@ mtu=1300
|
|||
|
||||
[sip]
|
||||
guess_hostname=1
|
||||
inc_timeout=15
|
||||
register_only_when_network_is_up=1
|
||||
auto_net_state_mon=0
|
||||
auto_answer_replacing_calls=1
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
<string name="pref_video_port_key">pref_video_port_key</string>
|
||||
<string name="pref_audio_port_key">pref_audio_port_key</string>
|
||||
<string name="pref_incoming_call_timeout_key">pref_incoming_expire_key</string>
|
||||
<string name="pref_call_timeout_key">pref_call_timeout_key</string>
|
||||
<string name="pref_auto_answer_time_key">pref_auto_answer_time_key</string>
|
||||
|
||||
<string name="pref_display_name_key">pref_display_name_key</string>
|
||||
<string name="pref_user_name_key">pref_user_name_key</string>
|
||||
|
|
|
@ -350,8 +350,10 @@
|
|||
<string name="pref_call_title">Call</string>
|
||||
<string name="pref_device_ringtone">Use device ringtone</string>
|
||||
<string name="pref_auto_answer">Auto answer incoming calls</string>
|
||||
<string name="pref_auto_answer_time">Auto answer time(in milliseconds)</string>
|
||||
<string name="pref_rfc2833_dtmf">Send in-band DTMFs(RFC2833)</string>
|
||||
<string name="pref_sipinfo_dtmf">Send out-band DTMFs(SIP INFO)</string>
|
||||
<string name="pref_call_timeout_title">Call timeout(in seconds)</string>
|
||||
<string name="pref_voice_mail">Voice mail URI</string>
|
||||
|
||||
<!-- Chat settings -->
|
||||
|
|
|
@ -206,6 +206,12 @@
|
|||
android:key="@string/pref_auto_answer_key"
|
||||
android:persistent="false"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/pref_auto_answer_time"
|
||||
android:key="@string/pref_auto_answer_time_key"
|
||||
android:numeric="integer"
|
||||
android:persistent="false"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/pref_incoming_call_timeout_title"
|
||||
android:key="@string/pref_incoming_call_timeout_key"
|
||||
|
@ -367,12 +373,6 @@
|
|||
android:key="@string/pref_autostart_key"
|
||||
android:persistent="false"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/pref_incoming_call_timeout_title"
|
||||
android:key="@string/pref_incoming_call_timeout_key"
|
||||
android:layout="@layout/hidden"
|
||||
android:persistent="false"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/pref_remote_provisioning_title"
|
||||
android:key="@string/pref_remote_provisioning_key"
|
||||
|
|
|
@ -1332,11 +1332,24 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
|
||||
if (state == State.IncomingReceived && (LinphonePreferences.instance().isAutoAnswerEnabled())) {
|
||||
try {
|
||||
mLc.acceptCall(call);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLc != null) {
|
||||
try {
|
||||
if (mLc.getCallsNb() > 0) {
|
||||
mLc.acceptCall(call);
|
||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||
LinphoneActivity.instance().startIncallActivity(call);
|
||||
}
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mTimer = new Timer("Auto answer");
|
||||
mTimer.schedule(lTask, mPrefs.getAutoAnswerTime());
|
||||
}
|
||||
else if (state == State.IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
|
||||
// Brighten screen for at least 10 seconds
|
||||
|
|
|
@ -984,6 +984,14 @@ public class LinphonePreferences {
|
|||
getLc().setIncomingTimeout(timeout);
|
||||
}
|
||||
|
||||
public int getInCallTimeout() {
|
||||
return getLc().getInCallTimeout();
|
||||
}
|
||||
|
||||
public void setInCallTimeout(int timeout) {
|
||||
getLc().setInCallTimeout(timeout);
|
||||
}
|
||||
|
||||
public String getVoiceMailUri() {
|
||||
return getConfig().getString("app", "voice_mail", null);
|
||||
}
|
||||
|
@ -1523,6 +1531,14 @@ public class LinphonePreferences {
|
|||
getConfig().setBool("app", "auto_answer", enable);
|
||||
}
|
||||
|
||||
public void setAutoAnswerTime(int time) {
|
||||
getConfig().setInt("app", "auto_answer_delay", time);
|
||||
}
|
||||
|
||||
public int getAutoAnswerTime() {
|
||||
return getConfig().getInt("app", "auto_answer_delay", 0);
|
||||
}
|
||||
|
||||
public int getCodeLength(){
|
||||
return getConfig().getInt("app", "activation_code_length", 0);
|
||||
}
|
||||
|
|
|
@ -861,6 +861,7 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
CheckBoxPreference rfc2833 = (CheckBoxPreference) findPreference(getString(R.string.pref_rfc2833_dtmf_key));
|
||||
CheckBoxPreference sipInfo = (CheckBoxPreference) findPreference(getString(R.string.pref_sipinfo_dtmf_key));
|
||||
EditTextPreference incTimeout = (EditTextPreference) findPreference(getString(R.string.pref_incoming_call_timeout_key));
|
||||
EditTextPreference autoAnswerTime = (EditTextPreference) findPreference(getString(R.string.pref_auto_answer_time_key));
|
||||
|
||||
|
||||
rfc2833.setChecked(mPrefs.useRfc2833Dtmfs());
|
||||
|
@ -868,7 +869,14 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
deviceRingtone.setChecked(mPrefs.isDeviceRingtoneEnabled());
|
||||
autoAnswer.setChecked(mPrefs.isAutoAnswerEnabled());
|
||||
incTimeout.setText(String.valueOf(mPrefs.getIncTimeout()));
|
||||
incTimeout.setSummary((String.valueOf(mPrefs.getIncTimeout())));
|
||||
incTimeout.setSummary(String.valueOf(mPrefs.getIncTimeout()));
|
||||
autoAnswerTime.setText(String.valueOf(mPrefs.getAutoAnswerTime()));
|
||||
autoAnswerTime.setSummary(String.valueOf(mPrefs.getAutoAnswerTime()));
|
||||
if (mPrefs.isAutoAnswerEnabled()) {
|
||||
autoAnswerTime.setEnabled(true);
|
||||
} else {
|
||||
autoAnswerTime.setEnabled(false);
|
||||
}
|
||||
|
||||
setPreferenceDefaultValueAndSummary(R.string.pref_voice_mail_key, mPrefs.getVoiceMailUri());
|
||||
}
|
||||
|
@ -926,6 +934,11 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean use = (Boolean) newValue;
|
||||
mPrefs.enableAutoAnswer(use);
|
||||
if (use) {
|
||||
findPreference(getString(R.string.pref_auto_answer_time_key)).setEnabled(true);
|
||||
} else {
|
||||
findPreference(getString(R.string.pref_auto_answer_time_key)).setEnabled(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -962,12 +975,22 @@ public class SettingsFragment extends PreferencesListFragment {
|
|||
findPreference(getString(R.string.pref_incoming_call_timeout_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String value = (String) newValue;
|
||||
String value = (String)newValue;
|
||||
mPrefs.setIncTimeout(Integer.valueOf(value));
|
||||
preference.setSummary(value);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
findPreference(getString(R.string.pref_auto_answer_time_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String value = (String) newValue;
|
||||
mPrefs.setAutoAnswerTime(Integer.valueOf(value));
|
||||
preference.setSummary(value);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setEncryptionZrtp() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit af93de9a95171530c93e22919e88f0db0d785919
|
||||
Subproject commit b21b16a98f13ba3965a304dfd1945b5be24e6c57
|
Loading…
Reference in a new issue