Work on adding support for account 100rel configuration
This commit is contained in:
@ -981,6 +981,19 @@ JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1rtcp_1mux(
|
||||
return account_set_rtcp_mux((struct account *)acc, value);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1rel100_1mode(
|
||||
JNIEnv *env, jobject thiz, jlong acc)
|
||||
{
|
||||
return account_rel100_mode((struct account *)acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1set_1rel100_1mode(
|
||||
JNIEnv *env, jobject thiz, jlong acc, jint jMode)
|
||||
{
|
||||
const uint32_t mode = (uint32_t)jMode;
|
||||
return account_set_rel100_mode((struct account *)acc, mode);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_tutpro_baresip_Api_account_1dtmfmode(
|
||||
JNIEnv *env, jobject thiz, jlong acc)
|
||||
{
|
||||
|
||||
@ -25,6 +25,7 @@ class Account(val accp: Long) {
|
||||
var configuredRegInt = REGISTRATION_INTERVAL
|
||||
var mediaEnc = Api.account_mediaenc(accp)
|
||||
var rtcpMux = Api.account_rtcp_mux(accp)
|
||||
var rel100Mode = Api.account_rel100_mode(accp)
|
||||
var dtmfMode = Api.account_dtmfmode(accp)
|
||||
var answerMode = Api.account_answermode(accp)
|
||||
var autoRedirect = Api.account_sip_autoredirect(accp)
|
||||
@ -123,7 +124,12 @@ class Account(val accp: Long) {
|
||||
if (mediaEnc != "") res += ";mediaenc=${mediaEnc}"
|
||||
|
||||
if (rtcpMux)
|
||||
res += ";rtcp_mux=yes"
|
||||
res += ";rtcp_mux=yes"
|
||||
|
||||
res += if (rel100Mode == Api.REL100_ENABLED)
|
||||
";100rel=yes"
|
||||
else
|
||||
";100rel=no"
|
||||
|
||||
res = if (vmUri == "")
|
||||
"$res;mwi=no"
|
||||
@ -136,7 +142,7 @@ class Account(val accp: Long) {
|
||||
if (autoRedirect)
|
||||
res += ";sip_autoredirect=yes"
|
||||
|
||||
res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;call_transfer=yes;100rel=no"
|
||||
res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;call_transfer=yes"
|
||||
|
||||
var extra = ""
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
private lateinit var mediaEnc: String
|
||||
private lateinit var mediaEncSpinner: Spinner
|
||||
private lateinit var rtcpCheck: CheckBox
|
||||
private lateinit var rel100Check: CheckBox
|
||||
private var dtmfMode = Api.DTMFMODE_RTP_EVENT
|
||||
private lateinit var dtmfModeSpinner: Spinner
|
||||
private var answerMode = Api.ANSWERMODE_MANUAL
|
||||
@ -95,6 +96,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
stunPass = binding.StunPass
|
||||
mediaEncSpinner = binding.mediaEncSpinner
|
||||
rtcpCheck = binding.RtcpMux
|
||||
rel100Check = binding.Rel100
|
||||
dtmfModeSpinner = binding.dtmfModeSpinner
|
||||
answerModeSpinner = binding.answerModeSpinner
|
||||
redirectModeSpinner = binding.redirectModeSpinner
|
||||
@ -191,7 +193,12 @@ class AccountActivity : AppCompatActivity() {
|
||||
if (text.isNotEmpty())
|
||||
acc.stunServer = text
|
||||
"rtcp-mux" ->
|
||||
acc.rtcpMux = text == "yes"
|
||||
it cacc.rtcpMux = text == "yes"
|
||||
"100rel-mode" ->
|
||||
acc.rel100Mode = if (text == "yes")
|
||||
Api.REL100_ENABLED
|
||||
else
|
||||
Api.REL100_DISABLED
|
||||
"dtmf-mode" ->
|
||||
if (text in arrayOf("rtp-event", "sip-info")) {
|
||||
acc.dtmfMode = if (text == "rtp-event")
|
||||
@ -307,6 +314,8 @@ class AccountActivity : AppCompatActivity() {
|
||||
|
||||
rtcpCheck.isChecked = acc.rtcpMux
|
||||
|
||||
rel100Check.isChecked = acc.rel100Mode == Api.REL100_ENABLED
|
||||
|
||||
dtmfMode = acc.dtmfMode
|
||||
val dtmfModeKeys = arrayListOf(Api.DTMFMODE_RTP_EVENT, Api.DTMFMODE_SIP_INFO)
|
||||
val dtmfModeVals = arrayListOf(getString(R.string.dtmf_inband), getString(R.string.dtmf_info))
|
||||
@ -620,6 +629,16 @@ class AccountActivity : AppCompatActivity() {
|
||||
Log.e(TAG, "Setting of account_rtc_mux failed")
|
||||
}
|
||||
|
||||
if (rel100Check.isChecked != (acc.rel100Mode == Api.REL100_ENABLED)) {
|
||||
val mode = if (rel100Check.isChecked) Api.REL100_ENABLED else Api.REL100_DISABLED
|
||||
if (Api.account_set_rel100_mode(acc.accp, mode) == 0) {
|
||||
acc.rel100Mode = Api.account_rel100_mode(acc.accp)
|
||||
Log.d(TAG, "New rel100Mode is ${acc.rel100Mode}")
|
||||
} else {
|
||||
Log.e(TAG, "Setting of account_rel100Mode failed")
|
||||
}
|
||||
}
|
||||
|
||||
if (dtmfMode != acc.dtmfMode) {
|
||||
if (Api.account_set_dtmfmode(acc.accp, dtmfMode) == 0) {
|
||||
acc.dtmfMode = Api.account_dtmfmode(acc.accp)
|
||||
@ -799,10 +818,10 @@ class AccountActivity : AppCompatActivity() {
|
||||
getString(R.string.media_encryption_help)
|
||||
)
|
||||
}
|
||||
binding.RtcpMuxTitle.setOnClickListener {
|
||||
binding.Rel100Title.setOnClickListener {
|
||||
Utils.alertView(
|
||||
this, getString(R.string.rtcp_mux),
|
||||
getString(R.string.rtcp_mux_help)
|
||||
this, getString(R.string.rel_100),
|
||||
getString(R.string.rel_100_help)
|
||||
)
|
||||
}
|
||||
binding.DtmfModeTitle.setOnClickListener {
|
||||
|
||||
@ -8,6 +8,9 @@ object Api {
|
||||
const val ANSWERMODE_AUTO = 2
|
||||
const val DTMFMODE_RTP_EVENT = 0
|
||||
const val DTMFMODE_SIP_INFO = 1
|
||||
const val REL100_DISABLED = 0
|
||||
const val REL100_ENABLED = 1
|
||||
// const cal REL100_REQUIRED = 2
|
||||
|
||||
const val SDP_INACTIVE = 0
|
||||
const val SDP_RECVONLY = 1
|
||||
@ -48,6 +51,8 @@ object Api {
|
||||
external fun account_set_answermode(acc: Long, mode: Int): Int
|
||||
external fun account_sip_autoredirect(acc: Long): Boolean
|
||||
external fun account_set_sip_autoredirect(acc: Long, allow: Boolean)
|
||||
external fun account_rel100_mode(acc: Long): Int
|
||||
external fun account_set_rel100_mode(acc: Long, mode: Int): Int
|
||||
external fun account_rtcp_mux(acc: Long): Boolean
|
||||
external fun account_set_rtcp_mux(acc: Long, value: Boolean): Int
|
||||
external fun account_dtmfmode(acc: Long): Int
|
||||
|
||||
@ -336,11 +336,37 @@
|
||||
</CheckBox>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="0dp"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:id="@+id/Rel100Title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@id/Rel100"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/rel_100" >
|
||||
</TextView>
|
||||
<CheckBox
|
||||
android:id="@+id/Rel100"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_gravity="end"
|
||||
android:layout_centerVertical="true"
|
||||
android:checked="false" >
|
||||
</CheckBox>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/DtmfModeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingTop="8dp"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/dtmf_mode" >
|
||||
</TextView>
|
||||
|
||||
@ -170,6 +170,8 @@
|
||||
<string name="prefer_ipv6_media_help">If checked, offer to use IPv6 media protocol (if available) when media protocol of peer cannot be automatically determined.</string>
|
||||
<string name="rtcp_mux">RTCP Multiplexing</string>
|
||||
<string name="rtcp_mux_help">If checked, RTP and RTCP packets are multiplexed on a single port (RFC 5761).</string>
|
||||
<string name="rel_100">Reliable Provisional Responses</string>
|
||||
<string name="rel_100_help">If checked, indicate support for reliable provisional responses.</string>
|
||||
<string name="dtmf_mode">DTMF Mode</string>
|
||||
<string name="dtmf_mode_help">Selects how DTMF tones 0–9, #, *, and A-D are sent.</string>
|
||||
<string name="dtmf_inband">In-band RTP Events</string>
|
||||
|
||||
Reference in New Issue
Block a user