- added support for IPv6 (not tested due to lack of IPv6 network)
- new "Prefer IPv6" config option - IPv6 address is allowed in DNS Server and Outbound Proxy - added log_level config file variable - added Google IPv6 DNS server address
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
auto_start no
|
auto_start no
|
||||||
|
log_level 2
|
||||||
poll_method epoll
|
poll_method epoll
|
||||||
sip_trans_bsize 128
|
sip_trans_bsize 128
|
||||||
call_local_timeout 120
|
call_local_timeout 120
|
||||||
@@ -14,6 +15,8 @@ rtcp_mux no
|
|||||||
jitter_buffer_delay 5-10
|
jitter_buffer_delay 5-10
|
||||||
rtp_stats no
|
rtp_stats no
|
||||||
dns_server 8.8.8.8:53
|
dns_server 8.8.8.8:53
|
||||||
|
dns_server [2001:4860:4860::8888]:53
|
||||||
|
prefer_ipv6 no
|
||||||
module opus.so
|
module opus.so
|
||||||
module g711.so
|
module g711.so
|
||||||
module opensles.so
|
module opensles.so
|
||||||
|
|||||||
@@ -439,6 +439,14 @@ Java_com_tutpro_baresip_BaresipService_baresipStart(JNIEnv *env, jobject instanc
|
|||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
/* char debug_buf[2048];
|
||||||
|
int l;
|
||||||
|
l = re_snprintf(&(debug_buf[0]), 2047, "%H", net_debug, baresip_network());
|
||||||
|
if (l != -1) {
|
||||||
|
debug_buf[l] = '\0';
|
||||||
|
LOGD("%s\n", debug_buf);
|
||||||
|
} */
|
||||||
|
|
||||||
LOGI("running main loop ...\n");
|
LOGI("running main loop ...\n");
|
||||||
err = re_main(signal_handler);
|
err = re_main(signal_handler);
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
if (ob != acc.outbound) {
|
if (ob != acc.outbound) {
|
||||||
val outbound = ArrayList<String>()
|
val outbound = ArrayList<String>()
|
||||||
for (i in ob.indices) {
|
for (i in ob.indices) {
|
||||||
if ((ob[i] == "") || Utils.checkOutboundUri(ob[i])) {
|
if ((ob[i] == "") || checkOutboundUri(ob[i])) {
|
||||||
if (account_set_outbound(acc.accp, ob[i], i) == 0) {
|
if (account_set_outbound(acc.accp, ob[i], i) == 0) {
|
||||||
if (ob[i] != "")
|
if (ob[i] != "")
|
||||||
outbound.add(account_outbound(acc.accp, i))
|
outbound.add(account_outbound(acc.accp, i))
|
||||||
@@ -413,6 +413,11 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkOutboundUri(uri: String): Boolean {
|
||||||
|
if (!uri.startsWith("sip:")) return false
|
||||||
|
return Utils.checkHostPortParams(uri.substring(4))
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkDisplayName(dn: String): Boolean {
|
private fun checkDisplayName(dn: String): Boolean {
|
||||||
if (dn == "") return true
|
if (dn == "") return true
|
||||||
val dnRegex = Regex("^([* .!%_`'~]|[+]|[-a-zA-Z0-9]){1,63}\$")
|
val dnRegex = Regex("^([* .!%_`'~]|[+]|[-a-zA-Z0-9]){1,63}\$")
|
||||||
|
|||||||
@@ -155,8 +155,12 @@ class BaresipService: Service() {
|
|||||||
Api.log_level_set(ll)
|
Api.log_level_set(ll)
|
||||||
Log.logLevelSet(ll)
|
Log.logLevelSet(ll)
|
||||||
}
|
}
|
||||||
|
if (!contents.contains("prefer_ipv6")) {
|
||||||
|
contents = "prefer_ipv6 no\n${contents}"
|
||||||
|
write = true
|
||||||
|
}
|
||||||
if (write) {
|
if (write) {
|
||||||
Log.d(LOG_TAG, "Writing $contents")
|
Log.d(LOG_TAG, "Writing '$contents'")
|
||||||
Utils.putFileContents(file, contents)
|
Utils.putFileContents(file, contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,14 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
internal lateinit var configFile: File
|
internal lateinit var configFile: File
|
||||||
internal lateinit var autoStart: CheckBox
|
internal lateinit var autoStart: CheckBox
|
||||||
|
internal lateinit var preferIPv6: CheckBox
|
||||||
internal lateinit var dnsServers: EditText
|
internal lateinit var dnsServers: EditText
|
||||||
internal lateinit var opusBitRate: EditText
|
internal lateinit var opusBitRate: EditText
|
||||||
internal lateinit var iceLite: CheckBox
|
internal lateinit var iceLite: CheckBox
|
||||||
internal lateinit var debug: CheckBox
|
internal lateinit var debug: CheckBox
|
||||||
|
|
||||||
private var oldAutoStart = ""
|
private var oldAutoStart = ""
|
||||||
|
private var oldPreferIPv6 = ""
|
||||||
private var oldDnsServers = ""
|
private var oldDnsServers = ""
|
||||||
private var oldOpusBitrate = ""
|
private var oldOpusBitrate = ""
|
||||||
private var oldIceMode = ""
|
private var oldIceMode = ""
|
||||||
@@ -47,6 +49,11 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
oldAutoStart = if (asCv.size == 0) "no" else asCv[0]
|
oldAutoStart = if (asCv.size == 0) "no" else asCv[0]
|
||||||
autoStart.isChecked = oldAutoStart == "yes"
|
autoStart.isChecked = oldAutoStart == "yes"
|
||||||
|
|
||||||
|
preferIPv6 = findViewById(R.id.PreferIPv6) as CheckBox
|
||||||
|
val piCv = Utils.getNameValue(config, "prefer_ipv6")
|
||||||
|
oldPreferIPv6 = if (piCv.size == 0) "no" else piCv[0]
|
||||||
|
preferIPv6.isChecked = oldPreferIPv6 == "yes"
|
||||||
|
|
||||||
dnsServers = findViewById(R.id.DnsServers) as EditText
|
dnsServers = findViewById(R.id.DnsServers) as EditText
|
||||||
val dsCv = Utils.getNameValue(config, "dns_server")
|
val dsCv = Utils.getNameValue(config, "dns_server")
|
||||||
var dsTv = ""
|
var dsTv = ""
|
||||||
@@ -96,7 +103,16 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
restart = false
|
restart = false
|
||||||
}
|
}
|
||||||
|
|
||||||
val dnsServers = dnsServers.text.toString().trim()
|
var preferIPv6String = "no"
|
||||||
|
if (preferIPv6.isChecked) preferIPv6String = "yes"
|
||||||
|
if (oldPreferIPv6 != preferIPv6String) {
|
||||||
|
config = Utils.removeLinesStartingWithName(config, "prefer_ipv6")
|
||||||
|
config = "prefer_ipv6 $preferIPv6String\n$config"
|
||||||
|
save = true
|
||||||
|
restart = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val dnsServers = dnsServers.text.toString().trim().toLowerCase()
|
||||||
if (dnsServers != oldDnsServers) {
|
if (dnsServers != oldDnsServers) {
|
||||||
if (!checkDnsServers(dnsServers)) {
|
if (!checkDnsServers(dnsServers)) {
|
||||||
Utils.alertView(this, "Notice", "Invalid DNS Servers: $dnsServers")
|
Utils.alertView(this, "Notice", "Invalid DNS Servers: $dnsServers")
|
||||||
@@ -148,6 +164,7 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
// Log.d("Baresip", "Config line $trimmedLine")
|
// Log.d("Baresip", "Config line $trimmedLine")
|
||||||
newConfig += trimmedLine.split("#")[0] + "\n"
|
newConfig += trimmedLine.split("#")[0] + "\n"
|
||||||
}
|
}
|
||||||
|
Log.d("Baresip", "New config '$newConfig'")
|
||||||
Utils.putFileContents(configFile, newConfig)
|
Utils.putFileContents(configFile, newConfig)
|
||||||
// Api.reload_config()
|
// Api.reload_config()
|
||||||
}
|
}
|
||||||
@@ -172,6 +189,9 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
findViewById(R.id.AutoStartTitle) as TextView-> {
|
findViewById(R.id.AutoStartTitle) as TextView-> {
|
||||||
Utils.alertView(this, "Start Automatically", getString(R.string.autoStart))
|
Utils.alertView(this, "Start Automatically", getString(R.string.autoStart))
|
||||||
}
|
}
|
||||||
|
findViewById(R.id.PreferIPv6Title) as TextView-> {
|
||||||
|
Utils.alertView(this, "Prefer IPv6", getString(R.string.preferIPv6))
|
||||||
|
}
|
||||||
findViewById(R.id.DnsServersTitle) as TextView -> {
|
findViewById(R.id.DnsServersTitle) as TextView -> {
|
||||||
Utils.alertView(this, "DNS Servers", getString(R.string.dnsServers))
|
Utils.alertView(this, "DNS Servers", getString(R.string.dnsServers))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,11 +244,6 @@ object Utils {
|
|||||||
return checkDomain(userDomain[1]) || checkIP(userDomain[1])
|
return checkDomain(userDomain[1]) || checkIP(userDomain[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkOutboundUri(uri: String): Boolean {
|
|
||||||
if (!uri.startsWith("sip:")) return false
|
|
||||||
return checkHostPortParams(uri.substring(4))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun checkPrintAscii(s: String): Boolean {
|
fun checkPrintAscii(s: String): Boolean {
|
||||||
if (s == "") return true
|
if (s == "") return true
|
||||||
return Regex("^[ -~]*\$").matches(s)
|
return Regex("^[ -~]*\$").matches(s)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/DnsServersTitle"
|
android:id="@+id/PreferIPv6Title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
@@ -55,20 +55,39 @@
|
|||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:onClick="onClick"
|
android:onClick="onClick"
|
||||||
android:text="DNS Servers" >
|
android:text="Prefer IPv6" >
|
||||||
</TextView>
|
</TextView>
|
||||||
<EditText
|
<CheckBox
|
||||||
android:id="@+id/DnsServers"
|
android:id="@+id/PreferIPv6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_toEndOf="@+id/DnsServersTitle"
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_gravity="end"
|
||||||
android:textSize="18sp"
|
android:checked="false" >
|
||||||
android:scrollHorizontally="true" >
|
</CheckBox>
|
||||||
</EditText>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/DnsServersTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:paddingTop="6dp"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:text="DNS Servers"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:textSize="18sp">
|
||||||
|
</TextView>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/DnsServers"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textSize="18sp">
|
||||||
|
</EditText>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -20,7 +20,10 @@
|
|||||||
<string name="obProxies">SIP URI of one or two proxies that must be used when sending requests.
|
<string name="obProxies">SIP URI of one or two proxies that must be used when sending requests.
|
||||||
If two is given, REGISTER requests are sent to both and other requests are sent to
|
If two is given, REGISTER requests are sent to both and other requests are sent to
|
||||||
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. If hostpart of SIP URI is an IPv6
|
||||||
|
address, the address must be written inside brackets [].\nExamples:\n
|
||||||
|
• sip:foo.com:5060;transport=tls\n
|
||||||
|
• sip:[2001:67c:223:777::10]:5060;transport=tcp
|
||||||
</string>
|
</string>
|
||||||
<string name="register">If checked, registration is enabled and REGISTER requests are sent at
|
<string name="register">If checked, registration is enabled and REGISTER requests are sent at
|
||||||
12 minute intervals.
|
12 minute intervals.
|
||||||
@@ -51,8 +54,11 @@
|
|||||||
<string name="defaultAccount">If checked, this account is selected when baresip is started.
|
<string name="defaultAccount">If checked, this account is selected when baresip is started.
|
||||||
</string>>
|
</string>>
|
||||||
<string name="autoStart">If checked, baresip starts automatically after device (re)start.</string>
|
<string name="autoStart">If checked, baresip starts automatically after device (re)start.</string>
|
||||||
|
<string name="preferIPv6">Prefer IPv6 if both IPv4 and IPv6 are available.</string>
|
||||||
<string name="dnsServers">Comma separated list of DNS servers. Each DNS server is of form
|
<string name="dnsServers">Comma separated list of DNS servers. Each DNS server is of form
|
||||||
server:port. Factory default value is \'8.8.8.8:53\' pointing to public Google DNS server.</string>
|
\'server:port\'. If server is an IPv6 address, the address must be written inside brackets [].
|
||||||
|
Factory default value is \'8.8.8.8:53,[2001:4860:4860::8888]:53\' pointing to public Google
|
||||||
|
DNS servers.</string>
|
||||||
<string name="opusBitRate">Average maximum bit rate used by Opus audio stream.
|
<string name="opusBitRate">Average maximum bit rate used by Opus audio stream.
|
||||||
Valid value are 6000-510000. Factory default is 28000.</string>
|
Valid value are 6000-510000. Factory default is 28000.</string>
|
||||||
<string name="iceLite">If checked, ICE Lite Mode is used.</string>
|
<string name="iceLite">If checked, ICE Lite Mode is used.</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user