Show diverter if incoming call has been diverted
This commit is contained in:
@ -1296,6 +1296,15 @@ Java_com_tutpro_baresip_Api_call_1replace_1transfer(JNIEnv *env, jobject thiz, j
|
||||
return res == 0 ? true : false;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_tutpro_baresip_Api_call_1diverter_1uri(JNIEnv *env, jobject thiz, jlong call)
|
||||
{
|
||||
const char *uri = call_diverteruri((struct call *)call);
|
||||
if (uri)
|
||||
return (*env)->NewStringUTF(env, uri);
|
||||
return (*env)->NewStringUTF(env, "");
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_tutpro_baresip_Api_message_1send(JNIEnv *env, jobject thiz, jlong ua, jstring jPeer, jstring jMsg, jstring jTime)
|
||||
{
|
||||
|
||||
@ -72,6 +72,7 @@ object Api {
|
||||
external fun call_has_video(callp: Long): Boolean
|
||||
external fun call_replaces(callp: Long): Boolean
|
||||
external fun call_replace_transfer(xfer_callp: Long, callp: Long): Boolean
|
||||
external fun call_diverter_uri(callp: Long): String
|
||||
|
||||
external fun calls_mute(mute: Boolean)
|
||||
|
||||
|
||||
@ -648,8 +648,7 @@ class BaresipService: Service() {
|
||||
newEvent = "call rejected"
|
||||
} else {
|
||||
Log.d(TAG, "Incoming call $uap/$callp/$peerUri")
|
||||
Call(callp, ua, peerUri, "in", "incoming",
|
||||
Utils.dtmfWatcher(callp)).add()
|
||||
Call(callp, ua, peerUri, "in", "incoming", Utils.dtmfWatcher(callp)).add()
|
||||
if (ua.account.answerMode == Api.ANSWERMODE_MANUAL) {
|
||||
if (VERSION.SDK_INT >= 23) {
|
||||
Log.d(TAG, "CurrentInterruptionFilter ${nm.currentInterruptionFilter}")
|
||||
|
||||
@ -78,6 +78,10 @@ class Call(val callp: Long, val ua: UserAgent, val peerUri: String, val dir: Str
|
||||
return Api.call_replaces(callp)
|
||||
}
|
||||
|
||||
fun diverterUri(): String {
|
||||
return Api.call_diverter_uri(callp)
|
||||
}
|
||||
|
||||
init {
|
||||
if (ua.account.mediaEnc != "") security = R.drawable.box_red
|
||||
}
|
||||
|
||||
@ -46,6 +46,8 @@ class MainActivity : AppCompatActivity() {
|
||||
private lateinit var callTimer: Chronometer
|
||||
private lateinit var callUri: AutoCompleteTextView
|
||||
private lateinit var securityButton: ImageButton
|
||||
private lateinit var diverter: LinearLayout
|
||||
private lateinit var diverterUri: TextView
|
||||
private lateinit var callButton: ImageButton
|
||||
private lateinit var hangupButton: ImageButton
|
||||
private lateinit var answerButton: ImageButton
|
||||
@ -128,6 +130,8 @@ class MainActivity : AppCompatActivity() {
|
||||
callTimer = binding.callTimer
|
||||
callUri = binding.callUri
|
||||
securityButton = binding.securityButton
|
||||
diverter = binding.diverter
|
||||
diverterUri = binding.diverterUri
|
||||
callButton = binding.callButton
|
||||
hangupButton = binding.hangupButton
|
||||
answerButton = binding.answerButton
|
||||
@ -1797,6 +1801,7 @@ class MainActivity : AppCompatActivity() {
|
||||
callUri.setAdapter(ArrayAdapter(this, android.R.layout.select_dialog_item,
|
||||
Contact.contactNames()))
|
||||
securityButton.visibility = View.INVISIBLE
|
||||
diverter.visibility = View.GONE
|
||||
callButton.visibility = View.VISIBLE
|
||||
callButton.isEnabled = true
|
||||
hangupButton.visibility = View.INVISIBLE
|
||||
@ -1822,6 +1827,7 @@ class MainActivity : AppCompatActivity() {
|
||||
callUri.setText(Utils.friendlyUri(this, Contact.contactName(call.peerUri),
|
||||
Utils.aorDomain(ua.account.aor)))
|
||||
securityButton.visibility = View.INVISIBLE
|
||||
diverter.visibility = View.GONE
|
||||
callButton.visibility = View.INVISIBLE
|
||||
hangupButton.visibility = View.VISIBLE
|
||||
hangupButton.isEnabled = true
|
||||
@ -1838,6 +1844,14 @@ class MainActivity : AppCompatActivity() {
|
||||
Utils.aorDomain(ua.account.aor)))
|
||||
callUri.setAdapter(null)
|
||||
securityButton.visibility = View.INVISIBLE
|
||||
val uri = call.diverterUri()
|
||||
if (uri != "") {
|
||||
diverterUri.text = Utils.friendlyUri(this, Contact.contactName(uri),
|
||||
Utils.aorDomain(ua.account.aor))
|
||||
diverter.visibility = View.VISIBLE
|
||||
} else {
|
||||
diverter.visibility = View.GONE
|
||||
}
|
||||
callButton.visibility = View.INVISIBLE
|
||||
hangupButton.visibility = View.INVISIBLE
|
||||
answerButton.visibility = View.VISIBLE
|
||||
|
||||
@ -84,8 +84,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/callTitleRow"
|
||||
android:paddingBottom="10dp" >
|
||||
android:layout_below="@id/callTitleRow" >
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/callUri"
|
||||
@ -110,12 +109,45 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/diverter"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/uriRow"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:gravity="start"
|
||||
android:text="@string/diverted_by_dots"
|
||||
android:textSize="20sp">
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/diverterUri"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:textColor="@color/colorStrong"
|
||||
android:textSize="20sp"
|
||||
android:layout_weight="1" >
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/callRow"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/uriRow"
|
||||
android:layout_below="@id/diverter"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp" >
|
||||
|
||||
<ImageButton
|
||||
|
||||
@ -439,6 +439,7 @@
|
||||
<string name="quit">Lopeta</string>
|
||||
<string name="outgoing_call_to_dots">Puhelu ulos …</string>
|
||||
<string name="incoming_call_from_dots">Puhelu sisään …</string>
|
||||
<string name="diverted_by_dots">Siirtäjä …</string>
|
||||
<string name="transferring_call_to_dots">Puhelun siirto …</string>
|
||||
<string name="invalid_sip_uri">Virheellinen SIP URI \'%1$s\'</string>
|
||||
<string name="no_telephony_providers">Millekään tilille ei ole konfiguroitu puhelinpalvelun
|
||||
|
||||
@ -399,6 +399,7 @@
|
||||
<string name="quit">Quit</string>
|
||||
<string name="outgoing_call_to_dots">Call to …</string>
|
||||
<string name="incoming_call_from_dots">Call from …</string>
|
||||
<string name="diverted_by_dots">Diverted by …</string>
|
||||
<string name="transferring_call_to_dots">Transferring call to …</string>
|
||||
<string name="invalid_sip_uri">Invalid SIP URI \'%1$s\'</string>
|
||||
<string name="no_telephony_providers">Telephony Provider has not been configured for any account.</string>
|
||||
|
||||
Reference in New Issue
Block a user