Added Setting to turn on/off SIP request/response trace to Logcat

This commit is contained in:
Juha Heinanen
2020-11-18 14:56:20 +02:00
parent 20f80f928a
commit a35c12204b
7 changed files with 62 additions and 8 deletions
+6
View File
@@ -1657,6 +1657,12 @@ Java_com_tutpro_baresip_Api_uag_1reset_1transp(JNIEnv *env, jobject thiz, jboole
(void)uag_reset_transp(reg, reinvite); (void)uag_reset_transp(reg, reinvite);
} }
JNIEXPORT void JNICALL
Java_com_tutpro_baresip_Api_uag_1enable_1sip_1trace(JNIEnv *env, jobject thiz, jboolean enable) {
LOGD("enabling sip trace (%d)\n", enable);
(void)uag_enable_sip_trace(enable);
}
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_tutpro_baresip_Api_net_1debug(JNIEnv *env, jobject thiz) { Java_com_tutpro_baresip_Api_net_1debug(JNIEnv *env, jobject thiz) {
net_debug_log(); net_debug_log();
@@ -12,6 +12,7 @@ object Api {
external fun video_codecs(): String external fun video_codecs(): String
external fun uag_current_set(uap: String) external fun uag_current_set(uap: String)
external fun uag_reset_transp(reg: Boolean, reinvite: Boolean) external fun uag_reset_transp(reg: Boolean, reinvite: Boolean)
external fun uag_enable_sip_trace(enable: Boolean)
external fun ua_account(ua: String): String external fun ua_account(ua: String): String
external fun ua_alloc(uri: String): String external fun ua_alloc(uri: String): String
external fun ua_update_account(ua: String): Int external fun ua_update_account(ua: String): Int
@@ -1146,6 +1146,7 @@ class BaresipService: Service() {
var filesPath = "" var filesPath = ""
var downloadsPath = "" var downloadsPath = ""
var logLevel = 2 var logLevel = 2
var sipTrace = false
val uas = ArrayList<UserAgent>() val uas = ArrayList<UserAgent>()
val status = ArrayList<Int>() val status = ArrayList<Int>()
@@ -17,13 +17,14 @@ import android.widget.AdapterView
class ConfigActivity : AppCompatActivity() { class ConfigActivity : AppCompatActivity() {
internal lateinit var autoStart: CheckBox private lateinit var autoStart: CheckBox
internal lateinit var listenAddr: EditText private lateinit var listenAddr: EditText
internal lateinit var dnsServers: EditText private lateinit var dnsServers: EditText
internal lateinit var certificateFile: CheckBox private lateinit var certificateFile: CheckBox
internal lateinit var caFile: CheckBox private lateinit var caFile: CheckBox
internal lateinit var debug: CheckBox private lateinit var debug: CheckBox
internal lateinit var reset: CheckBox private lateinit var sipTrace: CheckBox
private lateinit var reset: CheckBox
private var oldAutoStart = "" private var oldAutoStart = ""
private var oldListenAddr = "" private var oldListenAddr = ""
@@ -105,6 +106,9 @@ class ConfigActivity : AppCompatActivity() {
oldLogLevel = dbCv[0] oldLogLevel = dbCv[0]
debug.isChecked = oldLogLevel == "0" debug.isChecked = oldLogLevel == "0"
sipTrace = findViewById(R.id.SipTrace) as CheckBox
sipTrace.isChecked = BaresipService.sipTrace
reset = findViewById(R.id.Reset) as CheckBox reset = findViewById(R.id.Reset) as CheckBox
reset.isChecked = false reset.isChecked = false
@@ -242,6 +246,9 @@ class ConfigActivity : AppCompatActivity() {
save = true save = true
} }
BaresipService.sipTrace = sipTrace.isChecked
Api.uag_enable_sip_trace(sipTrace.isChecked)
if (reset.isChecked) { if (reset.isChecked) {
Config.reset(this) Config.reset(this)
save = false save = false
@@ -337,6 +344,10 @@ class ConfigActivity : AppCompatActivity() {
findViewById(R.id.DebugTitle) as TextView-> { findViewById(R.id.DebugTitle) as TextView-> {
Utils.alertView(this, getString(R.string.debug), getString(R.string.debug_help)) Utils.alertView(this, getString(R.string.debug), getString(R.string.debug_help))
} }
findViewById(R.id.SipTraceTitle) as TextView-> {
Utils.alertView(this, getString(R.string.sip_trace),
getString(R.string.sip_trace_help))
}
findViewById(R.id.ResetTitle) as TextView-> { findViewById(R.id.ResetTitle) as TextView-> {
Utils.alertView(this, getString(R.string.reset_config), Utils.alertView(this, getString(R.string.reset_config),
getString(R.string.reset_config_help)) getString(R.string.reset_config_help))
@@ -207,6 +207,34 @@
</CheckBox> </CheckBox>
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/SipTraceTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/SipTrace"
android:textSize="18sp"
android:textColor="@android:color/black"
android:onClick="onClick"
android:text="@string/sip_trace" >
</TextView>
<CheckBox
android:id="@+id/SipTrace"
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"
+4
View File
@@ -306,6 +306,10 @@
Tehdasasetus on 800x600.</string> Tehdasasetus on 800x600.</string>
<string name="debug">Lokiviestit</string> <string name="debug">Lokiviestit</string>
<string name="debug_help">Jos merkitty, baresip tuottaa debug- ja info-tason Logcat-viestejä.</string> <string name="debug_help">Jos merkitty, baresip tuottaa debug- ja info-tason Logcat-viestejä.</string>
<string name="sip_trace">SIP-sanomien jäljitys</string>
<string name="sip_trace_help">Jos merkitty ja jos Lokiviestit on merkitty, Logcat-viestit
sisältävät myös lähetetyt ja vastaanotetut SIP-sanomat. On aina merkitsemättä sovelluksen
käynnistyessä.</string>
<string name="reset_config">Palauta oletusasetukset</string> <string name="reset_config">Palauta oletusasetukset</string>
<string name="reset_config_help">Jos merkitty, oletusasetukset palautetaan, kun <string name="reset_config_help">Jos merkitty, oletusasetukset palautetaan, kun
baresip seuraavan kerran käynnistetään. baresip seuraavan kerran käynnistetään.
+4 -1
View File
@@ -272,7 +272,10 @@
<string name="video_size_help">Size of transmitted video frames (width x height). <string name="video_size_help">Size of transmitted video frames (width x height).
Factory default is 800x600.</string> Factory default is 800x600.</string>
<string name="debug">Debug</string> <string name="debug">Debug</string>
<string name="debug_help">Provides debug and info level log message availability in Logcat.</string> <string name="debug_help">If checked, provides debug and info level log messages to Logcat.</string>
<string name="sip_trace">SIP Trace</string>
<string name="sip_trace_help">If checked and if Debug is checked, provides also SIP
request and response trace to Logcat. Unchecked automatically at baresip start.</string>
<string name="reset_config">Reset to Factory Defaults</string> <string name="reset_config">Reset to Factory Defaults</string>
<string name="reset_config_help">If checked, settings are reset to factory default values.</string> <string name="reset_config_help">If checked, settings are reset to factory default values.</string>
<string name="read_cert_error">Failed to read file \'cert.pem\' from Download directory.</string> <string name="read_cert_error">Failed to read file \'cert.pem\' from Download directory.</string>