Commit Graph

295 Commits (86aae78f1bddf76dcbd5e4cd21911bfc10fbfcbe)

Author SHA1 Message Date
Michael Kirk 2dcfb4e3b8 Send ICE updates immediately.
Now that SN changes do not block incoming messages, the caller does not
need to enqueue outgoing ICE updates.

However this introduces the possibility that the call recipient could
recieve an ICE update before their peerConnectionClient is set up - so
now we ensure that call service waits for it's peerConnectionClient
before processing incoming ICE updates.

// FREEBIE
8 years ago
Matthew Chen 1a400f8414 Respond to CR.
// FREEBIE
8 years ago
Matthew Chen b6531a8b5d If two users call each other at the same time, ensure they both see “busy”.
// FREEBIE
8 years ago
Michael Kirk f681712ea0 Code Cleanup
- make some logging clearer
- remove noisy unhelpful logging
- clearer method names

// FREEBIE
8 years ago
Michael Kirk d8330a2c4f Fix bluetooth audio for calls
Allow bluetooth in all call speaking modes. This was much simpler to fix
now that all call AudioSession mgmt happens in one method.

// FREEBIE
8 years ago
Matthew Chen 0244e134f5 Block device from sleeping during certain activities.
// FREEBIE
8 years ago
Michael Kirk 1f9f066fa9 print call record when declining a call
// FREEBIE
8 years ago
Michael Kirk 1e0cf89f7a Explanatory comment
// FREEBIE
8 years ago
Michael Kirk 43a3a4afaf play *after* stop
In theory this shouldn't make a difference, since we're not playing the
ringer twice, but in practice I fail to here ringer audio 50% of the
time (in DEBUG builds) while app is in the foreground.

// FREEBIE
8 years ago
Michael Kirk 8abde1dff8 Non-Callkit adapter plays audio from notification when app is in
background

// FREEBIE
8 years ago
Matthew Chen 3d0811c03f Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 029da7e0ce Hang up current call if we receive a call offer from the same user.
// FREEBIE
9 years ago
Matthew Chen 9fc92990f5 Improve logging in CallService.
// FREEBIE
9 years ago
Michael Kirk 39563ab8c2 present from signalsViewController so users don't get confused by being
dropped into a different thread when the call is over.

e.g. chatting with Alice, but Bob calls. When I end the call with Bob It
would be too easy to fire off a message assuming it's going to Bob.

// FREEBIE
9 years ago
Michael Kirk 36c09aeb84 cleanup ahead of PR
// FREEBIE
9 years ago
Michael Kirk ff93732ed7 WIP: fix call from contacts when signal hasn't been launched yet 9 years ago
Matthew Chen bd440f0878 Respond to post-holiday code reviews.
// FREEBIE
9 years ago
Matthew Chen 3bc73bea25 Don't return busy signal to untrusted callers.
// FREEBIE
9 years ago
Matthew Chen f5f506d06f Investigate “call stuck on connecting” issue.
// FREEBIE
9 years ago
Michael Kirk 1a3204bf46 create interaction in thread when missing call due to changed identity
// FREEBIE
9 years ago
Michael Kirk 8c592a373a log error on assertion failure
// FREEBIE
9 years ago
Michael Kirk c8d547a08f Only allow callback for identities that were not previously verified
// FREEBIE
9 years ago
Michael Kirk 1127553041 restore "confirm and callback" functionality
// FREEBIE
9 years ago
Michael Kirk 146031e4d5 update copy / remove some unused "unseen" tracking
// FREEBIE
9 years ago
Michael Kirk 41a34e572b Update Safety Number alerts to work with verification
// FREEBIE
9 years ago
Matthew Chen ceb210748e Sketch out OWSIdentityManager.
// FREEBIE
9 years ago
Michael Kirk 5b12f4afae Prevent outgoing calls started from various places unless have been seen
e.g. from contacts app

// FREEBIE
9 years ago
Michael Kirk 130aa132a0 Reject incoming calls from an unseen changed identity
// FREEBIE
9 years ago
Michael Kirk 17cff1a26d Revert "Merge branch 'charlesmchen/bluetoothAudio'"
This reverts commit 48a2005aa2, reversing
changes made to de1332479c.

// FREEBIE
9 years ago
Matthew Chen 6c9f44b99d Clean up ahead of PR.
// FREEBIE
9 years ago
Matthew Chen 7e18052c45 Fix Bluetooth audio in calls.
// FREEBIE
9 years ago
Michael Kirk 20fc733bdf Clearer call logging
// FREEBIE
9 years ago
Matthew Chen 716aa772f6 Always sync and log push tokens. Apply OWSAlerts in more places.
// FREEBIE
9 years ago
Matthew Chen ad3a1a671a Merge remote-tracking branch 'origin/hotfix/2.11.3' 9 years ago
Matthew Chen 34a7f9cba5 Respond to CR.
// FREEBIE
9 years ago
Michael Kirk a58a71f8f4 no contacts banner -> system settings 9 years ago
Michael Kirk d7c7fff679 Fix some compiler warnings
* explicit optional usage in strings
* remove some unused StringUtil code
* swiftlint affected files
* more concise optional casting (and avoid a `!`)

Compiler warnings: 343 -> 318

(Actually most of these are in external libs, but 115 remain in Signal/SSK)

// FREEBIE
9 years ago
Matthew Chen dcdfcb0a6f Insist upon an "ordered" TCP data channel for delivery reliability.
// FREEBIE
9 years ago
Michael Kirk 6beee7c012 verify peerconnection at proper time
// FREEBIE
9 years ago
Michael Kirk 2ec893d315 Ensure we're retaining all promises to completion
// FREEBIE
9 years ago
Matthew Chen e36c3aaed7 Reconcile audio and video enabling with call state.
// FREEBIE
9 years ago
Matthew Chen 1444cfc630 Merge remote-tracking branch 'origin/hotfix/2.11.2' 9 years ago
Matthew Chen 0f85284b82 Fix speakerphone vs. WebRTC AND Fix CallService edge cases.
// FREEBIE
9 years ago
Michael Kirk 1b66e0ba26 Fix crash when placing call
// FREEBIE
9 years ago
Matthew Chen 6801963a1b Add SignalAccount class.
// FREEBIE
9 years ago
Michael Kirk faa797c743 Fix crash when placing call
// FREEBIE
9 years ago
Matthew Chen d06f358a23 Don't unwrap with ! in CallService.
// FREEBIE
9 years ago
Michael Kirk 700bd6e08a Fix build, remove unnecessary return
Fixup 27e55d2906

// FREEBIE
9 years ago
Michael Kirk 3a0f84cf36 Avoid crash in CallService
Rather than force unwrapping (`!`), use guards/implicit unwrapping to
handle the failure gracefully.

// FREEBIE
9 years ago
Matthew Chen 791dba9242 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 3368659d87 Improve handling of call service edge cases.
// FREEBIE
9 years ago
Matthew Chen b4464f91a2 Improve handling of call service edge cases.
// FREEBIE
9 years ago
Matthew Chen 3c4955840d Improve handling of call service edge cases.
// FREEBIE
9 years ago
Matthew Chen f920300f28 Improve handling of call service edge cases.
// FREEBIE
9 years ago
Matthew Chen 1fa037527c Fix calling by using actual session descriptions.
// FREEBIE
9 years ago
Michael Kirk da8596c1ba Check microphone permissions: Clean up
* copy tweaks
* use "settings" instead of "privacy settings" for button text
* include comments in NSLocalizedString param so they can be extracted with genstrings
* style dismiss action as "cancel"

// FREEBIE
9 years ago
Christoph Hagen 70efb5e9ec Check microphone permissions before starting a call 9 years ago
Matthew Chen dd3250a9e8 Honor attachment filenames.
// FREEBIE
9 years ago
Matthew Chen 9db33a9651 Remove RedPhone code.
// FREEBIE
9 years ago
Michael Kirk 0c8da2865e Fix search/replace
// FREEBIE
9 years ago
Matthew Chen e724acc978 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen c6a280e005 Only initiate WebRTC calls, not RedPhone calls.
// FREEBIE
9 years ago
Matthew Chen 814c6d2505 Only initiate WebRTC calls, not RedPhone calls.
// FREEBIE
9 years ago
Michael Kirk eb0399f040 Fix "Call failed" due to deadlock when immediately terminating call
It's not clear why we were ever dispatching `sync` here.

Before this:

Place a call
See "connecting..."
Hang up
UI hangs for ~5 seconds
See "call failed" on CallKit screen
Press "cancel" on CallKit screen
returned to responsive app.

// FREEBIE
9 years ago
Michael Kirk aa268e36c2 This constructor can return nil
seeing frequent crash in the wild on this line, maybe this is why?

// FREEBIE
9 years ago
Michael Kirk e3eca4db7b stop videoCapture until video track is enabled to save some battery
Instruments showed a reduction from ~65% -> ~45% while on audio only
call on iPhone5c.

// FREEBIE
9 years ago
Matthew Chen c1aea91d1b Fix build break.
// FREEBIE
9 years ago
Michael Kirk b5403175f1 Call sounds - connecting, outgoing ring, busy sound.
Also add vibration for remote hangup so you're not talking to dead air.

// FREEBIE
9 years ago
Matthew Chen a20a21867e Respond to CR.
// FREEBIE
9 years ago
Matthew Chen c35c118dcd Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 01d2582074 Add and honor the “CallKit Privacy” setting.
// FREEBIE
9 years ago
Matthew Chen f5004b27ab Add and honor the “CallKit Privacy” setting.
// FREEBIE
9 years ago
Matthew Chen 065d383c15 Add and honor the “CallKit Privacy” setting.
// FREEBIE
9 years ago
Michael Kirk 4b8a5f8ccb TURN-only option, and for unknown caller
Now, by default, we only use TURN for incoming calls from unknown
contacts. We will potentially directly connect for outgoing calls and
for incoming calls from known contacts.

Optionally, the user can disable direct connection altogether, at the
cost of some call quality.

// FREEBIE
9 years ago
Matthew Chen f4453eb995 Enable WebRTC-based audio and video calls by default.
// FREEBIE
9 years ago
Matthew Chen dea37b422b Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 06a775b41a Improve the call status messages in conversation view.
// FREEBIE
9 years ago
Michael Kirk 3ab65a2c88 Prevent CallKit timeout when placing outgoing call
More fallout from the outbound call timeout which was causing all
CallKit calls not promptly answered to show "Call Failed"

Inserting the timeout exacerbated an existing issue: We can't wait for
long before choosing to fulfill/fail an action without CallKit falling
over and assuming the call failed.

We don't actually need to consider the case where we "fail to initiate"
the outgoing call. Instead we say it started "successfully, and if there
is an error, the existing promise error handling will fail the call at
that time.

// FREEBIE
9 years ago
Michael Kirk 6cdf13ea5f Only time out the intended call
previously a followup call could get clobbered by the previous calls
timeout

// FREEBIE
9 years ago
Michael Kirk c087c56b0c Fix call timeout
- Previously only incoming calls had their timeout promise fulfilled
- Previously we'd stop the timeout once ringing started, but we
should continue the timeout clock until the users are speaking.

// FREEBIE
9 years ago
Michael Kirk 2f6bf0e551 Code cleanup per CR
// FREEBIE
9 years ago
Michael Kirk 108720c2e7 End outgoing call with "No Answer" after 2 minutes
// FREEBIE
9 years ago
Matthew Chen 734dec12e9 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen c43063e1d6 Add “interstitial call view” that is shown during lengthy “webrtc supported” check.
// FREEBIE
9 years ago
Matthew Chen ce9d9befb3 Prevent device lock during calls.
// FREEBIE
9 years ago
Michael Kirk b8711f9abc contact can be nil for outgoing redphone call
Now that it's easier to start a thread with a non-contact recipient this
is more relevant.

// FREEBIE
9 years ago
Matthew Chen 217866c588 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 228b0e7dc6 Synchronize access to remoteVideoTrack.
// FREEBIE
9 years ago
Matthew Chen ca76ec6f36 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 6f3a45ff8c Avoid crashes when deallocating remote video tracks.
// FREEBIE
9 years ago
Matthew Chen 4ae786d0a2 Ignore CallService events related to obsolete calls.
// FREEBIE
9 years ago
Matthew Chen d9bcd563b1 Avoid possible deadlock in PeerConnectionClient.
// FREEBIE
9 years ago
Matthew Chen 8f6483e9b4 Fix bug in the busy logic.
// FREEBIE
9 years ago
Matthew Chen 17fe3f66c0 Ensure audio service observation of call is always correctly wired up.
// FREEBIE
9 years ago
Michael Kirk 90388ebd63 Coordinate "busy" state across redphone and webrtc
Previously a redphone call didn't know when the user was busy due to
webrtc and vice versa

// FREEBIE
9 years ago
Matthew Chen 05f123c5eb Fix ongoing call check in OutboundCallInitiator.
// FREEBIE
9 years ago
Matthew Chen d7e434eb03 Modify OutboundCallInitiator to abort if there is an ongoing RedPhone or WebRTC call.
// FREEBIE
9 years ago
Matthew Chen 581ba937f4 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 52ba5c1325 Don’t assert when two devices call each other simultaneously.
// FREEBIE
9 years ago
Matthew Chen 6e390d40b7 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 732144c9ed Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 98caeb6a03 Be even more cautious when tearing down a PeerConnectionClient.
// FREEBIE
9 years ago
Michael Kirk a328759f0d Don't crash when incoming call on NonCallKit iOS10
Previous logic assumed "VoiceChat" mode, but when the ringer goes off,
we set "SoloAmbient" which is incompatible with that mode, causing
assertion failure.

// FREEBIE
9 years ago
Michael Kirk 43e7defa28 Stop any lingering audio session if provider resets.
I've never actually seen this happen, but I think it makes sense.

// FREEBIE
9 years ago
Michael Kirk 2a9aa4c852 users can opt out of CallKit
// FREEBIE
9 years ago
Matthew Chen 5687925513 Prevent simultaneous incoming and outgoing calls from leaving CallService in a bad state.
// FREEBIE
9 years ago
Matthew Chen 0893930485 Handle “busy signal” appropriately.
// FREEBIE
9 years ago
Michael Kirk b6f098bfa7 Log when receiving unknown call datachannel message
// FREEBIE
9 years ago
Matthew Chen b868f07c33 Merge remote-tracking branch 'origin/feature/webrtc' into release/2.7.0 9 years ago
Matthew Chen 36356fbff6 Avoid crashes when closing peer connection client.
// FREEBIE
9 years ago
Matthew Chen dacb2840f2 Avoid crashes when closing peer connection client.
// FREEBIE
9 years ago
Matthew Chen f81feca2d6 Avoid crashes when closing peer connection client.
// FREEBIE
9 years ago
Michael Kirk cd36123bf1 rename method to better reflect how its used
// FREEBIE
9 years ago
Michael Kirk 7e825648ef Show alert when trying to call a non-signal contact from Contacts.
// FREEBIE
9 years ago
Michael Kirk bbfd9ba74d Place Signal/Redphone calls from system contacts
// FREEBIE
9 years ago
Matthew Chen 535770a92e Avoid crashes when closing peer connection client.
// FREEBIE
9 years ago
Matthew Chen 4dec1e2ded Avoid crashes when closing peer connection client.
// FREEBIE
9 years ago
Matthew Chen d4ba4c446b Respond to CR.
// FREEBIE
9 years ago
Matthew Chen b415b6142f Respond to CR, mainly by fixing broken tests.
// FREEBIE
9 years ago
Matthew Chen 49bb3d942d Clean up ahead of PR.
// FREEBIE
9 years ago
Matthew Chen d294557bdd Rework concurrency in the signaling logic.
// FREEBIE
9 years ago
Matthew Chen dd374afdaa Rework concurrency in the signaling logic.
// FREEBIE
9 years ago
Matthew Chen d6c849eab3 Revert whitespace changes.
// FREEBIE
9 years ago
Matthew Chen af289145b5 Rework concurrency in the signaling logic.
// FREEBIE
9 years ago
Matthew Chen d0b2aaac27 Specify AVAudioSession modes for calls.
// FREEBIE
9 years ago
Matthew Chen 8454c7dc2f Log reconnect events as such.
// FREEBIE
9 years ago
Matthew Chen 5dd4655672 Ensure audio state when call connects.
// FREEBIE
9 years ago
Matthew Chen 40b3d038db Disable local video in background.
// FREEBIE
9 years ago
Michael Kirk 141a1bd176 Disable half-working call-holding feature all together
consolidated feature-disable logic for incoming/outgoing calls to make
it easier to document, and less likely to break when we *do* implement
CallHolding

// FREEBIE
9 years ago
Michael Kirk 969b73cad8 Implement call holding (call swapping still broken).
- Alice calls Bob on Signal and they start talking
- Charlie calls Alice on Not-Signal.
- Alice chooses to "Hold & Accept" putting Bob on Hold while the call with
  Charlie connects.
- If Alice ends the call with Charlie, we're back in Signal-iOS and
  talking to Bob, no problem.
- However, if, before ending the call with Charlie, Alice tries to swap
  *back* to bob, bob won't hear any audio in the callkit screen. Alice
  has to switch back to the Signal screen before the audio is transmitted.

// FREEBIE
9 years ago
Michael Kirk e425d351c7 WIP: incoming non-signal call while in outgoing signal call
Marking Signal-Call as started, changes the incoming call screen for
subsequent calls to show "Accept & End", "Send to VoiceMail" and "Accept
& Hold" instead of just "Accept" & "Decline"

Though - we don't support Holding. What we really want to see is just
"Accept & End" and "Decline | Send to Voicemail"

// FREEBIE
9 years ago
Matthew Chen c8e5884087 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen 9a0a7bb6b1 Show alert when user tries to activate local video without camera permissions.
// FREEBIE
9 years ago
Matthew Chen da53368bc2 Show alert when user tries to activate local video without camera permissions.
// FREEBIE
9 years ago
Matthew Chen 2ef80e569d Improve thread safety in call ui adapter and adatapees.
// FREEBIE
9 years ago
Matthew Chen 50addfa4e8 Remove camera constraints.
// FREEBIE
9 years ago
Matthew Chen 6ce33381a8 Prevent screen from dimming or device from locking during video call.
// FREEBIE
9 years ago
Michael Kirk 459d0d6012 Working around a bizarre crash on iOS 9
Without this, I get a SEGFAULT on iOS 9.3 device 1 in 3 calls when
accessing the RTC extern constants. Swift bug?

Currently using XCode 8.2

// FREEBIE
9 years ago
Michael Kirk fff061ff3f Make sure WebRTC preferences are synced *every* call
This slows the UI, but only for people who have locally opted into
WebRTC calls, and the alternative is that users are likely to have stale
settings the first time a pair of people opt-in.

// FREEBIE
9 years ago
Matthew Chen d560aa022a Reworked call view’s remote video mode. 9 years ago
Matthew Chen 204aeab69c Respond to CR.
// FREEBIE
9 years ago
Matthew Chen ec1f77c630 Polish video calls.
* Send and handle messages around video status.
* Fix handling of callee data channel.
* Fix layout of local video view.

// FREEBIE
9 years ago
Matthew Chen 48ca4fe865 Respond to CR.
// FREEBIE
9 years ago
Matthew Chen a65d3b7c4e Add video-related views.
// FREEBIE
9 years ago
Michael Kirk 814aec6cdd Recover CallKit state when remote client fails to hangup
Distinguish between localHangup, remoteHangup, and call failure.

This allows us to put CallKit in the proper state, ready to receive new
calls without having a backlog of phantom calls which haven't been
properly removed.

Note the "call error" occurs at the point ICE fails, which takes a
while. Anecdotally, like 10 seconds, which feels like a long to be
talking into the ether.

I briefly considered failing at 'disconnected', which happens much
sooner, but that's actually a recoverable state. E.g. if you toggle
airplane mode you can see that you bounce into `disconnected` and then
back to `connected`, so I don't think we'd want to fail the call as long
as WebRTC considers it "recoverable".

// FREEBIE
9 years ago
Michael Kirk 6c14f2f500 Fix "Answer" from iOS9 notification doesn't init audio
The removed code was from an older eon. CallService shouldn't be touched
except via the CallUIAdapter since only there is the omnipresent
distinction between CallKit vs. NonCallKit made.

i.e. when the RTCAudioSession get's started depends on the
CallUIAdaptee.

// FREEBIE
9 years ago
Michael Kirk 333fb6c60f assert on main thread
// FREEBIE
9 years ago
Michael Kirk b2091431dc Fix retain cycle
// FREEBIE
9 years ago
Michael Kirk 87ed662116 Persist AudioService if CallViewController is dismissed
...in response to CR, move the AudioService off of the CallViewController

Adopt multiple observer pattern vs. a singular delegate. Doing so
required implementing some machinery to address the ARC (see:
Weak.swift)

// FREEBIE
9 years ago
Michael Kirk 3ee94d57d9 Only NonCallKit adaptee uses manual ringing
- stop executing ringer code on CallKit which manages ringing for us.
- Organize ringing code more clearly.

// FREEBIE
9 years ago