Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CallState usage #303

Open
Del-S opened this issue Jun 22, 2023 · 2 comments
Open

Improve CallState usage #303

Del-S opened this issue Jun 22, 2023 · 2 comments

Comments

@Del-S
Copy link

Del-S commented Jun 22, 2023

SDK version used: 1.2.20-alpha.

So as I started to work with this lib I noticed CallState enum and I wanted to use it to update the states on the screen. Ex: CallState.Active call starts timer and shows controll buttons (mute, loud speaker and other). But as I noticed our calls contain SDP and thus I will never receive Active state just Connecting and that the call is in progress is send using SocketMethod.ANSWER.

Ok so then I thought I should listen to SocketMethod instead. But in this case when I as a user cancel the call I will only receive CallState.DONE and no SocketMethod. If the user on the other side cancels the call I will receive both CallState.DONE and SocketMethod.BYE.

So my question is. Why should I as a developer need to handle all these situations on my own? Why do I need to check SocketMethod aaand CallState + handle call states direcly? Wouldn't it be easier to just update CallState properly? If this were the case I would have 1 source of truth for call UI. I could connect the state to CallState and be done with it. In this case I cannot. :(

In this case I need to start a call:

  1. When the app receives SocketMethod.ANSWER for outgoing calls.
  2. When the user clicks accept call for incomming call.

In this case I need to cancel a call:

  1. When user clicks declines incomming call.
  2. When the app receives SocketMethod.BYE.

In the cancel case I noticed that CallState.DONE is received every time.

@Del-S
Copy link
Author

Del-S commented Jun 23, 2023

I also noticed when I create a call. It goes to CallState.RINGING. I cancel the call then it goes to CallState.DONE. But when I create another call it is already in DONE state which makes no sense.

// First call
TEST: active calls {cf917080-0d21-42a9-b9b3-676b8b30a1b5=com.telnyx.webrtc.sdk.Call@5dba54a}
TEST: active state RINGING

// Second call
TEST: active calls {e2d98915-6308-4d8b-af6e-ae4b17aad390=com.telnyx.webrtc.sdk.Call@5dba54a}
TEST: active state DONE

@Del-S
Copy link
Author

Del-S commented Jul 10, 2023

So the improvements from 1.2.21-alpha seem fine but I still do not receive CallState.RINGING in call state for outgoing call. So I had to manully send it when I receive SocketState.Ringing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant