@@ -236,6 +236,7 @@ public class MessageGenerator extends AbstractGenerator {
public MessagePacket sessionProposal(final JingleConnectionManager.RtpSessionProposal proposal) {
final MessagePacket packet = new MessagePacket();
+ packet.setType(MessagePacket.TYPE_CHAT); //we want to carbon copy those
packet.setTo(proposal.with);
packet.setId(JingleRtpConnection.JINGLE_MESSAGE_ID_PREFIX+proposal.sessionId);
final Element propose = packet.addChild("propose", Namespace.JINGLE_MESSAGE);
@@ -247,6 +248,7 @@ public class MessageGenerator extends AbstractGenerator {
public MessagePacket sessionRetract(final JingleConnectionManager.RtpSessionProposal proposal) {
final MessagePacket packet = new MessagePacket();
+ packet.setType(MessagePacket.TYPE_CHAT); //we want to carbon copy those
packet.setTo(proposal.with);
final Element propose = packet.addChild("retract", Namespace.JINGLE_MESSAGE);
propose.setAttribute("id", proposal.sessionId);
@@ -8,7 +8,6 @@ import android.view.View;
import android.view.WindowManager;
import java.lang.ref.WeakReference;
-import java.util.Arrays;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
@@ -23,6 +22,8 @@ import rocks.xmpp.addr.Jid;
import static java.util.Arrays.asList;
+//TODO if last state was BUSY (or RETRY); we want to reset action to view or something so we donβt automatically call again on recreate
+
public class RtpSessionActivity extends XmppActivity implements XmppConnectionService.OnJingleRtpConnectionUpdate {
public static final String EXTRA_WITH = "with";
@@ -236,11 +236,29 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
case "retract":
receiveRetract(from, message);
break;
+ case "reject":
+ receiveReject(from, message);
+ break;
default:
break;
}
}
+ private void receiveReject(Jid from, Element message) {
+ final boolean originatedFromMyself = from.asBareJid().equals(id.account.getJid().asBareJid());
+ //reject from another one of my clients
+ if (originatedFromMyself) {
+ if (transition(State.REJECTED)) {
+ this.xmppConnectionService.getNotificationService().cancelIncomingCallNotification();
+ this.jingleConnectionManager.finishConnection(this);
+ } else {
+ Log.d(Config.LOGTAG,"not able to transition into REJECTED because already in "+this.state);
+ }
+ } else {
+ Log.d(Config.LOGTAG,id.account.getJid()+": ignoring reject from "+from+" for session with "+id.with);
+ }
+ }
+
private void receivePropose(final Jid from, final Element propose) {
final boolean originatedFromMyself = from.asBareJid().equals(id.account.getJid().asBareJid());
//TODO we can use initiator logic here
@@ -269,7 +287,14 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
} else {
Log.d(Config.LOGTAG, String.format("%s: ignoring proceed because we were not initializing", id.account.getJid().asBareJid()));
}
+ } else if (from.asBareJid().equals(id.account.getJid().asBareJid())) {
+ if (transition(State.ACCEPTED)) {
+ Log.d(Config.LOGTAG,id.account.getJid().asBareJid()+": moved session with "+id.with+" into state accepted after received carbon copied procced");
+ this.xmppConnectionService.getNotificationService().cancelIncomingCallNotification();
+ this.jingleConnectionManager.finishConnection(this);
+ }
} else {
+ //TODO a carbon copied proceed from another client of mine has the same logic as `accept`
Log.d(Config.LOGTAG, String.format("%s: ignoring proceed from %s. was expected from %s", id.account.getJid().asBareJid(), from, id.with));
}
}
@@ -442,6 +467,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
private void sendJingleMessage(final String action) {
final MessagePacket messagePacket = new MessagePacket();
+ messagePacket.setType(MessagePacket.TYPE_CHAT); //we want to carbon copy those
messagePacket.setTo(id.with);
messagePacket.addChild(action, Namespace.JINGLE_MESSAGE).setAttribute("id", id.sessionId);
Log.d(Config.LOGTAG, messagePacket.toString());