try to avoid loosing registrations by using ;expires=3600 and by registering
UAs every 10 minutes fixed account help clicks
This commit is contained in:
@@ -19,7 +19,7 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
internal lateinit var authPass: EditText
|
internal lateinit var authPass: EditText
|
||||||
internal lateinit var outbound1: EditText
|
internal lateinit var outbound1: EditText
|
||||||
internal lateinit var outbound2: EditText
|
internal lateinit var outbound2: EditText
|
||||||
internal lateinit var regint: EditText
|
internal lateinit var regCheck: CheckBox
|
||||||
internal lateinit var mediaEnc: String
|
internal lateinit var mediaEnc: String
|
||||||
|
|
||||||
private var newCodecs = ArrayList<String>()
|
private var newCodecs = ArrayList<String>()
|
||||||
@@ -50,8 +50,8 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
outbound2.setText(acc.outbound[1])
|
outbound2.setText(acc.outbound[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
regint = findViewById(R.id.RegInt) as EditText
|
regCheck = findViewById(R.id.Register) as CheckBox
|
||||||
regint.setText(acc.regint.toString())
|
regCheck.isChecked = acc.regint > 0
|
||||||
|
|
||||||
val audioCodecs = ArrayList(Api.audio_codecs().split(","))
|
val audioCodecs = ArrayList(Api.audio_codecs().split(","))
|
||||||
newCodecs.addAll(audioCodecs)
|
newCodecs.addAll(audioCodecs)
|
||||||
@@ -206,22 +206,19 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
save = true
|
save = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val ri = regint.text.toString().trim()
|
var newRegint = -1
|
||||||
if (Utils.checkUint(ri)) {
|
if (regCheck.isChecked)
|
||||||
if (ri.toInt() != acc.regint) {
|
if (acc.regint != 3600) newRegint = 3600
|
||||||
if (account_set_regint(acc.accp, ri.toInt()) == 0) {
|
else
|
||||||
acc.regint = account_regint(acc.accp)
|
if (acc.regint != 0) newRegint = 0
|
||||||
Log.d("Baresip", "New regint is ${acc.regint}")
|
if (newRegint != -1)
|
||||||
save = true
|
if (account_set_regint(acc.accp, newRegint) == 0) {
|
||||||
} else {
|
acc.regint = account_regint(acc.accp)
|
||||||
Log.e("Baresip", "Setting of regint $ri failed")
|
Log.d("Baresip", "New regint is ${acc.regint}")
|
||||||
}
|
save = true
|
||||||
|
} else {
|
||||||
|
Log.e("Baresip", "Setting of regint failed")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Utils.alertView(this, "Notice",
|
|
||||||
"Invalid Registration Interval: $ri")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
val ac = ArrayList(LinkedHashSet<String>(newCodecs.filter { it != "" } as ArrayList<String>))
|
val ac = ArrayList(LinkedHashSet<String>(newCodecs.filter { it != "" } as ArrayList<String>))
|
||||||
if (ac != acc.audioCodec) {
|
if (ac != acc.audioCodec) {
|
||||||
@@ -299,8 +296,8 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
Utils.alertView(this, "Outbound Proxies",
|
Utils.alertView(this, "Outbound Proxies",
|
||||||
getString(R.string.obProxies))
|
getString(R.string.obProxies))
|
||||||
}
|
}
|
||||||
findViewById(R.id.RegIntTitle) -> {
|
findViewById(R.id.RegTitle) -> {
|
||||||
Utils.alertView(this, "Registration Interval", getString(R.string.regInt))
|
Utils.alertView(this, "Register", getString(R.string.register))
|
||||||
}
|
}
|
||||||
findViewById(R.id.AudioCodecsTitle) -> {
|
findViewById(R.id.AudioCodecsTitle) -> {
|
||||||
Utils.alertView(this, "Audio Codecs", getString(R.string.auCodecs))
|
Utils.alertView(this, "Audio Codecs", getString(R.string.auCodecs))
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.net.NetworkInfo
|
import android.net.NetworkInfo
|
||||||
|
import android.os.Handler
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.support.annotation.Keep
|
import android.support.annotation.Keep
|
||||||
import android.support.v4.app.NotificationCompat
|
import android.support.v4.app.NotificationCompat
|
||||||
@@ -116,6 +117,16 @@ class BaresipService: Service() {
|
|||||||
BaresipService.IS_SERVICE_RUNNING = true
|
BaresipService.IS_SERVICE_RUNNING = true
|
||||||
registerReceiver(nr, IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"))
|
registerReceiver(nr, IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"))
|
||||||
showNotification()
|
showNotification()
|
||||||
|
|
||||||
|
val handler = Handler()
|
||||||
|
val delay = 1000 * 600L
|
||||||
|
handler.postDelayed(object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
Log.d(LOG_TAG, "Handler based registration")
|
||||||
|
UserAgent.register(MainActivity.uas)
|
||||||
|
handler.postDelayed(this, delay)
|
||||||
|
}
|
||||||
|
}, delay)
|
||||||
}
|
}
|
||||||
|
|
||||||
"UpdateNotification" -> {
|
"UpdateNotification" -> {
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ class UserAgent (val uap: String) {
|
|||||||
fun register() {
|
fun register() {
|
||||||
if (account.regint > 0) {
|
if (account.regint > 0) {
|
||||||
Log.d("Baresip", "Registering ${account.aor} UA ${uap}")
|
Log.d("Baresip", "Registering ${account.aor} UA ${uap}")
|
||||||
val accp = ua_account(uap)
|
|
||||||
val reg_int = account_regint(accp)
|
|
||||||
Log.d("Baresip", "reg_int is $reg_int")
|
|
||||||
if (ua_register(uap) != 0)
|
if (ua_register(uap) != 0)
|
||||||
Log.e("Baresip", "Registering failed")
|
Log.e("Baresip", "Registering failed")
|
||||||
}
|
}
|
||||||
@@ -52,8 +49,9 @@ class UserAgent (val uap: String) {
|
|||||||
|
|
||||||
fun register(uas: ArrayList<UserAgent>) {
|
fun register(uas: ArrayList<UserAgent>) {
|
||||||
for (ua in uas) {
|
for (ua in uas) {
|
||||||
if (ua_register(ua.uap) != 0)
|
if (ua.account.regint > 0)
|
||||||
Log.e("Baresip", "Failed to register ${ua.account.aor}")
|
if (ua_register(ua.uap) != 0)
|
||||||
|
Log.e("Baresip", "Failed to register ${ua.account.aor}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:focusable="true"
|
android:onClick="onClick"
|
||||||
android:focusableInTouchMode="true"
|
|
||||||
android:text="Display Name" >
|
android:text="Display Name" >
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
|
android:onClick="onClick"
|
||||||
android:text="Authentication Username" >
|
android:text="Authentication Username" >
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
|
android:onClick="onClick"
|
||||||
android:text="Authentication Password" >
|
android:text="Authentication Password" >
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
@@ -76,6 +77,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
|
android:onClick="onClick"
|
||||||
android:text="Outbound Proxies" >
|
android:text="Outbound Proxies" >
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
@@ -97,22 +99,27 @@
|
|||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent">
|
||||||
</EditText>
|
</EditText>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/RegIntTitle"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:orientation="horizontal" >
|
||||||
android:textColor="@android:color/black"
|
<TextView
|
||||||
android:text="Registration Interval (sec)" >
|
android:id="@+id/RegTitle"
|
||||||
</TextView>
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
<EditText
|
android:textSize="18sp"
|
||||||
android:id="@+id/RegInt"
|
android:textColor="@android:color/black"
|
||||||
android:layout_height="wrap_content"
|
android:onClick="onClick"
|
||||||
android:textSize="18sp"
|
android:text="Register" >
|
||||||
android:inputType="number"
|
</TextView>
|
||||||
android:layout_width="fill_parent">
|
<CheckBox
|
||||||
</EditText>
|
android:id="@+id/Register"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=""
|
||||||
|
android:checked="false" >
|
||||||
|
</CheckBox>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/AudioCodecsTitle"
|
android:id="@+id/AudioCodecsTitle"
|
||||||
@@ -120,6 +127,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
|
android:onClick="onClick"
|
||||||
android:text="Audio Codecs" >
|
android:text="Audio Codecs" >
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
@@ -137,6 +145,7 @@
|
|||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
|
android:onClick="onClick"
|
||||||
android:text="Media Encryption" >
|
android:text="Media Encryption" >
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
one that responds. If no outbound proxy is given, requests are sent based on
|
one that responds. If no outbound proxy is given, requests are sent based on
|
||||||
DNS NAPTR/SRV/A record lookup of callee URI hostpart.\nExample:\nsip:foo.com:5060;transport=tls
|
DNS NAPTR/SRV/A record lookup of callee URI hostpart.\nExample:\nsip:foo.com:5060;transport=tls
|
||||||
</string>
|
</string>
|
||||||
<string name="regInt">Tells how often (in seconds) REGISTER requests are sent. Value 0
|
<string name="register">If checked, registration is enabled and REGISTER requests are sent at
|
||||||
disables registration.
|
10 minute intervals.
|
||||||
</string>
|
</string>
|
||||||
<string name="auCodecs">List of supported audio codecs in priority order.</string>
|
<string name="auCodecs">List of supported audio codecs in priority order.</string>
|
||||||
<string name="mediaEnc">Selects media transport encryption protocol.\n
|
<string name="mediaEnc">Selects media transport encryption protocol.\n
|
||||||
|
|||||||
Reference in New Issue
Block a user