mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 19:33:39 +00:00
Actually handle busy signal correctly
// FREEBIE
This commit is contained in:
parent
c09c7b6649
commit
b50a3fa2b8
@ -66,6 +66,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
import org.whispersystems.signalservice.api.messages.calls.AnswerMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.BusyMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.HangupMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.OfferMessage;
|
||||
@ -176,6 +177,7 @@ public class PushDecryptJob extends ContextJob {
|
||||
else if (message.getAnswerMessage().isPresent()) handleCallAnswerMessage(envelope, message.getAnswerMessage().get());
|
||||
else if (message.getIceUpdateMessages().isPresent()) handleCallIceUpdateMessage(envelope, message.getIceUpdateMessages().get());
|
||||
else if (message.getHangupMessage().isPresent()) handleCallHangupMessage(envelope, message.getHangupMessage().get(), smsMessageId);
|
||||
else if (message.getBusyMessage().isPresent()) handleCallBusyMessage(envelope, message.getBusyMessage().get());
|
||||
} else {
|
||||
Log.w(TAG, "Got unrecognized message...");
|
||||
}
|
||||
@ -268,6 +270,16 @@ public class PushDecryptJob extends ContextJob {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCallBusyMessage(@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull BusyMessage message)
|
||||
{
|
||||
Intent intent = new Intent(context, WebRtcCallService.class);
|
||||
intent.setAction(WebRtcCallService.ACTION_REMOTE_BUSY);
|
||||
intent.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId());
|
||||
intent.putExtra(WebRtcCallService.EXTRA_REMOTE_NUMBER, envelope.getSource());
|
||||
context.startService(intent);
|
||||
}
|
||||
|
||||
private void handleEndSessionMessage(@NonNull MasterSecretUnion masterSecret,
|
||||
@NonNull SignalServiceEnvelope envelope,
|
||||
@NonNull SignalServiceDataMessage message,
|
||||
|
@ -600,8 +600,8 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
||||
private void handleBusyMessage(Intent intent) {
|
||||
Log.w(TAG, "handleBusyMessage...");
|
||||
|
||||
Recipient recipient = getRemoteRecipient(intent);
|
||||
long callId = getCallId(intent);
|
||||
final Recipient recipient = getRemoteRecipient(intent);
|
||||
final long callId = getCallId(intent);
|
||||
|
||||
if (callState != CallState.STATE_DIALING || !Util.isEquals(this.callId, callId) || !recipient.equals(this.recipient)) {
|
||||
Log.w(TAG, "Got busy message for inactive session...");
|
||||
@ -614,7 +614,12 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
|
||||
serviceHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WebRtcCallService.this.terminate();
|
||||
Intent intent = new Intent(WebRtcCallService.this, WebRtcCallService.class);
|
||||
intent.setAction(ACTION_LOCAL_HANGUP);
|
||||
intent.putExtra(EXTRA_CALL_ID, intent.getLongExtra(EXTRA_CALL_ID, -1));
|
||||
intent.putExtra(EXTRA_REMOTE_NUMBER, intent.getStringExtra(EXTRA_REMOTE_NUMBER));
|
||||
|
||||
startService(intent);
|
||||
}
|
||||
}, WebRtcCallActivity.BUSY_SIGNAL_DELAY_FINISH);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user