- Added Tone Country Audio Configuration option
- Fixed checking of DNS Servers config value
This commit is contained in:
@@ -27,6 +27,7 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
private var oldOpusBitrate = ""
|
private var oldOpusBitrate = ""
|
||||||
private var oldOpusPacketLoss = ""
|
private var oldOpusPacketLoss = ""
|
||||||
private var oldAec = false
|
private var oldAec = false
|
||||||
|
private var toneCountry = BaresipService.toneCountry
|
||||||
|
|
||||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() {
|
||||||
@@ -123,6 +124,27 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
audioDelay = binding.AudioDelay
|
audioDelay = binding.AudioDelay
|
||||||
audioDelay.setText(BaresipService.audioDelay.toString())
|
audioDelay.setText(BaresipService.audioDelay.toString())
|
||||||
|
|
||||||
|
val toneCountrySpinner = binding.ToneCountrySpinner
|
||||||
|
val toneCountryKeys = arrayListOf("bg", "br", "de", "cz", "es", "fi", "fr", "uk", "jp", "no", "nz", "se", "ru", "us")
|
||||||
|
val toneCountryVals = arrayListOf("BG", "BR", "DE", "CZ", "ES", "FI", "FR", "GB", "JP", "NO", "NZ", "SE", "RU", "US")
|
||||||
|
val keyIx = toneCountryKeys.indexOf(toneCountry)
|
||||||
|
val keyVal = toneCountryVals.elementAt(keyIx)
|
||||||
|
toneCountryKeys.removeAt(keyIx)
|
||||||
|
toneCountryVals.removeAt(keyIx)
|
||||||
|
toneCountryKeys.add(0, toneCountry)
|
||||||
|
toneCountryVals.add(0, keyVal)
|
||||||
|
val toneCountryAdapter = ArrayAdapter(this,android.R.layout.simple_spinner_item,
|
||||||
|
toneCountryVals)
|
||||||
|
toneCountryAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||||
|
toneCountrySpinner.adapter = toneCountryAdapter
|
||||||
|
toneCountrySpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
||||||
|
toneCountry = toneCountryKeys[toneCountryVals.indexOf(parent.selectedItem.toString())]
|
||||||
|
}
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bindTitles()
|
bindTitles()
|
||||||
|
|
||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
@@ -228,6 +250,12 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
save = true
|
save = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BaresipService.toneCountry != toneCountry) {
|
||||||
|
BaresipService.toneCountry = toneCountry
|
||||||
|
Config.replaceVariable("tone_country", toneCountry)
|
||||||
|
save = true
|
||||||
|
}
|
||||||
|
|
||||||
if (save)
|
if (save)
|
||||||
Config.save()
|
Config.save()
|
||||||
|
|
||||||
@@ -279,6 +307,10 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
Utils.alertView(this, getString(R.string.audio_delay),
|
Utils.alertView(this, getString(R.string.audio_delay),
|
||||||
getString(R.string.audio_delay_help))
|
getString(R.string.audio_delay_help))
|
||||||
}
|
}
|
||||||
|
binding.ToneCountryTitle.setOnClickListener {
|
||||||
|
Utils.alertView(this, getString(R.string.tone_country),
|
||||||
|
getString(R.string.tone_country_help))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkOpusBitRate(opusBitRate: String): Boolean {
|
private fun checkOpusBitRate(opusBitRate: String): Boolean {
|
||||||
|
|||||||
@@ -564,7 +564,7 @@ class BaresipService: Service() {
|
|||||||
sendBroadcast(Intent("com.tutpro.baresip.Restart"))
|
sendBroadcast(Intent("com.tutpro.baresip.Restart"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("UnspecifiedImmutableFlag")
|
@SuppressLint("UnspecifiedImmutableFlag", "DiscouragedApi")
|
||||||
@Keep
|
@Keep
|
||||||
fun uaEvent(event: String, uap: Long, callp: Long) {
|
fun uaEvent(event: String, uap: Long, callp: Long) {
|
||||||
|
|
||||||
@@ -698,7 +698,16 @@ class BaresipService: Service() {
|
|||||||
Log.d(TAG, "Auto-rejecting incoming call $uap/$callp/$peerUri")
|
Log.d(TAG, "Auto-rejecting incoming call $uap/$callp/$peerUri")
|
||||||
Api.ua_hangup(uap, callp, 486, "Busy Here")
|
Api.ua_hangup(uap, callp, 486, "Busy Here")
|
||||||
toast(toastMsg)
|
toast(toastMsg)
|
||||||
playUnInterrupted(R.raw.callwaiting, 1)
|
val name = "callwaiting_$toneCountry"
|
||||||
|
val resourceId = applicationContext.resources.getIdentifier(
|
||||||
|
name,
|
||||||
|
"raw",
|
||||||
|
applicationContext.packageName)
|
||||||
|
if (resourceId != 0) {
|
||||||
|
playUnInterrupted(resourceId, 1)
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Callwaiting tone $name.wav not found\")")
|
||||||
|
}
|
||||||
if (ua.account.callHistory) {
|
if (ua.account.callHistory) {
|
||||||
CallHistoryNew.add(CallHistoryNew(aor, peerUri, "in"))
|
CallHistoryNew.add(CallHistoryNew(aor, peerUri, "in"))
|
||||||
CallHistoryNew.save()
|
CallHistoryNew.save()
|
||||||
@@ -1255,17 +1264,34 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("DiscouragedApi")
|
||||||
private fun playRingBack() {
|
private fun playRingBack() {
|
||||||
if (mediaPlayer == null) {
|
if (mediaPlayer == null) {
|
||||||
mediaPlayer = MediaPlayer.create(this, R.raw.ringback)
|
val name = "ringback_$toneCountry"
|
||||||
|
val resourceId = applicationContext.resources.getIdentifier(
|
||||||
|
name,
|
||||||
|
"raw",
|
||||||
|
applicationContext.packageName)
|
||||||
|
if (resourceId != 0) {
|
||||||
|
mediaPlayer = MediaPlayer.create(this, resourceId)
|
||||||
mediaPlayer?.isLooping = true
|
mediaPlayer?.isLooping = true
|
||||||
mediaPlayer?.start()
|
mediaPlayer?.start()
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Ringback tone $name.wav not found")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("DiscouragedApi")
|
||||||
private fun playBusy() {
|
private fun playBusy() {
|
||||||
if (mediaPlayer == null ) {
|
if (mediaPlayer == null ) {
|
||||||
mediaPlayer = MediaPlayer.create(applicationContext, R.raw.busy)
|
val name = "busy_$toneCountry"
|
||||||
|
val resourceId = applicationContext.resources.getIdentifier(
|
||||||
|
name,
|
||||||
|
"raw",
|
||||||
|
applicationContext.packageName)
|
||||||
|
if (resourceId != 0) {
|
||||||
|
mediaPlayer = MediaPlayer.create(this, resourceId)
|
||||||
mediaPlayer?.setOnCompletionListener {
|
mediaPlayer?.setOnCompletionListener {
|
||||||
stopMediaPlayer()
|
stopMediaPlayer()
|
||||||
if (!Call.inCall()) {
|
if (!Call.inCall()) {
|
||||||
@@ -1275,6 +1301,9 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mediaPlayer?.start()
|
mediaPlayer?.start()
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Busy tone $name.wav not found")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1506,6 +1535,7 @@ class BaresipService: Service() {
|
|||||||
var isMainVisible = false
|
var isMainVisible = false
|
||||||
var isMicMuted = false
|
var isMicMuted = false
|
||||||
var isRecOn = false
|
var isRecOn = false
|
||||||
|
var toneCountry = "us"
|
||||||
|
|
||||||
val uas = ArrayList<UserAgent>()
|
val uas = ArrayList<UserAgent>()
|
||||||
val calls = ArrayList<Call>()
|
val calls = ArrayList<Call>()
|
||||||
|
|||||||
@@ -129,6 +129,11 @@ object Config {
|
|||||||
config = "${config}audio_delay ${BaresipService.audioDelay}\n"
|
config = "${config}audio_delay ${BaresipService.audioDelay}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val toneCountry = previousVariable("tone_country")
|
||||||
|
if (toneCountry != "")
|
||||||
|
BaresipService.toneCountry = toneCountry
|
||||||
|
config = "${config}tone_country ${BaresipService.toneCountry}\n"
|
||||||
|
|
||||||
save()
|
save()
|
||||||
BaresipService.isConfigInitialized = true
|
BaresipService.isConfigInitialized = true
|
||||||
|
|
||||||
|
|||||||
@@ -535,9 +535,10 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
restart = true
|
restart = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val dnsServers = addMissingPorts(
|
var dnsServers = dnsServers.text.toString().lowercase(Locale.ROOT)
|
||||||
dnsServers.text.toString().trim().lowercase(Locale.ROOT))
|
.replace(" ", "")
|
||||||
if (dnsServers != oldDnsServers) {
|
dnsServers = addMissingPorts(dnsServers)
|
||||||
|
if (dnsServers != oldDnsServers.replace(" ", "")) {
|
||||||
if (!checkDnsServers(dnsServers)) {
|
if (!checkDnsServers(dnsServers)) {
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
Utils.alertView(this, getString(R.string.notice),
|
||||||
"${getString(R.string.invalid_dns_servers)}: $dnsServers")
|
"${getString(R.string.invalid_dns_servers)}: $dnsServers")
|
||||||
|
|||||||
@@ -1037,3 +1037,4 @@ object Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.
|
||||||
@@ -176,6 +176,31 @@
|
|||||||
</EditText>
|
</EditText>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/ToneCountryTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toStartOf="@id/ToneCountrySpinner"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="@string/tone_country" >
|
||||||
|
</TextView>
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/ToneCountrySpinner"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="end" >
|
||||||
|
</Spinner>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -383,8 +383,9 @@
|
|||||||
<string name="invalid_audio_delay">Virheellinen audioviive \'%1$s\'. Sallittu arvo on välillä 100–3000.</string>
|
<string name="invalid_audio_delay">Virheellinen audioviive \'%1$s\'. Sallittu arvo on välillä 100–3000.</string>
|
||||||
<string name="default_call_volume">Oletus äänen voimakkuus</string>
|
<string name="default_call_volume">Oletus äänen voimakkuus</string>
|
||||||
<string name="default_call_volume_help">Jos valittu, puhelun äänen voimakkuus
|
<string name="default_call_volume_help">Jos valittu, puhelun äänen voimakkuus
|
||||||
asteikolla 1–10.
|
asteikolla 1–10.</string>
|
||||||
</string>
|
<string name="tone_country">Puheluäänien maa</string>
|
||||||
|
<string name="tone_country_help">Soitto-, odotus- ja varattuäänien maa</string>
|
||||||
<string name="dark_theme">Tumma teema</string>
|
<string name="dark_theme">Tumma teema</string>
|
||||||
<string name="dark_theme_help">Käytä aina tummaa näyttöteemaa</string>
|
<string name="dark_theme_help">Käytä aina tummaa näyttöteemaa</string>
|
||||||
<string name="video_size">Videon kehyskoko</string>
|
<string name="video_size">Videon kehyskoko</string>
|
||||||
|
|||||||
@@ -359,6 +359,8 @@
|
|||||||
<string name="invalid_audio_delay">Invalid Audio Delay \'%1$s\'. Valid values are from 100 to 3000.</string>
|
<string name="invalid_audio_delay">Invalid Audio Delay \'%1$s\'. Valid values are from 100 to 3000.</string>
|
||||||
<string name="default_call_volume">Default Call Volume</string>
|
<string name="default_call_volume">Default Call Volume</string>
|
||||||
<string name="default_call_volume_help">If set, default call audio volume at scale 1–10.</string>
|
<string name="default_call_volume_help">If set, default call audio volume at scale 1–10.</string>
|
||||||
|
<string name="tone_country">Tone Country</string>
|
||||||
|
<string name="tone_country_help">Country of call ringing, waiting, and callee busy tones</string>
|
||||||
<string name="dark_theme">Dark Theme</string>
|
<string name="dark_theme">Dark Theme</string>
|
||||||
<string name="dark_theme_help">Force dark display theme</string>
|
<string name="dark_theme_help">Force dark display theme</string>
|
||||||
<string name="video_size">Video Frame Size</string>
|
<string name="video_size">Video Frame Size</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user