Account code styling
This commit is contained in:
@@ -96,4 +96,3 @@ fun AboutScreen(onBack: () -> Unit) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
if (ac != "") {
|
if (ac != "") {
|
||||||
audioCodec.add(ac)
|
audioCodec.add(ac)
|
||||||
i++
|
i++
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,14 +91,12 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
|
|
||||||
fun print() : String {
|
fun print() : String {
|
||||||
|
|
||||||
var res = if (isMobile) {
|
var res = if (isMobile)
|
||||||
"<sip:mobile@pstn;transport=udp>"
|
"<sip:mobile@pstn;transport=udp>"
|
||||||
} else {
|
else if (displayName != "")
|
||||||
if (displayName != "")
|
"\"${displayName}\" "
|
||||||
"\"${displayName}\" "
|
else
|
||||||
else
|
|
||||||
""
|
""
|
||||||
}
|
|
||||||
|
|
||||||
if (!isMobile) {
|
if (!isMobile) {
|
||||||
res = "$res<$luri>"
|
res = "$res<$luri>"
|
||||||
@@ -118,14 +116,11 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
|
|
||||||
if (mediaNat != "") res += ";medianat=${mediaNat}"
|
if (mediaNat != "") res += ";medianat=${mediaNat}"
|
||||||
|
|
||||||
if (stunServer != "")
|
if (stunServer != "") res += ";stunserver=\"${stunServer}\""
|
||||||
res += ";stunserver=\"${stunServer}\""
|
|
||||||
|
|
||||||
if (stunUser != "")
|
if (stunUser != "") res += ";stunuser=\"${stunUser}\""
|
||||||
res += ";stunuser=\"${stunUser}\""
|
|
||||||
|
|
||||||
if (stunPass != "")
|
if (stunPass != "") res += ";stunpass=\"${stunPass}\""
|
||||||
res += ";stunpass=\"${stunPass}\""
|
|
||||||
|
|
||||||
if (audioCodec.isNotEmpty()) {
|
if (audioCodec.isNotEmpty()) {
|
||||||
var first = true
|
var first = true
|
||||||
@@ -134,15 +129,14 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
if (first) {
|
if (first) {
|
||||||
res += c
|
res += c
|
||||||
first = false
|
first = false
|
||||||
} else {
|
|
||||||
res = "$res,$c"
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
res = "$res,$c"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaEnc != "") res += ";mediaenc=${mediaEnc}"
|
if (mediaEnc != "") res += ";mediaenc=${mediaEnc}"
|
||||||
|
|
||||||
if (rtcpMux)
|
if (rtcpMux) res += ";rtcp_mux=yes"
|
||||||
res += ";rtcp_mux=yes"
|
|
||||||
|
|
||||||
res += if (rel100Mode == Api.REL100_ENABLED)
|
res += if (rel100Mode == Api.REL100_ENABLED)
|
||||||
";100rel=yes"
|
";100rel=yes"
|
||||||
@@ -159,55 +153,41 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
else
|
else
|
||||||
"$res;mwi=yes;vm_uri=\"$vmUri\""
|
"$res;mwi=yes;vm_uri=\"$vmUri\""
|
||||||
|
|
||||||
if (answerMode == Api.ANSWERMODE_AUTO)
|
if (answerMode == Api.ANSWERMODE_AUTO) res += ";answermode=auto"
|
||||||
res += ";answermode=auto"
|
|
||||||
|
|
||||||
if (autoRedirect)
|
if (autoRedirect) res += ";sip_autoredirect=yes"
|
||||||
res += ";sip_autoredirect=yes"
|
|
||||||
|
|
||||||
res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;inreq_allowed=yes"
|
res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;inreq_allowed=yes"
|
||||||
|
|
||||||
if (isMobile)
|
if (isMobile) res += ";call_transfer=no"
|
||||||
res += ";call_transfer=no"
|
|
||||||
|
|
||||||
var extra = ""
|
var extra = ""
|
||||||
|
|
||||||
if (nickName != "")
|
if (nickName != "") extra += ";nickname=${nickName}"
|
||||||
extra += ";nickname=${nickName}"
|
|
||||||
|
|
||||||
if (isMobile)
|
if (isMobile) extra += ";is_mobile=yes"
|
||||||
extra += ";is_mobile=yes"
|
|
||||||
|
|
||||||
if (!callHistory)
|
if (!callHistory) extra += ";call_history=no"
|
||||||
extra += ";call_history=no"
|
|
||||||
|
|
||||||
if (blockUnknown)
|
if (blockUnknown) extra += ";block_unknown=yes"
|
||||||
extra += ";block_unknown=yes"
|
|
||||||
|
|
||||||
if (blockHidden)
|
if (blockHidden) extra += ";block_hidden=yes"
|
||||||
extra += ";block_hidden=yes"
|
|
||||||
|
|
||||||
if (telProvider != "")
|
if (telProvider != "") extra += ";tel_provider=${URLEncoder.encode(telProvider, "UTF-8")}"
|
||||||
extra += ";tel_provider=${URLEncoder.encode(telProvider, "UTF-8")}"
|
|
||||||
|
|
||||||
if (countryCode != "")
|
if (countryCode != "") extra += ";country_code=$countryCode"
|
||||||
extra += ";country_code=$countryCode"
|
|
||||||
|
|
||||||
if (configuredRegInt != REGISTRATION_INTERVAL)
|
if (configuredRegInt != REGISTRATION_INTERVAL) extra += ";regint=$configuredRegInt"
|
||||||
extra += ";regint=$configuredRegInt"
|
|
||||||
|
|
||||||
if (numericKeypad)
|
if (numericKeypad) extra += ";numeric_keypad=yes"
|
||||||
extra += ";numeric_keypad=yes"
|
|
||||||
|
|
||||||
extra += ";last=empty"
|
extra += ";last=empty"
|
||||||
|
|
||||||
if (customParams != "")
|
if (customParams != "") extra += ";$customParams"
|
||||||
extra += ";$customParams"
|
|
||||||
|
|
||||||
res += ";extra=\"" + extra.substringAfter(";") + "\""
|
res += ";extra=\"" + extra.substringAfter(";") + "\""
|
||||||
|
|
||||||
if (customParams != "")
|
if (customParams != "") res += ";$customParams"
|
||||||
res += ";$customParams"
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
@@ -219,7 +199,8 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
cxt.getString(R.string.one_new_message)
|
cxt.getString(R.string.one_new_message)
|
||||||
else
|
else
|
||||||
"$vmNew ${cxt.getString(R.string.new_messages)}"
|
"$vmNew ${cxt.getString(R.string.new_messages)}"
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
""
|
""
|
||||||
|
|
||||||
val old = if (vmOld > 0) {
|
val old = if (vmOld > 0) {
|
||||||
@@ -227,21 +208,22 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
cxt.getString(R.string.one_old_message)
|
cxt.getString(R.string.one_old_message)
|
||||||
else
|
else
|
||||||
"$vmOld ${cxt.getString(R.string.old_messages)}"
|
"$vmOld ${cxt.getString(R.string.old_messages)}"
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
""
|
""
|
||||||
|
|
||||||
var msg = cxt.getString(R.string.you_have)
|
var msg = cxt.getString(R.string.you_have)
|
||||||
if (new != "") {
|
if (new != "") {
|
||||||
msg = "$msg $new"
|
msg = "$msg $new"
|
||||||
if (old != "") msg = "$msg ${cxt.getString(R.string.and)} $old"
|
if (old != "") msg = "$msg ${cxt.getString(R.string.and)} $old"
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
msg = if (old != "")
|
msg = if (old != "")
|
||||||
"$msg $old"
|
"$msg $old"
|
||||||
else
|
else
|
||||||
cxt.getString(R.string.no_messages)
|
cxt.getString(R.string.no_messages)
|
||||||
}
|
|
||||||
|
|
||||||
return "$msg."
|
return "$msg."
|
||||||
}
|
}
|
||||||
|
|
||||||
fun host() : String {
|
fun host() : String {
|
||||||
@@ -277,9 +259,8 @@ class Account(val accp: Long, virtualAor: String? = null) {
|
|||||||
|
|
||||||
fun accounts(): ArrayList<Account> {
|
fun accounts(): ArrayList<Account> {
|
||||||
val res = ArrayList<Account>()
|
val res = ArrayList<Account>()
|
||||||
for (ua in BaresipService.uas.value) {
|
for (ua in BaresipService.uas.value)
|
||||||
res.add(ua.account)
|
res.add(ua.account)
|
||||||
}
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user