Added Unique Contact URI setting
This commit is contained in:
@ -21,7 +21,6 @@ audio_jitter_buffer_size 50
|
|||||||
rtp_stats yes
|
rtp_stats yes
|
||||||
rtp_timeout 60
|
rtp_timeout 60
|
||||||
rtp_rxmode thread
|
rtp_rxmode thread
|
||||||
sip_cuser_random yes
|
|
||||||
module aaudio.so
|
module aaudio.so
|
||||||
module stun.so
|
module stun.so
|
||||||
module turn.so
|
module turn.so
|
||||||
|
|||||||
@ -115,6 +115,12 @@ object Config {
|
|||||||
if (userAgent != "")
|
if (userAgent != "")
|
||||||
config = "${config}user_agent $userAgent\n"
|
config = "${config}user_agent $userAgent\n"
|
||||||
|
|
||||||
|
val sipCuserRandom = previousVariable("sip_cuser_random")
|
||||||
|
config = if (sipCuserRandom != "")
|
||||||
|
"${config}sip_cuser_random $sipCuserRandom\n"
|
||||||
|
else
|
||||||
|
"${config}sip_cuser_random yes\n"
|
||||||
|
|
||||||
val darkTheme = previousVariable("dark_theme")
|
val darkTheme = previousVariable("dark_theme")
|
||||||
Preferences(ctx).displayTheme = if (darkTheme == "yes") {
|
Preferences(ctx).displayTheme = if (darkTheme == "yes") {
|
||||||
config = "${config}dark_theme yes\n"
|
config = "${config}dark_theme yes\n"
|
||||||
|
|||||||
@ -762,6 +762,35 @@ private fun SettingsContent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun UniqueContactUri() {
|
||||||
|
val uniqueContactUriTitle = stringResource(R.string.unique_contact_uri)
|
||||||
|
val uniqueContactUriHelp = stringResource(R.string.unique_contact_uri_help)
|
||||||
|
Row(
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(end = 10.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.Start
|
||||||
|
) {
|
||||||
|
Text(text = uniqueContactUriTitle,
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.clickable {
|
||||||
|
alertTitle.value = uniqueContactUriTitle
|
||||||
|
alertMessage.value = uniqueContactUriHelp
|
||||||
|
showAlert.value = true
|
||||||
|
},
|
||||||
|
fontSize = 18.sp
|
||||||
|
)
|
||||||
|
val uniqueContactUri by viewModel.uniqueContactUri.collectAsState()
|
||||||
|
Switch(
|
||||||
|
checked = uniqueContactUri,
|
||||||
|
onCheckedChange = { viewModel.uniqueContactUri.value = it }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AudioSettings(navController: NavController) {
|
fun AudioSettings(navController: NavController) {
|
||||||
Row(
|
Row(
|
||||||
@ -1318,6 +1347,7 @@ private fun SettingsContent(
|
|||||||
VerifyServer()
|
VerifyServer()
|
||||||
CaFile(activity)
|
CaFile(activity)
|
||||||
UserAgent()
|
UserAgent()
|
||||||
|
UniqueContactUri()
|
||||||
AudioSettings(navController)
|
AudioSettings(navController)
|
||||||
Contacts(activity)
|
Contacts(activity)
|
||||||
Ringtone()
|
Ringtone()
|
||||||
@ -1435,6 +1465,13 @@ private fun checkOnClick(ctx: Context, viewModel: SettingsViewModel): Boolean {
|
|||||||
restart = true
|
restart = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((Config.variable("sip_cuser_random") == "yes") != viewModel.uniqueContactUri.value) {
|
||||||
|
Config.replaceVariable("sip_cuser_random",
|
||||||
|
if (viewModel.uniqueContactUri.value) "yes" else "no")
|
||||||
|
save = true
|
||||||
|
restart = true
|
||||||
|
}
|
||||||
|
|
||||||
val ringtoneUri = viewModel.ringtoneUri.value
|
val ringtoneUri = viewModel.ringtoneUri.value
|
||||||
Preferences(ctx).ringtoneUri = ringtoneUri
|
Preferences(ctx).ringtoneUri = ringtoneUri
|
||||||
BaresipService.rt = RingtoneManager.getRingtone(ctx, ringtoneUri.toUri())
|
BaresipService.rt = RingtoneManager.getRingtone(ctx, ringtoneUri.toUri())
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class SettingsViewModel: ViewModel() {
|
|||||||
val verifyServer = MutableStateFlow(false)
|
val verifyServer = MutableStateFlow(false)
|
||||||
val caFile = MutableStateFlow(false)
|
val caFile = MutableStateFlow(false)
|
||||||
val userAgent = MutableStateFlow("")
|
val userAgent = MutableStateFlow("")
|
||||||
|
val uniqueContactUri = MutableStateFlow(true)
|
||||||
val contactsMode = MutableStateFlow("")
|
val contactsMode = MutableStateFlow("")
|
||||||
val ringtoneUri = MutableStateFlow("")
|
val ringtoneUri = MutableStateFlow("")
|
||||||
val batteryOptimizations = MutableStateFlow(false)
|
val batteryOptimizations = MutableStateFlow(false)
|
||||||
@ -62,6 +63,8 @@ class SettingsViewModel: ViewModel() {
|
|||||||
|
|
||||||
userAgent.value = Config.variable("user_agent")
|
userAgent.value = Config.variable("user_agent")
|
||||||
|
|
||||||
|
uniqueContactUri.value = Config.variable("sip_cuser_random") == "yes"
|
||||||
|
|
||||||
contactsMode.value = Config.variable("contacts_mode").lowercase()
|
contactsMode.value = Config.variable("contacts_mode").lowercase()
|
||||||
|
|
||||||
ringtoneUri.value = if (Preferences(ctx).ringtoneUri == "")
|
ringtoneUri.value = if (Preferences(ctx).ringtoneUri == "")
|
||||||
|
|||||||
@ -382,6 +382,11 @@
|
|||||||
nimeltään \'ca_certs.crt\' ladataan Download-kansiosta.
|
nimeltään \'ca_certs.crt\' ladataan Download-kansiosta.
|
||||||
</string>
|
</string>
|
||||||
<string name="no_read_permission">Ei ulkoisen muistin lukuoikeutta</string>
|
<string name="no_read_permission">Ei ulkoisen muistin lukuoikeutta</string>
|
||||||
|
<string name="unique_contact_uri">Uniikki Contact URI</string>
|
||||||
|
<string name="unique_contact_uri_help">Jos merkitty, Contact URI:n taataan olevan uniikki.
|
||||||
|
Merkittävä, jos on useammalla tilillä on same SIP URI:n käyttäjäosa, mutta myös
|
||||||
|
suojaa tilejä hyökkäyksiltä.
|
||||||
|
</string>
|
||||||
<string name="audio_settings">Audio-asetukset</string>
|
<string name="audio_settings">Audio-asetukset</string>
|
||||||
<string name="speaker_phone">Kaiutin</string>
|
<string name="speaker_phone">Kaiutin</string>
|
||||||
<string name="speaker_phone_help">Jos merkitty, kaiutin kytketään sutomaattisesti päälle
|
<string name="speaker_phone_help">Jos merkitty, kaiutin kytketään sutomaattisesti päälle
|
||||||
|
|||||||
@ -364,6 +364,10 @@
|
|||||||
TLS certificates of such Certificate Authorities that are not included in Android OS.
|
TLS certificates of such Certificate Authorities that are not included in Android OS.
|
||||||
In Android version 9, a file called \'ca_certs.crt\' is loaded from Download folder.</string>
|
In Android version 9, a file called \'ca_certs.crt\' is loaded from Download folder.</string>
|
||||||
<string name="no_read_permission">No External Storage read permission</string>
|
<string name="no_read_permission">No External Storage read permission</string>
|
||||||
|
<string name="unique_contact_uri">Unique Contact URI</string>
|
||||||
|
<string name="unique_contact_uri_help">If checked, Contact URI is guaranteed to be unique.
|
||||||
|
Needs to be checked if there is more than one account with the same SIP URI userpart,
|
||||||
|
but also improves protection of the accounts from attacks.</string>
|
||||||
<string name="audio_settings">Audio Settings</string>
|
<string name="audio_settings">Audio Settings</string>
|
||||||
<string name="speaker_phone">Speaker Phone</string>
|
<string name="speaker_phone">Speaker Phone</string>
|
||||||
<string name="speaker_phone_help">If checked, speaker phone is turned automatically on
|
<string name="speaker_phone_help">If checked, speaker phone is turned automatically on
|
||||||
|
|||||||
Reference in New Issue
Block a user