Use TAG const in log messages
This commit is contained in:
@ -82,7 +82,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
val intentAction = intent.getStringExtra("action")
|
val intentAction = intent.getStringExtra("action")
|
||||||
|
|
||||||
Log.d("Baresip", "MainActivity onCreate ${intent.action}/${intent.data}/$intentAction")
|
Log.d(TAG, "MainActivity onCreate ${intent.action}/${intent.data}/$intentAction")
|
||||||
|
|
||||||
if (intent?.action == ACTION_CALL && !BaresipService.isServiceRunning)
|
if (intent?.action == ACTION_CALL && !BaresipService.isServiceRunning)
|
||||||
BaresipService.callActionUri = URLDecoder.decode(intent.data.toString(), "UTF-8")
|
BaresipService.callActionUri = URLDecoder.decode(intent.data.toString(), "UTF-8")
|
||||||
@ -131,7 +131,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
stopState = "initial"
|
stopState = "initial"
|
||||||
quitTimer = object : CountDownTimer(5000, 1000) {
|
quitTimer = object : CountDownTimer(5000, 1000) {
|
||||||
override fun onTick(millisUntilFinished: Long) {
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
Log.d("Baresip", "Seconds remaining: ${millisUntilFinished / 1000}")
|
Log.d(TAG, "Seconds remaining: ${millisUntilFinished / 1000}")
|
||||||
}
|
}
|
||||||
override fun onFinish() {
|
override fun onFinish() {
|
||||||
when (stopState) {
|
when (stopState) {
|
||||||
@ -159,7 +159,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// Have to allow NULL view, since sometimes when onItemSelected is called, view is NULL.
|
// Have to allow NULL view, since sometimes when onItemSelected is called, view is NULL.
|
||||||
// Haven't found any explanation why this can happen.
|
// Haven't found any explanation why this can happen.
|
||||||
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
Log.d("Baresip", "aorSpinner selecting $position")
|
Log.d(TAG, "aorSpinner selecting $position")
|
||||||
val acc = UserAgent.uas()[position].account
|
val acc = UserAgent.uas()[position].account
|
||||||
aorSpinner.tag = acc.aor
|
aorSpinner.tag = acc.aor
|
||||||
val ua = UserAgent.uas()[position]
|
val ua = UserAgent.uas()[position]
|
||||||
@ -167,7 +167,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
updateIcons(acc)
|
updateIcons(acc)
|
||||||
}
|
}
|
||||||
override fun onNothingSelected(parent: AdapterView<*>) {
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
Log.d("Baresip", "Nothing selected")
|
Log.d(TAG, "Nothing selected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aorSpinner.setOnTouchListener { view, event ->
|
aorSpinner.setOnTouchListener { view, event ->
|
||||||
@ -237,8 +237,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val calls = Call.uaCalls(UserAgent.uas()[aorSpinner.selectedItemPosition], "")
|
val calls = Call.uaCalls(UserAgent.uas()[aorSpinner.selectedItemPosition], "")
|
||||||
if (calls.size > 0) {
|
if (calls.size > 0) {
|
||||||
if (Api.cmd_exec("zrtp_unverify " + calls[0].zid) != 0) {
|
if (Api.cmd_exec("zrtp_unverify " + calls[0].zid) != 0) {
|
||||||
Log.e("Baresip",
|
Log.e(TAG, "Command 'zrtp_unverify ${calls[0].zid}' failed")
|
||||||
"Command 'zrtp_unverify ${calls[0].zid}' failed")
|
|
||||||
} else {
|
} else {
|
||||||
securityButton.setImageResource(R.drawable.box_yellow)
|
securityButton.setImageResource(R.drawable.box_yellow)
|
||||||
securityButton.tag = "yellow"
|
securityButton.tag = "yellow"
|
||||||
@ -307,7 +306,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val uaCalls = Call.uaCalls(ua, "")
|
val uaCalls = Call.uaCalls(ua, "")
|
||||||
if (uaCalls.size > 0) {
|
if (uaCalls.size > 0) {
|
||||||
val callp = uaCalls[uaCalls.size - 1].callp
|
val callp = uaCalls[uaCalls.size - 1].callp
|
||||||
Log.d("Baresip", "AoR $aor hanging up call $callp with ${callUri.text}")
|
Log.d(TAG, "AoR $aor hanging up call $callp with ${callUri.text}")
|
||||||
hangupButton.isEnabled = false
|
hangupButton.isEnabled = false
|
||||||
Api.ua_hangup(ua.uap, callp, 0, "")
|
Api.ua_hangup(ua.uap, callp, 0, "")
|
||||||
}
|
}
|
||||||
@ -317,7 +316,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val ua = UserAgent.uas()[aorSpinner.selectedItemPosition]
|
val ua = UserAgent.uas()[aorSpinner.selectedItemPosition]
|
||||||
val aor = ua.account.aor
|
val aor = ua.account.aor
|
||||||
val callp = Call.uaCalls(ua, "in")[0].callp
|
val callp = Call.uaCalls(ua, "in")[0].callp
|
||||||
Log.d("Baresip", "AoR $aor answering call $callp from ${callUri.text}")
|
Log.d(TAG, "AoR $aor answering call $callp from ${callUri.text}")
|
||||||
answerButton.isEnabled = false
|
answerButton.isEnabled = false
|
||||||
rejectButton.isEnabled = false
|
rejectButton.isEnabled = false
|
||||||
Api.ua_answer(ua.uap, callp, Api.VIDMODE_OFF)
|
Api.ua_answer(ua.uap, callp, Api.VIDMODE_OFF)
|
||||||
@ -327,7 +326,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val ua = UserAgent.uas()[aorSpinner.selectedItemPosition]
|
val ua = UserAgent.uas()[aorSpinner.selectedItemPosition]
|
||||||
val aor = ua.account.aor
|
val aor = ua.account.aor
|
||||||
val callp = Call.uaCalls(ua, "in")[0].callp
|
val callp = Call.uaCalls(ua, "in")[0].callp
|
||||||
Log.d("Baresip", "AoR $aor rejecting call $callp from ${callUri.text}")
|
Log.d(TAG, "AoR $aor rejecting call $callp from ${callUri.text}")
|
||||||
answerButton.isEnabled = false
|
answerButton.isEnabled = false
|
||||||
rejectButton.isEnabled = false
|
rejectButton.isEnabled = false
|
||||||
Api.ua_hangup(ua.uap, callp, 486, "Rejected")
|
Api.ua_hangup(ua.uap, callp, 486, "Rejected")
|
||||||
@ -338,12 +337,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val aor = ua.account.aor
|
val aor = ua.account.aor
|
||||||
val call = Call.uaCalls(ua, "")[0]
|
val call = Call.uaCalls(ua, "")[0]
|
||||||
if (call.onhold) {
|
if (call.onhold) {
|
||||||
Log.d("Baresip", "AoR $aor resuming call ${call.callp} with ${callUri.text}")
|
Log.d(TAG, "AoR $aor resuming call ${call.callp} with ${callUri.text}")
|
||||||
call.unhold()
|
call.unhold()
|
||||||
call.onhold = false
|
call.onhold = false
|
||||||
holdButton.setImageResource(R.drawable.pause)
|
holdButton.setImageResource(R.drawable.pause)
|
||||||
} else {
|
} else {
|
||||||
Log.d("Baresip", "AoR $aor holding call ${call.callp} with ${callUri.text}")
|
Log.d(TAG, "AoR $aor holding call ${call.callp} with ${callUri.text}")
|
||||||
call.hold()
|
call.hold()
|
||||||
call.onhold = true
|
call.onhold = true
|
||||||
holdButton.setImageResource(R.drawable.play)
|
holdButton.setImageResource(R.drawable.play)
|
||||||
@ -505,7 +504,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
resumeAction = ""
|
resumeAction = ""
|
||||||
resumeUri = ""
|
resumeUri = ""
|
||||||
Log.i("Baresip", "onNewIntent ${intent.action} ${intent.data}")
|
Log.d(TAG, "onNewIntent ${intent.action} ${intent.data}")
|
||||||
if (intent.action == ACTION_CALL) {
|
if (intent.action == ACTION_CALL) {
|
||||||
if (Call.calls().isNotEmpty() || UserAgent.uas().isEmpty()) {
|
if (Call.calls().isNotEmpty() || UserAgent.uas().isEmpty()) {
|
||||||
return
|
return
|
||||||
@ -515,7 +514,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val uriStr = URLDecoder.decode(uri.toString(), "UTF-8")
|
val uriStr = URLDecoder.decode(uri.toString(), "UTF-8")
|
||||||
when (uri.scheme) {
|
when (uri.scheme) {
|
||||||
"sip" -> {
|
"sip" -> {
|
||||||
Log.d("Baresip", "Got sip URI $uriStr")
|
|
||||||
var ua = UserAgent.ofDomain(Utils.uriHostPart(uriStr))
|
var ua = UserAgent.ofDomain(Utils.uriHostPart(uriStr))
|
||||||
if (ua == null)
|
if (ua == null)
|
||||||
ua = BaresipService.uas[0]
|
ua = BaresipService.uas[0]
|
||||||
@ -524,14 +522,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
ua.account.resumeUri = uriStr
|
ua.account.resumeUri = uriStr
|
||||||
}
|
}
|
||||||
"tel" -> {
|
"tel" -> {
|
||||||
Log.d("Baresip", "Got tel URI $uriStr")
|
|
||||||
val acc = BaresipService.uas[0].account
|
val acc = BaresipService.uas[0].account
|
||||||
spinToAor(acc.aor)
|
spinToAor(acc.aor)
|
||||||
resumeAction = "call"
|
resumeAction = "call"
|
||||||
acc.resumeUri = uriStr.replace("tel", "sip") + "@" + acc.aor
|
acc.resumeUri = uriStr.replace("tel", "sip") + "@" + acc.aor
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
Log.w("Baresip", "Unsupported URI scheme ${uri.scheme}")
|
Log.w(TAG, "Unsupported URI scheme ${uri.scheme}")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,7 +541,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun handleIntent(intent: Intent) {
|
private fun handleIntent(intent: Intent) {
|
||||||
val action = intent.getStringExtra("action")
|
val action = intent.getStringExtra("action")
|
||||||
Log.d("Baresip", "Handling intent '$action'")
|
Log.d(TAG, "Handling intent '$action'")
|
||||||
when (action) {
|
when (action) {
|
||||||
"accounts" -> {
|
"accounts" -> {
|
||||||
resumeAction = "accounts"
|
resumeAction = "accounts"
|
||||||
@ -558,7 +555,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val uap = intent.getStringExtra("uap")!!
|
val uap = intent.getStringExtra("uap")!!
|
||||||
val ua = UserAgent.ofUap(uap)
|
val ua = UserAgent.ofUap(uap)
|
||||||
if (ua == null) {
|
if (ua == null) {
|
||||||
Log.w("Baresip", "handleIntent 'call' did not find ua $uap")
|
Log.w(TAG, "handleIntent 'call' did not find ua $uap")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (ua.account.aor != aorSpinner.tag)
|
if (ua.account.aor != aorSpinner.tag)
|
||||||
@ -570,7 +567,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val callp = intent.getStringExtra("callp")!!
|
val callp = intent.getStringExtra("callp")!!
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
Log.w("Baresip", "handleIntent '$action' did not find call $callp")
|
Log.w(TAG, "handleIntent '$action' did not find call $callp")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val ua = call.ua
|
val ua = call.ua
|
||||||
@ -583,7 +580,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val uap = intent.getStringExtra("uap")!!
|
val uap = intent.getStringExtra("uap")!!
|
||||||
val ua = UserAgent.ofUap(uap)
|
val ua = UserAgent.ofUap(uap)
|
||||||
if (ua == null) {
|
if (ua == null) {
|
||||||
Log.w("Baresip", "onNewIntent did not find ua $uap")
|
Log.w(TAG, "onNewIntent did not find ua $uap")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (ua.account.aor != aorSpinner.tag)
|
if (ua.account.aor != aorSpinner.tag)
|
||||||
@ -594,7 +591,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val callp = intent.getStringExtra("callp")!!
|
val callp = intent.getStringExtra("callp")!!
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
Log.w("Baresip", "handleIntent '$action' did not find call $callp")
|
Log.w(TAG, "handleIntent '$action' did not find call $callp")
|
||||||
moveTaskToBack(true)
|
moveTaskToBack(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -606,7 +603,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val uap = intent.getStringExtra("uap")!!
|
val uap = intent.getStringExtra("uap")!!
|
||||||
val ua = UserAgent.ofUap(uap)
|
val ua = UserAgent.ofUap(uap)
|
||||||
if (ua == null) {
|
if (ua == null) {
|
||||||
Log.w("Baresip", "onNewIntent did not find ua $uap")
|
Log.w(TAG, "onNewIntent did not find ua $uap")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (ua.account.aor != aorSpinner.tag)
|
if (ua.account.aor != aorSpinner.tag)
|
||||||
@ -619,13 +616,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
Log.d("Baresip", "Main onStart")
|
Log.d(TAG, "Main onStart")
|
||||||
super.onStart()
|
super.onStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
Log.d("Baresip", "Main onResume with action '$resumeAction'")
|
Log.d(TAG, "Main onResume with action '$resumeAction'")
|
||||||
visible = true
|
visible = true
|
||||||
when (resumeAction) {
|
when (resumeAction) {
|
||||||
"call show" ->
|
"call show" ->
|
||||||
@ -678,7 +675,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
Log.d("Baresip", "Main onPause")
|
Log.d(TAG, "Main onPause")
|
||||||
Utils.addActivity("main")
|
Utils.addActivity("main")
|
||||||
visible = false
|
visible = false
|
||||||
saveCallUri()
|
saveCallUri()
|
||||||
@ -686,19 +683,19 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
Log.d("Baresip", "Main onStop")
|
Log.d(TAG, "Main onStop")
|
||||||
super.onStop()
|
super.onStop()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun recreate() {
|
override fun recreate() {
|
||||||
Log.d("Baresip", "Main onCreate")
|
Log.d(TAG, "Main onCreate")
|
||||||
super.recreate()
|
super.recreate()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||||
when (keyCode) {
|
when (keyCode) {
|
||||||
KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_UP -> {
|
KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||||
Log.d("Baresip", "Adjusting volume $keyCode of stream ${volumeControlStream}")
|
Log.d(TAG, "Adjusting volume $keyCode of stream ${volumeControlStream}")
|
||||||
am.adjustStreamVolume(volumeControlStream,
|
am.adjustStreamVolume(volumeControlStream,
|
||||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
||||||
AudioManager.ADJUST_LOWER else
|
AudioManager.ADJUST_LOWER else
|
||||||
@ -712,12 +709,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun handleServiceEvent(event: String, params: ArrayList<String>) {
|
private fun handleServiceEvent(event: String, params: ArrayList<String>) {
|
||||||
if (taskId == -1) {
|
if (taskId == -1) {
|
||||||
Log.d("Baresip", "Omit service event '$event' for task -1")
|
Log.d(TAG, "Omit service event '$event' for task -1")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (event == "started") {
|
if (event == "started") {
|
||||||
val callActionUri = params[0]
|
val callActionUri = params[0]
|
||||||
Log.d("Baresip", "Handling service event 'started' with '$callActionUri'")
|
Log.d(TAG, "Handling service event 'started' with '$callActionUri'")
|
||||||
uaAdapter.notifyDataSetChanged()
|
uaAdapter.notifyDataSetChanged()
|
||||||
if (callActionUri != "") {
|
if (callActionUri != "") {
|
||||||
var ua = UserAgent.ofDomain(Utils.uriHostPart(callActionUri))
|
var ua = UserAgent.ofDomain(Utils.uriHostPart(callActionUri))
|
||||||
@ -725,7 +722,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (BaresipService.uas.size > 0) {
|
if (BaresipService.uas.size > 0) {
|
||||||
ua = BaresipService.uas[0]
|
ua = BaresipService.uas[0]
|
||||||
} else {
|
} else {
|
||||||
Log.w("Baresip", "No UAs to make the call to '$callActionUri'")
|
Log.w(TAG, "No UAs to make the call to '$callActionUri'")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
spinToAor(ua.account.aor)
|
spinToAor(ua.account.aor)
|
||||||
@ -741,7 +738,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (event == "stopped") {
|
if (event == "stopped") {
|
||||||
Log.d("Baresip", "Handling service event 'stopped' with param '${params[0]}'")
|
Log.d(TAG, "Handling service event 'stopped' with param '${params[0]}'")
|
||||||
if (params[0] != "") {
|
if (params[0] != "") {
|
||||||
val titleView = View.inflate(this, R.layout.alert_title, null) as TextView
|
val titleView = View.inflate(this, R.layout.alert_title, null) as TextView
|
||||||
titleView.text = getString(R.string.notice)
|
titleView.text = getString(R.string.notice)
|
||||||
@ -767,11 +764,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val uap = params[0]
|
val uap = params[0]
|
||||||
val ua = UserAgent.ofUap(uap)
|
val ua = UserAgent.ofUap(uap)
|
||||||
if (ua == null) {
|
if (ua == null) {
|
||||||
Log.w("Baresip", "handleServiceEvent '$event' did not find ua $uap")
|
Log.w(TAG, "handleServiceEvent '$event' did not find ua $uap")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val ev = event.split(",")
|
val ev = event.split(",")
|
||||||
Log.d("Baresip", "Handling service event '${ev[0]}' for $uap")
|
Log.d(TAG, "Handling service event '${ev[0]}' for $uap")
|
||||||
val acc = ua.account
|
val acc = ua.account
|
||||||
val aor = ua.account.aor
|
val aor = ua.account.aor
|
||||||
for (account_index in UserAgent.uas().indices) {
|
for (account_index in UserAgent.uas().indices) {
|
||||||
@ -806,7 +803,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
spinToAor(aor)
|
spinToAor(aor)
|
||||||
showCall(ua)
|
showCall(ua)
|
||||||
} else {
|
} else {
|
||||||
Log.d("Baresip", "Reordering to front")
|
Log.d(TAG, "Reordering to front")
|
||||||
val i = Intent(applicationContext, MainActivity::class.java)
|
val i = Intent(applicationContext, MainActivity::class.java)
|
||||||
i.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
|
i.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
i.putExtra("action", "call show")
|
i.putExtra("action", "call show")
|
||||||
@ -826,7 +823,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val callp = params[1]
|
val callp = params[1]
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
Log.w("Baresip", "Call $callp to be verified is not found")
|
Log.w(TAG, "Call $callp to be verified is not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val titleView = View.inflate(this, R.layout.alert_title, null) as TextView
|
val titleView = View.inflate(this, R.layout.alert_title, null) as TextView
|
||||||
@ -838,7 +835,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||||
val security: Int
|
val security: Int
|
||||||
if (Api.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
|
if (Api.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
|
||||||
Log.e("Baresip", "Command 'zrtp_verify ${ev[3]}' failed")
|
Log.e(TAG, "Command 'zrtp_verify ${ev[3]}' failed")
|
||||||
security = R.drawable.box_yellow
|
security = R.drawable.box_yellow
|
||||||
} else {
|
} else {
|
||||||
security = R.drawable.box_green
|
security = R.drawable.box_green
|
||||||
@ -869,7 +866,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val callp = params[1]
|
val callp = params[1]
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
Log.w("Baresip", "Call $callp that is verified is not found")
|
Log.w(TAG, "Call $callp that is verified is not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val tag: String
|
val tag: String
|
||||||
@ -886,7 +883,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val callp = params[1]
|
val callp = params[1]
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
Log.w("Baresip", "Call $callp to be transferred is not found")
|
Log.w(TAG, "Call $callp to be transferred is not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val titleView = View.inflate(this, R.layout.alert_title, null) as TextView
|
val titleView = View.inflate(this, R.layout.alert_title, null) as TextView
|
||||||
@ -916,7 +913,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val callp = params[1]
|
val callp = params[1]
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
Log.w("Baresip", "Call $callp to be transferred is not found")
|
Log.w(TAG, "Call $callp to be transferred is not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (call in Call.calls())
|
if (call in Call.calls())
|
||||||
@ -957,8 +954,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
"message", "message show", "message reply" -> {
|
"message", "message show", "message reply" -> {
|
||||||
val peer = params[1]
|
val peer = params[1]
|
||||||
Log.d("Baresip", "Message for $aor from $peer")
|
|
||||||
Log.d("Baresip", "Activity stack ${BaresipService.activities.toString()}")
|
|
||||||
val i = Intent(applicationContext, ChatActivity::class.java)
|
val i = Intent(applicationContext, ChatActivity::class.java)
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
val b = Bundle()
|
val b = Bundle()
|
||||||
@ -985,7 +980,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
voicemailButton.setImageResource(R.drawable.voicemail)
|
voicemailButton.setImageResource(R.drawable.voicemail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> Log.e("Baresip", "Unknown event '${ev[0]}'")
|
else -> Log.e(TAG, "Unknown event '${ev[0]}'")
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -993,7 +988,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun reStart() {
|
private fun reStart() {
|
||||||
Log.d("Baresip", "Trigger restart")
|
Log.d(TAG, "Trigger restart")
|
||||||
val pm = applicationContext.packageManager
|
val pm = applicationContext.packageManager
|
||||||
val intent = pm.getLaunchIntentForPackage(this.getPackageName())
|
val intent = pm.getLaunchIntentForPackage(this.getPackageName())
|
||||||
this.finishAffinity()
|
this.finishAffinity()
|
||||||
@ -1006,7 +1001,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
Log.d("Baresip", "Main onDestroy")
|
Log.d(TAG, "Main onDestroy")
|
||||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(serviceEventReceiver)
|
LocalBroadcastManager.getInstance(this).unregisterReceiver(serviceEventReceiver)
|
||||||
BaresipService.activities.clear()
|
BaresipService.activities.clear()
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
@ -1077,7 +1072,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
|
||||||
Log.d("Baresip", "onActivity result $requestCode $resultCode")
|
Log.d(TAG, "onActivity result $requestCode $resultCode")
|
||||||
|
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
|
|
||||||
@ -1173,7 +1168,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun quitRestart(reStart: Boolean) {
|
private fun quitRestart(reStart: Boolean) {
|
||||||
if (stopState == "initial") {
|
if (stopState == "initial") {
|
||||||
Log.d("Baresip", "quitRestart Restart = $reStart")
|
Log.d(TAG, "quitRestart Restart = $reStart")
|
||||||
if (BaresipService.isServiceRunning) {
|
if (BaresipService.isServiceRunning) {
|
||||||
restart = reStart
|
restart = reStart
|
||||||
baresipService.setAction("Stop");
|
baresipService.setAction("Stop");
|
||||||
@ -1367,14 +1362,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val zipFile = getString(R.string.app_name) + ".zip"
|
val zipFile = getString(R.string.app_name) + ".zip"
|
||||||
val zipFilePath = BaresipService.filesPath + "/$zipFile"
|
val zipFilePath = BaresipService.filesPath + "/$zipFile"
|
||||||
if (!Utils.zip(files, zipFile)) {
|
if (!Utils.zip(files, zipFile)) {
|
||||||
Log.w("Baresip", "Failed to write zip file '$zipFile'")
|
Log.w(TAG, "Failed to write zip file '$zipFile'")
|
||||||
Utils.alertView(this, getString(R.string.error),
|
Utils.alertView(this, getString(R.string.error),
|
||||||
String.format(getString(R.string.backup_failed), bsFile))
|
String.format(getString(R.string.backup_failed), bsFile))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val content = Utils.getFileContents(zipFilePath)
|
val content = Utils.getFileContents(zipFilePath)
|
||||||
if (content == null) {
|
if (content == null) {
|
||||||
Log.w("Baresip", "Failed to read zip file '$zipFile'")
|
Log.w(TAG, "Failed to read zip file '$zipFile'")
|
||||||
Utils.alertView(this, getString(R.string.error),
|
Utils.alertView(this, getString(R.string.error),
|
||||||
String.format(getString(R.string.backup_failed), bsFile))
|
String.format(getString(R.string.backup_failed), bsFile))
|
||||||
return
|
return
|
||||||
@ -1401,13 +1396,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!Utils.putFileContents(zipFilePath, zipData)) {
|
if (!Utils.putFileContents(zipFilePath, zipData)) {
|
||||||
Log.w("Baresip", "Failed to write zip file '$zipFile'")
|
Log.w(TAG, "Failed to write zip file '$zipFile'")
|
||||||
Utils.alertView(this, getString(R.string.error),
|
Utils.alertView(this, getString(R.string.error),
|
||||||
String.format(getString(R.string.restore_failed), bsFile))
|
String.format(getString(R.string.restore_failed), bsFile))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!Utils.unZip(zipFilePath)) {
|
if (!Utils.unZip(zipFilePath)) {
|
||||||
Log.w("Baresip", "Failed to unzip file '$zipFile'")
|
Log.w(TAG, "Failed to unzip file '$zipFile'")
|
||||||
Utils.alertView(this, getString(R.string.error),
|
Utils.alertView(this, getString(R.string.error),
|
||||||
String.format(getString(R.string.restore_failed), bsFile))
|
String.format(getString(R.string.restore_failed), bsFile))
|
||||||
return
|
return
|
||||||
@ -1456,12 +1451,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
spinToAor(ua.account.aor)
|
spinToAor(ua.account.aor)
|
||||||
val callp = Api.ua_connect(ua.uap, uri, Api.VIDMODE_OFF)
|
val callp = Api.ua_connect(ua.uap, uri, Api.VIDMODE_OFF)
|
||||||
if (callp != "") {
|
if (callp != "") {
|
||||||
Log.d("Baresip", "Adding outgoing call ${ua.uap}/$callp/$uri")
|
Log.d(TAG, "Adding outgoing call ${ua.uap}/$callp/$uri")
|
||||||
Call(callp, ua, uri, "out", status, Utils.dtmfWatcher(callp)).add()
|
Call(callp, ua, uri, "out", status, Utils.dtmfWatcher(callp)).add()
|
||||||
showCall(ua)
|
showCall(ua)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
Log.e("Baresip", "ua_connect ${ua.uap}/$uri failed")
|
Log.w(TAG, "ua_connect ${ua.uap}/$uri failed")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1470,7 +1465,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
private fun transfer(ua: UserAgent, call: Call, uri: String) {
|
private fun transfer(ua: UserAgent, call: Call, uri: String) {
|
||||||
val newCallp = Api.ua_call_alloc(ua.uap, call.callp, Api.VIDMODE_OFF)
|
val newCallp = Api.ua_call_alloc(ua.uap, call.callp, Api.VIDMODE_OFF)
|
||||||
if (newCallp != "") {
|
if (newCallp != "") {
|
||||||
Log.d("Baresip", "Adding outgoing call ${ua.uap}/$newCallp/$uri")
|
Log.d(TAG, "Adding outgoing call ${ua.uap}/$newCallp/$uri")
|
||||||
val newCall = Call(newCallp, ua, uri, "out", "transferring",
|
val newCall = Call(newCallp, ua, uri, "out", "transferring",
|
||||||
Utils.dtmfWatcher(newCallp))
|
Utils.dtmfWatcher(newCallp))
|
||||||
newCall.add()
|
newCall.add()
|
||||||
@ -1484,11 +1479,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
showCall(ua)
|
showCall(ua)
|
||||||
} else {
|
} else {
|
||||||
call.startAudio()
|
call.startAudio()
|
||||||
Log.e("Baresip", "call_connect $newCallp failed with error $err")
|
Log.w(TAG, "call_connect $newCallp failed with error $err")
|
||||||
call.notifySipfrag(500, "Call Error")
|
call.notifySipfrag(500, "Call Error")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("Baresip", "ua_call_alloc ${ua.uap}/${call.callp} failed")
|
Log.w(TAG, "ua_call_alloc ${ua.uap}/${call.callp} failed")
|
||||||
call.notifySipfrag(500, "Call Error")
|
call.notifySipfrag(500, "Call Error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1649,7 +1644,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun restoreActivities() {
|
private fun restoreActivities() {
|
||||||
if (BaresipService.activities.isEmpty()) return
|
if (BaresipService.activities.isEmpty()) return
|
||||||
Log.d("Baresip", "Activity stack ${BaresipService.activities}")
|
Log.d(TAG, "Activity stack ${BaresipService.activities}")
|
||||||
val activity = BaresipService.activities[0].split(",")
|
val activity = BaresipService.activities[0].split(",")
|
||||||
BaresipService.activities.removeAt(0)
|
BaresipService.activities.removeAt(0)
|
||||||
when (activity[0]) {
|
when (activity[0]) {
|
||||||
@ -1770,6 +1765,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// <aor, password> of those accounts that have auth username without auth password
|
// <aor, password> of those accounts that have auth username without auth password
|
||||||
val aorPasswords = mutableMapOf<String, String>()
|
val aorPasswords = mutableMapOf<String, String>()
|
||||||
|
|
||||||
|
private const val TAG = "Baresip"
|
||||||
|
|
||||||
const val ACCOUNTS_CODE = 1
|
const val ACCOUNTS_CODE = 1
|
||||||
const val CONTACTS_CODE = 2
|
const val CONTACTS_CODE = 2
|
||||||
const val CONFIG_CODE = 3
|
const val CONFIG_CODE = 3
|
||||||
@ -1788,7 +1785,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
if (!BaresipService.libraryLoaded) {
|
if (!BaresipService.libraryLoaded) {
|
||||||
Log.d("Baresip", "Loading baresip library")
|
Log.d(TAG, "Loading baresip library")
|
||||||
System.loadLibrary("baresip")
|
System.loadLibrary("baresip")
|
||||||
BaresipService.libraryLoaded = true
|
BaresipService.libraryLoaded = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user