Added Speaker Phone audio setting
This commit is contained in:
@@ -18,6 +18,7 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
private lateinit var opusBitRate: EditText
|
private lateinit var opusBitRate: EditText
|
||||||
private lateinit var opusPacketLoss: EditText
|
private lateinit var opusPacketLoss: EditText
|
||||||
private lateinit var aec: CheckBox
|
private lateinit var aec: CheckBox
|
||||||
|
private lateinit var speakerPhone: CheckBox
|
||||||
private lateinit var audioDelay: EditText
|
private lateinit var audioDelay: EditText
|
||||||
|
|
||||||
private var save = false
|
private var save = false
|
||||||
@@ -73,6 +74,9 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
speakerPhone = binding.SpeakerPhone
|
||||||
|
speakerPhone.isChecked = BaresipService.speakerPhone
|
||||||
|
|
||||||
val modules = Config.variables("module")
|
val modules = Config.variables("module")
|
||||||
|
|
||||||
val audioModulesList = binding.AudioModulesList
|
val audioModulesList = binding.AudioModulesList
|
||||||
@@ -175,6 +179,13 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
save = true
|
save = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (speakerPhone.isChecked != BaresipService.speakerPhone) {
|
||||||
|
BaresipService.speakerPhone = speakerPhone.isChecked
|
||||||
|
Config.replaceVariable("speaker_phone",
|
||||||
|
if (BaresipService.speakerPhone) "yes" else "no")
|
||||||
|
save = true
|
||||||
|
}
|
||||||
|
|
||||||
var id = 1001
|
var id = 1001
|
||||||
for (module in audioModules) {
|
for (module in audioModules) {
|
||||||
val box = findViewById<CheckBox>(id++)
|
val box = findViewById<CheckBox>(id++)
|
||||||
@@ -287,6 +298,10 @@ class AudioActivity : AppCompatActivity() {
|
|||||||
Utils.alertView(this, getString(R.string.default_call_volume),
|
Utils.alertView(this, getString(R.string.default_call_volume),
|
||||||
getString(R.string.default_call_volume_help))
|
getString(R.string.default_call_volume_help))
|
||||||
}
|
}
|
||||||
|
binding.SpeakerPhoneTitle.setOnClickListener {
|
||||||
|
Utils.alertView(this, getString(R.string.speaker_phone),
|
||||||
|
getString(R.string.speaker_phone_help))
|
||||||
|
}
|
||||||
binding.AudioModulesTitle.setOnClickListener {
|
binding.AudioModulesTitle.setOnClickListener {
|
||||||
Utils.alertView(this, getString(R.string.audio_modules_title),
|
Utils.alertView(this, getString(R.string.audio_modules_title),
|
||||||
getString(R.string.audio_modules_help))
|
getString(R.string.audio_modules_help))
|
||||||
|
|||||||
@@ -682,6 +682,8 @@ class BaresipService: Service() {
|
|||||||
break
|
break
|
||||||
stopMediaPlayer()
|
stopMediaPlayer()
|
||||||
setCallVolume()
|
setCallVolume()
|
||||||
|
if (speakerPhone && !Utils.isSpeakerPhoneOn(am))
|
||||||
|
Utils.toggleSpeakerPhone(ContextCompat.getMainExecutor(this), am)
|
||||||
proximitySensing(true)
|
proximitySensing(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -728,9 +730,11 @@ class BaresipService: Service() {
|
|||||||
ua.account.missedCalls = true
|
ua.account.missedCalls = true
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else {
|
}
|
||||||
Log.d(TAG, "Incoming call $uap/$callp/$peerUri")
|
Log.d(TAG, "Incoming call $uap/$callp/$peerUri")
|
||||||
Call(callp, ua, peerUri, "in", "incoming", Utils.dtmfWatcher(callp)).add()
|
Call(callp, ua, peerUri, "in", "incoming", Utils.dtmfWatcher(callp)).add()
|
||||||
|
if (speakerPhone && !Utils.isSpeakerPhoneOn(am))
|
||||||
|
Utils.toggleSpeakerPhone(ContextCompat.getMainExecutor(this), am)
|
||||||
if (ua.account.answerMode == Api.ANSWERMODE_MANUAL) {
|
if (ua.account.answerMode == Api.ANSWERMODE_MANUAL) {
|
||||||
Log.d(TAG, "CurrentInterruptionFilter ${nm.currentInterruptionFilter}")
|
Log.d(TAG, "CurrentInterruptionFilter ${nm.currentInterruptionFilter}")
|
||||||
if (nm.currentInterruptionFilter <= NotificationManager.INTERRUPTION_FILTER_ALL)
|
if (nm.currentInterruptionFilter <= NotificationManager.INTERRUPTION_FILTER_ALL)
|
||||||
@@ -744,7 +748,6 @@ class BaresipService: Service() {
|
|||||||
startActivity(newIntent)
|
startActivity(newIntent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!Utils.isVisible()) {
|
if (!Utils.isVisible()) {
|
||||||
val piFlags = PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
val piFlags = PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
val intent = Intent(applicationContext, MainActivity::class.java)
|
val intent = Intent(applicationContext, MainActivity::class.java)
|
||||||
@@ -1558,6 +1561,7 @@ class BaresipService: Service() {
|
|||||||
var isConfigInitialized = false
|
var isConfigInitialized = false
|
||||||
var libraryLoaded = false
|
var libraryLoaded = false
|
||||||
var callVolume = 0
|
var callVolume = 0
|
||||||
|
var speakerPhone = false
|
||||||
var audioDelay = if (VERSION.SDK_INT < 31) 1500L else 500L
|
var audioDelay = if (VERSION.SDK_INT < 31) 1500L else 500L
|
||||||
var dynDns = false
|
var dynDns = false
|
||||||
var filesPath = ""
|
var filesPath = ""
|
||||||
|
|||||||
@@ -137,6 +137,14 @@ object Config {
|
|||||||
config = "${config}call_volume ${BaresipService.callVolume}\n"
|
config = "${config}call_volume ${BaresipService.callVolume}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val speakerPhone = previousVariable("speaker_phone")
|
||||||
|
if (speakerPhone != "") {
|
||||||
|
config = "${config}speaker_phone $speakerPhone\n"
|
||||||
|
BaresipService.speakerPhone = speakerPhone == "yes"
|
||||||
|
} else {
|
||||||
|
config = "${config}speaker_phone no\n"
|
||||||
|
}
|
||||||
|
|
||||||
val previousModules = previousVariables("module")
|
val previousModules = previousVariables("module")
|
||||||
for (module in AudioActivity.audioModules)
|
for (module in AudioActivity.audioModules)
|
||||||
if ("${module}.so" in previousModules)
|
if ("${module}.so" in previousModules)
|
||||||
|
|||||||
@@ -40,6 +40,31 @@
|
|||||||
</Spinner>
|
</Spinner>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="12dp" >
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/SpeakerPhoneTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toStartOf="@id/SpeakerPhone"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="@string/speaker_phone" >
|
||||||
|
</TextView>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/SpeakerPhone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:checked="false" >
|
||||||
|
</CheckBox>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -356,6 +356,10 @@
|
|||||||
</string>
|
</string>
|
||||||
<string name="audio">Audio</string>
|
<string name="audio">Audio</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_help">Jos merkitty, kaiutin kytketään sutomaattisesti päälle
|
||||||
|
kun puhelu alkaa.
|
||||||
|
</string>
|
||||||
<string name="audio_modules_title">Audio-modulit</string>
|
<string name="audio_modules_title">Audio-modulit</string>
|
||||||
<string name="audio_modules_help">Merkittyjen modulien tarjoamat audio-koodekit ovat tilien
|
<string name="audio_modules_help">Merkittyjen modulien tarjoamat audio-koodekit ovat tilien
|
||||||
käytettävissä.
|
käytettävissä.
|
||||||
|
|||||||
@@ -334,6 +334,9 @@
|
|||||||
Download folder.</string>
|
Download folder.</string>
|
||||||
<string name="audio">Audio</string>
|
<string name="audio">Audio</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_help">If checked, speaker phone is turned automatically on
|
||||||
|
when call starts.</string>
|
||||||
<string name="audio_modules_title">Audio Modules</string>
|
<string name="audio_modules_title">Audio Modules</string>
|
||||||
<string name="audio_modules_help">Audio codecs provided by the checked modules are
|
<string name="audio_modules_help">Audio codecs provided by the checked modules are
|
||||||
available for use by the accounts.</string>
|
available for use by the accounts.</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user