RingRTC v2.4.0 Release Integration.

Co-authored-by: Peter Thatcher <peter@signal.org>
master
Jim Gustafson 2020-07-29 20:07:05 -07:00 committed by Greyson Parrelli
parent 550b121990
commit a942293a74
11 changed files with 154 additions and 108 deletions

View File

@ -304,7 +304,7 @@ dependencies {
implementation 'org.signal:argon2:13.1@aar' implementation 'org.signal:argon2:13.1@aar'
implementation 'org.signal:ringrtc-android:2.3.1' implementation 'org.signal:ringrtc-android:2.4.1'
implementation "me.leolin:ShortcutBadger:1.1.16" implementation "me.leolin:ShortcutBadger:1.1.16"
implementation 'se.emilsjolander:stickylistheaders:2.7.0' implementation 'se.emilsjolander:stickylistheaders:2.7.0'

View File

@ -508,7 +508,8 @@ public final class PushProcessMessageJob extends BaseJob {
.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId()) .putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId())
.putExtra(WebRtcCallService.EXTRA_REMOTE_PEER, remotePeer) .putExtra(WebRtcCallService.EXTRA_REMOTE_PEER, remotePeer)
.putExtra(WebRtcCallService.EXTRA_REMOTE_DEVICE, content.getSenderDevice()) .putExtra(WebRtcCallService.EXTRA_REMOTE_DEVICE, content.getSenderDevice())
.putExtra(WebRtcCallService.EXTRA_OFFER_DESCRIPTION, message.getDescription()) .putExtra(WebRtcCallService.EXTRA_OFFER_OPAQUE, message.getOpaque())
.putExtra(WebRtcCallService.EXTRA_OFFER_SDP, message.getSdp())
.putExtra(WebRtcCallService.EXTRA_SERVER_RECEIVED_TIMESTAMP, content.getServerReceivedTimestamp()) .putExtra(WebRtcCallService.EXTRA_SERVER_RECEIVED_TIMESTAMP, content.getServerReceivedTimestamp())
.putExtra(WebRtcCallService.EXTRA_SERVER_DELIVERED_TIMESTAMP, content.getServerDeliveredTimestamp()) .putExtra(WebRtcCallService.EXTRA_SERVER_DELIVERED_TIMESTAMP, content.getServerDeliveredTimestamp())
.putExtra(WebRtcCallService.EXTRA_OFFER_TYPE, message.getType().getCode()) .putExtra(WebRtcCallService.EXTRA_OFFER_TYPE, message.getType().getCode())
@ -527,11 +528,12 @@ public final class PushProcessMessageJob extends BaseJob {
RemotePeer remotePeer = new RemotePeer(Recipient.externalHighTrustPush(context, content.getSender()).getId()); RemotePeer remotePeer = new RemotePeer(Recipient.externalHighTrustPush(context, content.getSender()).getId());
intent.setAction(WebRtcCallService.ACTION_RECEIVE_ANSWER) intent.setAction(WebRtcCallService.ACTION_RECEIVE_ANSWER)
.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId()) .putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId())
.putExtra(WebRtcCallService.EXTRA_REMOTE_PEER, remotePeer) .putExtra(WebRtcCallService.EXTRA_REMOTE_PEER, remotePeer)
.putExtra(WebRtcCallService.EXTRA_REMOTE_DEVICE, content.getSenderDevice()) .putExtra(WebRtcCallService.EXTRA_REMOTE_DEVICE, content.getSenderDevice())
.putExtra(WebRtcCallService.EXTRA_ANSWER_DESCRIPTION, message.getDescription()) .putExtra(WebRtcCallService.EXTRA_ANSWER_OPAQUE, message.getOpaque())
.putExtra(WebRtcCallService.EXTRA_MULTI_RING, content.getCallMessage().get().isMultiRing()); .putExtra(WebRtcCallService.EXTRA_ANSWER_SDP, message.getSdp())
.putExtra(WebRtcCallService.EXTRA_MULTI_RING, content.getCallMessage().get().isMultiRing());
context.startService(intent); context.startService(intent);
} }

View File

@ -4,9 +4,11 @@ import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.signal.ringrtc.CallId; import com.google.protobuf.ByteString;
import org.signal.ringrtc.CallId;
import org.signal.ringrtc.IceCandidate;
import org.webrtc.IceCandidate;
import org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage; import org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage;
/** /**
@ -24,14 +26,11 @@ public class IceCandidateParcel implements Parcelable {
} }
public IceCandidateParcel(@NonNull IceUpdateMessage iceUpdateMessage) { public IceCandidateParcel(@NonNull IceUpdateMessage iceUpdateMessage) {
this.iceCandidate = new IceCandidate(iceUpdateMessage.getSdpMid(), this.iceCandidate = new IceCandidate(iceUpdateMessage.getOpaque(), iceUpdateMessage.getSdp());
iceUpdateMessage.getSdpMLineIndex(),
iceUpdateMessage.getSdp());
} }
private IceCandidateParcel(@NonNull Parcel in) { private IceCandidateParcel(@NonNull Parcel in) {
this.iceCandidate = new IceCandidate(in.readString(), this.iceCandidate = new IceCandidate(in.createByteArray(),
in.readInt(),
in.readString()); in.readString());
} }
@ -41,9 +40,8 @@ public class IceCandidateParcel implements Parcelable {
public @NonNull IceUpdateMessage getIceUpdateMessage(@NonNull CallId callId) { public @NonNull IceUpdateMessage getIceUpdateMessage(@NonNull CallId callId) {
return new IceUpdateMessage(callId.longValue(), return new IceUpdateMessage(callId.longValue(),
iceCandidate.sdpMid, iceCandidate.getOpaque(),
iceCandidate.sdpMLineIndex, iceCandidate.getSdp());
iceCandidate.sdp);
} }
@Override @Override
@ -53,9 +51,8 @@ public class IceCandidateParcel implements Parcelable {
@Override @Override
public void writeToParcel(@NonNull Parcel dest, int flags) { public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(iceCandidate.sdpMid); dest.writeByteArray(iceCandidate.getOpaque());
dest.writeInt(iceCandidate.sdpMLineIndex); dest.writeString(iceCandidate.getSdp());
dest.writeString(iceCandidate.sdp);
} }
public static final Creator<IceCandidateParcel> CREATOR = new Creator<IceCandidateParcel>() { public static final Creator<IceCandidateParcel> CREATOR = new Creator<IceCandidateParcel>() {

View File

@ -17,11 +17,14 @@ import android.util.Pair;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.protobuf.ByteString;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.signal.ringrtc.CallException; import org.signal.ringrtc.CallException;
import org.signal.ringrtc.CallId; import org.signal.ringrtc.CallId;
import org.signal.ringrtc.CallManager; import org.signal.ringrtc.CallManager;
import org.signal.ringrtc.CallManager.CallEvent; import org.signal.ringrtc.CallManager.CallEvent;
import org.signal.ringrtc.IceCandidate;
import org.signal.ringrtc.Remote; import org.signal.ringrtc.Remote;
import org.thoughtcrime.securesms.ApplicationContext; import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.WebRtcCallActivity; import org.thoughtcrime.securesms.WebRtcCallActivity;
@ -56,7 +59,6 @@ import org.thoughtcrime.securesms.webrtc.audio.OutgoingRinger;
import org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager; import org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager;
import org.thoughtcrime.securesms.webrtc.locks.LockManager; import org.thoughtcrime.securesms.webrtc.locks.LockManager;
import org.webrtc.EglBase; import org.webrtc.EglBase;
import org.webrtc.IceCandidate;
import org.webrtc.PeerConnection; import org.webrtc.PeerConnection;
import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.signalservice.api.SignalServiceAccountManager; import org.whispersystems.signalservice.api.SignalServiceAccountManager;
@ -105,13 +107,15 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
public static final String EXTRA_BLUETOOTH = "audio_bluetooth"; public static final String EXTRA_BLUETOOTH = "audio_bluetooth";
public static final String EXTRA_REMOTE_PEER = "remote_peer"; public static final String EXTRA_REMOTE_PEER = "remote_peer";
public static final String EXTRA_REMOTE_DEVICE = "remote_device"; public static final String EXTRA_REMOTE_DEVICE = "remote_device";
public static final String EXTRA_OFFER_DESCRIPTION = "offer_description"; public static final String EXTRA_OFFER_OPAQUE = "offer_opaque";
public static final String EXTRA_OFFER_SDP = "offer_sdp";
public static final String EXTRA_OFFER_TYPE = "offer_type"; public static final String EXTRA_OFFER_TYPE = "offer_type";
public static final String EXTRA_MULTI_RING = "multi_ring"; public static final String EXTRA_MULTI_RING = "multi_ring";
public static final String EXTRA_HANGUP_TYPE = "hangup_type"; public static final String EXTRA_HANGUP_TYPE = "hangup_type";
public static final String EXTRA_HANGUP_IS_LEGACY = "hangup_is_legacy"; public static final String EXTRA_HANGUP_IS_LEGACY = "hangup_is_legacy";
public static final String EXTRA_HANGUP_DEVICE_ID = "hangup_device_id"; public static final String EXTRA_HANGUP_DEVICE_ID = "hangup_device_id";
public static final String EXTRA_ANSWER_DESCRIPTION = "answer_description"; public static final String EXTRA_ANSWER_OPAQUE = "answer_opaque";
public static final String EXTRA_ANSWER_SDP = "answer_sdp";
public static final String EXTRA_ICE_CANDIDATES = "ice_candidates"; public static final String EXTRA_ICE_CANDIDATES = "ice_candidates";
public static final String EXTRA_ENABLE = "enable_value"; public static final String EXTRA_ENABLE = "enable_value";
public static final String EXTRA_BROADCAST = "broadcast"; public static final String EXTRA_BROADCAST = "broadcast";
@ -389,7 +393,8 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
CallId callId = getCallId(intent); CallId callId = getCallId(intent);
RemotePeer remotePeer = getRemotePeer(intent); RemotePeer remotePeer = getRemotePeer(intent);
Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1); Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1);
String offer = intent.getStringExtra(EXTRA_OFFER_DESCRIPTION); byte[] opaque = intent.getByteArrayExtra(EXTRA_OFFER_OPAQUE);
String sdp = intent.getStringExtra(EXTRA_OFFER_SDP);
long serverReceivedTimestamp = intent.getLongExtra(EXTRA_SERVER_RECEIVED_TIMESTAMP, -1); long serverReceivedTimestamp = intent.getLongExtra(EXTRA_SERVER_RECEIVED_TIMESTAMP, -1);
long serverDeliveredTimestamp = intent.getLongExtra(EXTRA_SERVER_DELIVERED_TIMESTAMP, -1); long serverDeliveredTimestamp = intent.getLongExtra(EXTRA_SERVER_DELIVERED_TIMESTAMP, -1);
OfferMessage.Type offerType = OfferMessage.Type.fromCode(intent.getStringExtra(EXTRA_OFFER_TYPE)); OfferMessage.Type offerType = OfferMessage.Type.fromCode(intent.getStringExtra(EXTRA_OFFER_TYPE));
@ -422,7 +427,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
Log.i(TAG, "handleReceivedOffer(): messageAgeSec: " + messageAgeSec + ", serverReceivedTimestamp: " + serverReceivedTimestamp + ", serverDeliveredTimestamp: " + serverDeliveredTimestamp); Log.i(TAG, "handleReceivedOffer(): messageAgeSec: " + messageAgeSec + ", serverReceivedTimestamp: " + serverReceivedTimestamp + ", serverDeliveredTimestamp: " + serverDeliveredTimestamp);
try { try {
callManager.receivedOffer(callId, remotePeer, remoteDevice, offer, messageAgeSec, callType, 1, isMultiRing, true); callManager.receivedOffer(callId, remotePeer, remoteDevice, opaque, sdp, messageAgeSec, callType, 1, isMultiRing, true);
} catch (CallException e) { } catch (CallException e) {
callFailure("Unable to process received offer: ", e); callFailure("Unable to process received offer: ", e);
} }
@ -620,9 +625,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
camera, camera,
iceServers, iceServers,
isAlwaysTurn, isAlwaysTurn,
deviceList, enableVideoOnCreate);
enableVideoOnCreate,
true);
} catch (CallException e) { } catch (CallException e) {
callFailure("Unable to proceed with call: ", e); callFailure("Unable to proceed with call: ", e);
} }
@ -664,9 +667,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
camera, camera,
iceServers, iceServers,
hideIp, hideIp,
deviceList, false);
false,
true);
} catch (CallException e) { } catch (CallException e) {
callFailure("Unable to proceed with call: ", e); callFailure("Unable to proceed with call: ", e);
} }
@ -704,12 +705,13 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
CallId callId = getCallId(intent); CallId callId = getCallId(intent);
Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1); Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1);
boolean broadcast = intent.getBooleanExtra(EXTRA_BROADCAST, false); boolean broadcast = intent.getBooleanExtra(EXTRA_BROADCAST, false);
String offer = intent.getStringExtra(EXTRA_OFFER_DESCRIPTION); byte[] opaque = intent.getByteArrayExtra(EXTRA_OFFER_OPAQUE);
String sdp = intent.getStringExtra(EXTRA_OFFER_SDP);
OfferMessage.Type offerType = OfferMessage.Type.fromCode(intent.getStringExtra(EXTRA_OFFER_TYPE)); OfferMessage.Type offerType = OfferMessage.Type.fromCode(intent.getStringExtra(EXTRA_OFFER_TYPE));
Log.i(TAG, "handleSendOffer: id: " + callId.format(remoteDevice)); Log.i(TAG, "handleSendOffer: id: " + callId.format(remoteDevice));
OfferMessage offerMessage = new OfferMessage(callId.longValue(), offer, offerType); OfferMessage offerMessage = new OfferMessage(callId.longValue(), sdp, offerType, opaque);
Integer destinationDeviceId = broadcast ? null : remoteDevice; Integer destinationDeviceId = broadcast ? null : remoteDevice;
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOffer(offerMessage, true, destinationDeviceId); SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOffer(offerMessage, true, destinationDeviceId);
@ -721,11 +723,12 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
CallId callId = getCallId(intent); CallId callId = getCallId(intent);
Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1); Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1);
boolean broadcast = intent.getBooleanExtra(EXTRA_BROADCAST, false); boolean broadcast = intent.getBooleanExtra(EXTRA_BROADCAST, false);
String answer = intent.getStringExtra(EXTRA_ANSWER_DESCRIPTION); byte[] opaque = intent.getByteArrayExtra(EXTRA_ANSWER_OPAQUE);
String sdp = intent.getStringExtra(EXTRA_ANSWER_SDP);
Log.i(TAG, "handleSendAnswer: id: " + callId.format(remoteDevice)); Log.i(TAG, "handleSendAnswer: id: " + callId.format(remoteDevice));
AnswerMessage answerMessage = new AnswerMessage(callId.longValue(), answer); AnswerMessage answerMessage = new AnswerMessage(callId.longValue(), sdp, opaque);
Integer destinationDeviceId = broadcast ? null : remoteDevice; Integer destinationDeviceId = broadcast ? null : remoteDevice;
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forAnswer(answerMessage, true, destinationDeviceId); SignalServiceCallMessage callMessage = SignalServiceCallMessage.forAnswer(answerMessage, true, destinationDeviceId);
@ -788,13 +791,14 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
private void handleReceivedAnswer(Intent intent) { private void handleReceivedAnswer(Intent intent) {
CallId callId = getCallId(intent); CallId callId = getCallId(intent);
Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1); Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1);
String description = intent.getStringExtra(EXTRA_ANSWER_DESCRIPTION); byte[] opaque = intent.getByteArrayExtra(EXTRA_ANSWER_OPAQUE);
String sdp = intent.getStringExtra(EXTRA_ANSWER_SDP);
boolean isMultiRing = intent.getBooleanExtra(EXTRA_MULTI_RING, false); boolean isMultiRing = intent.getBooleanExtra(EXTRA_MULTI_RING, false);
Log.i(TAG, "handleReceivedAnswer(): id: " + callId.format(remoteDevice)); Log.i(TAG, "handleReceivedAnswer(): id: " + callId.format(remoteDevice));
try { try {
callManager.receivedAnswer(callId, remoteDevice, description , isMultiRing); callManager.receivedAnswer(callId, remoteDevice, opaque, sdp, isMultiRing);
} catch (CallException e) { } catch (CallException e) {
callFailure("receivedAnswer() failed: ", e); callFailure("receivedAnswer() failed: ", e);
} }
@ -1802,7 +1806,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
} }
@Override @Override
public void onSendOffer(CallId callId, Remote remote, Integer remoteDevice, Boolean broadcast, String offer, CallManager.CallMediaType callMediaType) { public void onSendOffer(CallId callId, Remote remote, Integer remoteDevice, Boolean broadcast, byte[] opaque, String sdp, CallManager.CallMediaType callMediaType) {
Log.i(TAG, "onSendOffer: id: " + callId.format(remoteDevice) + " type: " + callMediaType.name()); Log.i(TAG, "onSendOffer: id: " + callId.format(remoteDevice) + " type: " + callMediaType.name());
if (remote instanceof RemotePeer) { if (remote instanceof RemotePeer) {
@ -1811,12 +1815,13 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
Intent intent = new Intent(this, WebRtcCallService.class); Intent intent = new Intent(this, WebRtcCallService.class);
intent.setAction(ACTION_SEND_OFFER) intent.setAction(ACTION_SEND_OFFER)
.putExtra(EXTRA_CALL_ID, callId.longValue()) .putExtra(EXTRA_CALL_ID, callId.longValue())
.putExtra(EXTRA_REMOTE_PEER, remotePeer) .putExtra(EXTRA_REMOTE_PEER, remotePeer)
.putExtra(EXTRA_REMOTE_DEVICE, remoteDevice) .putExtra(EXTRA_REMOTE_DEVICE, remoteDevice)
.putExtra(EXTRA_BROADCAST, broadcast) .putExtra(EXTRA_BROADCAST, broadcast)
.putExtra(EXTRA_OFFER_DESCRIPTION, offer) .putExtra(EXTRA_OFFER_OPAQUE, opaque)
.putExtra(EXTRA_OFFER_TYPE, offerType); .putExtra(EXTRA_OFFER_SDP, sdp)
.putExtra(EXTRA_OFFER_TYPE, offerType);
startService(intent); startService(intent);
} else { } else {
@ -1825,7 +1830,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
} }
@Override @Override
public void onSendAnswer(CallId callId, Remote remote, Integer remoteDevice, Boolean broadcast, String answer) { public void onSendAnswer(CallId callId, Remote remote, Integer remoteDevice, Boolean broadcast, byte[] opaque, String sdp) {
Log.i(TAG, "onSendAnswer: id: " + callId.format(remoteDevice)); Log.i(TAG, "onSendAnswer: id: " + callId.format(remoteDevice));
if (remote instanceof RemotePeer) { if (remote instanceof RemotePeer) {
@ -1833,11 +1838,12 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
Intent intent = new Intent(this, WebRtcCallService.class); Intent intent = new Intent(this, WebRtcCallService.class);
intent.setAction(ACTION_SEND_ANSWER) intent.setAction(ACTION_SEND_ANSWER)
.putExtra(EXTRA_CALL_ID, callId.longValue()) .putExtra(EXTRA_CALL_ID, callId.longValue())
.putExtra(EXTRA_REMOTE_PEER, remotePeer) .putExtra(EXTRA_REMOTE_PEER, remotePeer)
.putExtra(EXTRA_REMOTE_DEVICE, remoteDevice) .putExtra(EXTRA_REMOTE_DEVICE, remoteDevice)
.putExtra(EXTRA_BROADCAST, broadcast) .putExtra(EXTRA_BROADCAST, broadcast)
.putExtra(EXTRA_ANSWER_DESCRIPTION, answer); .putExtra(EXTRA_ANSWER_OPAQUE, opaque)
.putExtra(EXTRA_ANSWER_SDP, sdp);
startService(intent); startService(intent);
} else { } else {

View File

@ -432,8 +432,8 @@ dependencyVerification {
['org.signal:argon2:13.1', ['org.signal:argon2:13.1',
'0f686ccff0d4842bfcc74d92e8dc780a5f159b9376e37a1189fabbcdac458bef'], '0f686ccff0d4842bfcc74d92e8dc780a5f159b9376e37a1189fabbcdac458bef'],
['org.signal:ringrtc-android:2.3.1', ['org.signal:ringrtc-android:2.4.1',
'2860e38b3e01c25ff23abdb848bd3fd772ffddb4387ea7838b71e2400da1648d'], 'd120bb238d8435ab442a40e72d641f1fedc4492cc0eee894a1a63b7a17f2f126'],
['org.signal:signal-metadata-java:0.1.2', ['org.signal:signal-metadata-java:0.1.2',
'6aaeb6a33bf3161a3e6ac9db7678277f7a4cf5a2c96b84342e4007ee49bab1bd'], '6aaeb6a33bf3161a3e6ac9db7678277f7a4cf5a2c96b84342e4007ee49bab1bd'],

View File

@ -683,24 +683,51 @@ public class SignalServiceMessageSender {
if (callMessage.getOfferMessage().isPresent()) { if (callMessage.getOfferMessage().isPresent()) {
OfferMessage offer = callMessage.getOfferMessage().get(); OfferMessage offer = callMessage.getOfferMessage().get();
builder.setOffer(CallMessage.Offer.newBuilder() CallMessage.Offer.Builder offerBuilder = CallMessage.Offer.newBuilder()
.setId(offer.getId()) .setId(offer.getId())
.setDescription(offer.getDescription()) .setType(offer.getType().getProtoType());
.setType(offer.getType().getProtoType()));
if (offer.getOpaque() != null) {
offerBuilder.setOpaque(ByteString.copyFrom(offer.getOpaque()));
}
if (offer.getSdp() != null) {
offerBuilder.setSdp(offer.getSdp());
}
builder.setOffer(offerBuilder);
} else if (callMessage.getAnswerMessage().isPresent()) { } else if (callMessage.getAnswerMessage().isPresent()) {
AnswerMessage answer = callMessage.getAnswerMessage().get(); AnswerMessage answer = callMessage.getAnswerMessage().get();
builder.setAnswer(CallMessage.Answer.newBuilder() CallMessage.Answer.Builder answerBuilder = CallMessage.Answer.newBuilder()
.setId(answer.getId()) .setId(answer.getId());
.setDescription(answer.getDescription()));
if (answer.getOpaque() != null) {
answerBuilder.setOpaque(ByteString.copyFrom(answer.getOpaque()));
}
if (answer.getSdp() != null) {
answerBuilder.setSdp(answer.getSdp());
}
builder.setAnswer(answerBuilder);
} else if (callMessage.getIceUpdateMessages().isPresent()) { } else if (callMessage.getIceUpdateMessages().isPresent()) {
List<IceUpdateMessage> updates = callMessage.getIceUpdateMessages().get(); List<IceUpdateMessage> updates = callMessage.getIceUpdateMessages().get();
for (IceUpdateMessage update : updates) { for (IceUpdateMessage update : updates) {
builder.addIceUpdate(CallMessage.IceUpdate.newBuilder() CallMessage.IceUpdate.Builder iceBuilder = CallMessage.IceUpdate.newBuilder()
.setId(update.getId()) .setId(update.getId())
.setSdp(update.getSdp()) .setMid("audio")
.setSdpMid(update.getSdpMid()) .setLine(0);
.setSdpMLineIndex(update.getSdpMLineIndex()));
if (update.getOpaque() != null) {
iceBuilder.setOpaque(ByteString.copyFrom(update.getOpaque()));
}
if (update.getSdp() != null) {
iceBuilder.setSdp(update.getSdp());
}
builder.addIceUpdate(iceBuilder);
} }
} else if (callMessage.getHangupMessage().isPresent()) { } else if (callMessage.getHangupMessage().isPresent()) {
CallMessage.Hangup.Type protoType = callMessage.getHangupMessage().get().getType().getProtoType(); CallMessage.Hangup.Type protoType = callMessage.getHangupMessage().get().getType().getProtoType();

View File

@ -591,15 +591,15 @@ public final class SignalServiceContent {
if (content.hasOffer()) { if (content.hasOffer()) {
SignalServiceProtos.CallMessage.Offer offerContent = content.getOffer(); SignalServiceProtos.CallMessage.Offer offerContent = content.getOffer();
return SignalServiceCallMessage.forOffer(new OfferMessage(offerContent.getId(), offerContent.getDescription(), OfferMessage.Type.fromProto(offerContent.getType())), isMultiRing, destinationDeviceId); return SignalServiceCallMessage.forOffer(new OfferMessage(offerContent.getId(), offerContent.hasSdp() ? offerContent.getSdp() : null, OfferMessage.Type.fromProto(offerContent.getType()), offerContent.hasOpaque() ? offerContent.getOpaque().toByteArray() : null), isMultiRing, destinationDeviceId);
} else if (content.hasAnswer()) { } else if (content.hasAnswer()) {
SignalServiceProtos.CallMessage.Answer answerContent = content.getAnswer(); SignalServiceProtos.CallMessage.Answer answerContent = content.getAnswer();
return SignalServiceCallMessage.forAnswer(new AnswerMessage(answerContent.getId(), answerContent.getDescription()), isMultiRing, destinationDeviceId); return SignalServiceCallMessage.forAnswer(new AnswerMessage(answerContent.getId(), answerContent.hasSdp() ? answerContent.getSdp() : null, answerContent.hasOpaque() ? answerContent.getOpaque().toByteArray() : null), isMultiRing, destinationDeviceId);
} else if (content.getIceUpdateCount() > 0) { } else if (content.getIceUpdateCount() > 0) {
List<IceUpdateMessage> iceUpdates = new LinkedList<>(); List<IceUpdateMessage> iceUpdates = new LinkedList<>();
for (SignalServiceProtos.CallMessage.IceUpdate iceUpdate : content.getIceUpdateList()) { for (SignalServiceProtos.CallMessage.IceUpdate iceUpdate : content.getIceUpdateList()) {
iceUpdates.add(new IceUpdateMessage(iceUpdate.getId(), iceUpdate.getSdpMid(), iceUpdate.getSdpMLineIndex(), iceUpdate.getSdp())); iceUpdates.add(new IceUpdateMessage(iceUpdate.getId(), iceUpdate.hasOpaque() ? iceUpdate.getOpaque().toByteArray() : null, iceUpdate.hasSdp() ? iceUpdate.getSdp() : null));
} }
return SignalServiceCallMessage.forIceUpdates(iceUpdates, isMultiRing, destinationDeviceId); return SignalServiceCallMessage.forIceUpdates(iceUpdates, isMultiRing, destinationDeviceId);

View File

@ -4,18 +4,24 @@ package org.whispersystems.signalservice.api.messages.calls;
public class AnswerMessage { public class AnswerMessage {
private final long id; private final long id;
private final String description; private final String sdp;
private final byte[] opaque;
public AnswerMessage(long id, String description) { public AnswerMessage(long id, String sdp, byte[] opaque) {
this.id = id; this.id = id;
this.description = description; this.sdp = sdp;
this.opaque = opaque;
} }
public String getDescription() { public String getSdp() {
return description; return sdp;
} }
public long getId() { public long getId() {
return id; return id;
} }
public byte[] getOpaque() {
return opaque;
}
} }

View File

@ -4,30 +4,24 @@ package org.whispersystems.signalservice.api.messages.calls;
public class IceUpdateMessage { public class IceUpdateMessage {
private final long id; private final long id;
private final String sdpMid; private final byte[] opaque;
private final int sdpMLineIndex;
private final String sdp; private final String sdp;
public IceUpdateMessage(long id, String sdpMid, int sdpMLineIndex, String sdp) { public IceUpdateMessage(long id, byte[] opaque, String sdp) {
this.id = id; this.id = id;
this.sdpMid = sdpMid; this.opaque = opaque;
this.sdpMLineIndex = sdpMLineIndex; this.sdp = sdp;
this.sdp = sdp;
}
public String getSdpMid() {
return sdpMid;
}
public int getSdpMLineIndex() {
return sdpMLineIndex;
}
public String getSdp() {
return sdp;
} }
public long getId() { public long getId() {
return id; return id;
} }
public byte[] getOpaque() {
return opaque;
}
public String getSdp() {
return sdp;
}
} }

View File

@ -6,17 +6,19 @@ import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
public class OfferMessage { public class OfferMessage {
private final long id; private final long id;
private final String description; private final String sdp;
private final Type type; private final Type type;
private final byte[] opaque;
public OfferMessage(long id, String description, Type type) { public OfferMessage(long id, String sdp, Type type, byte[] opaque) {
this.id = id; this.id = id;
this.description = description; this.sdp = sdp;
this.type = type; this.type = type;
this.opaque = opaque;
} }
public String getDescription() { public String getSdp() {
return description; return sdp;
} }
public long getId() { public long getId() {
@ -27,6 +29,10 @@ public class OfferMessage {
return type; return type;
} }
public byte[] getOpaque() {
return opaque;
}
public enum Type { public enum Type {
AUDIO_CALL("audio_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_AUDIO_CALL), AUDIO_CALL("audio_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_AUDIO_CALL),
VIDEO_CALL("video_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_VIDEO_CALL); VIDEO_CALL("video_call", SignalServiceProtos.CallMessage.Offer.Type.OFFER_VIDEO_CALL);

View File

@ -49,21 +49,29 @@ message CallMessage {
// 2 is reserved, removed OFFER_NEED_PERMISSION // 2 is reserved, removed OFFER_NEED_PERMISSION
} }
optional uint64 id = 1; optional uint64 id = 1;
optional string description = 2; // Legacy/deprecated; replaced by 'opaque'
optional Type type = 3; optional string sdp = 2;
optional Type type = 3;
optional bytes opaque = 4;
} }
message Answer { message Answer {
optional uint64 id = 1; optional uint64 id = 1;
optional string description = 2; // Legacy/deprecated; replaced by 'opaque'
optional string sdp = 2;
optional bytes opaque = 3;
} }
message IceUpdate { message IceUpdate {
optional uint64 id = 1; optional uint64 id = 1;
optional string sdpMid = 2; // Legacy/deprecated; remove when old clients are gone.
optional uint32 sdpMLineIndex = 3; optional string mid = 2;
optional string sdp = 4; // Legacy/deprecated; remove when old clients are gone.
optional uint32 line = 3;
// Legacy/deprecated; replaced by 'opaque'
optional string sdp = 4;
optional bytes opaque = 5;
} }
message Busy { message Busy {