support reject

This commit is contained in:
Daniel Gultsch 2020-04-08 10:46:26 +02:00
parent 7909a72d43
commit a11d506bf0
8 changed files with 34 additions and 3 deletions

View File

@ -162,6 +162,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
break;
case RINGING:
binding.status.setText(R.string.rtp_state_ringing);
break;
case DECLINED_OR_BUSY:
binding.status.setText(R.string.rtp_state_declined_or_busy);
break;
}
}
@ -174,13 +178,25 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
this.binding.rejectCall.hide();
this.binding.endCall.hide();
this.binding.acceptCall.hide();
} else if (state == RtpEndUserState.DECLINED_OR_BUSY) {
this.binding.rejectCall.hide();
this.binding.endCall.setImageResource(R.drawable.ic_clear_white_48dp);
this.binding.endCall.show();
this.binding.endCall.setOnClickListener(this::exit);
this.binding.acceptCall.hide();
} else {
this.binding.rejectCall.hide();
this.binding.endCall.setImageResource(R.drawable.ic_call_end_white_48dp);
this.binding.endCall.show();
this.binding.endCall.setOnClickListener(this::endCall);
this.binding.acceptCall.hide();
}
}
private void exit(View view) {
finish();
}
private Contact getWith() {
final AbstractJingleConnection.Id id = requireRtpConnection().getId();
final Account account = id.account;

View File

@ -77,6 +77,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
if (sessionId == null) {
return;
}
final boolean carbonCopy = from.asBareJid().equals(account.getJid().asBareJid());
final Jid with;
if (account.getJid().asBareJid().equals(from.asBareJid())) {
with = to;
@ -103,7 +104,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": unable to react to proposed " + namespace + " session");
}
} else if ("proceed".equals(message.getName())) {
if (!with.equals(from)) {
if (carbonCopy) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignore carbon copied proceed");
return;
}
@ -115,7 +116,20 @@ public class JingleConnectionManager extends AbstractConnectionManager {
rtpConnection.transitionOrThrow(AbstractJingleConnection.State.PROPOSED);
rtpConnection.deliveryMessage(from, message);
} else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + with);
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + with + " to deliver proceed");
}
}
} else if ("reject".equals(message.getName())) {
if (carbonCopy) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignore carbon copied reject");
return;
}
final RtpSessionProposal proposal = new RtpSessionProposal(account, with.asBareJid(), sessionId);
synchronized (rtpSessionProposals) {
if (rtpSessionProposals.remove(proposal) != null) {
mXmppConnectionService.notifyJingleRtpConnectionUpdate(account, proposal.with, proposal.sessionId, RtpEndUserState.DECLINED_OR_BUSY);
} else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": no rtp session proposal found for " + with + " to deliver reject");
}
}
} else {

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

View File

@ -896,6 +896,7 @@
<string name="dismiss_call">Dismiss</string>
<string name="rtp_state_finding_device">Locating devices</string>
<string name="rtp_state_ringing">Ringing</string>
<string name="rtp_state_declined_or_busy">Busy</string>
<plurals name="view_users">
<item quantity="one">View %1$d Participant</item>
<item quantity="other">View %1$d Participants</item>