lukeweber / webrtc-jingle-client

Webrtc audio + jingle protocol brought to IOS and Android.
https://groups.google.com/forum/?fromgroups#!forum/webrtc-jingle
BSD 3-Clause "New" or "Revised" License
335 stars 137 forks source link

Create connecting state #32

Open lukeweber opened 11 years ago

lukeweber commented 11 years ago

Connecting state is the state where you try to reach a user, and get a RECEIVED_INITIATE_ACK from at least one connection. Maybe this state times out after 20 seconds, and shows a spinning wheel type UI.

CallState::RECEIVED_INITIATE_ACK, and CallError::ERROR_ACK_TIME are new states that support some of this logic.

In SessionManager you can set the ack timeout. It's currently at 3 seconds, which is too fast, because the socket setup/response on 3g phones can take about that long, so probably 5 is a better choice. If you initiate a call(SENT_INITIATE), you'll get RECEIVED_INITIATE_ACK within three seconds, else ERROR_ACK_TIME.

In the future an outgoing call might look like push to tell the client to wake up and connect, listen for the user your calling coming online(if he does, send an invite), send an invite to any connection that seems "online". When one accepts or denies, terminate the calls that aren't valid.

Xmpp servers because of long lived tcp connections might not show the state change very quickly if a user goes offline unexpectedly and doesn't close his connection nicely, so this is the reason for the act timeout.