zelloptt / zello-channel-api

WebSocket-based API and SDKs to connect to Zello channels (BETA)
MIT License
89 stars 35 forks source link

API documentation: error codes, message sequencing #233

Open PhilRW opened 2 months ago

PhilRW commented 2 months ago

Hello:

Would it be possible to please document some error codes on the API, such as: empty message woodpecker prohibited ...and others?

Also a brief explanation of what they mean would be appreciated and a potential remedy so the error handler code doesn't blindly retry without taking corrective action. Some I have been able to reverse engineer as they are fairly obvious (not authorized, for example), but others not so much.

Also an explanation of (a)synchronicity and sequencing of messages, for example, on_stream_start and on_stream_stop. I can understand multiple simultaneous streams but the consumer API only supports one channel which is logically treated as a half duplex connection, so I would expect on_stream_stop to follow after each on_stream_start, but occasionally messages are not received or are received out of order. Without further explanation and/or sequence diagrams, I am coding against the API in the dark.

Thanks!

AndyW999 commented 1 month ago

And I have some undocumented ones -

kicked unable to verify invalid stream id

Are there any more you are not telling us about?

Plus is there a method of reporting network problems yet as today I am able to send from channel API -> Android but there are no incoming packets from Android -> Channel API.

Thanks

Andy.

AndyW999 commented 1 month ago

And it had just started working again - maybe somebody does actually look at this...

angeloniclaudio commented 2 weeks ago

AndyW999 have you fixed the issue? I'm facing the same issue and no solution for me at the moment. No events are announced by the server on the WebSocket (Channel API) so my app cannot react. In my test, the audio message or text are sent by Android app. All other Android clients receive the data correctly.

AndyW999 commented 2 weeks ago

Well it is working right now. Here is my session with the sensitive bits set to xxxxx -

open_socket "ws://zellowork.io/ws/xxxxx" "192.168.1.14" "08:31:43.577577" HandleConnectionStatus "ws://zellowork.io/ws/xxxxx" 0 "OK" "08:31:43.764764" HandleConnectionStatus "ws://zellowork.io/ws/xxxxx" 0 "OK" "08:31:44.016016" DoLogin "{\"auth_token\":\"xxxxx",\"channels\":[\"Everyone\"],\"command\":\"logon\",\"password\":\"xxxxx\",\"seq\":1,\"username\":\"xxxxx\"}" onConnected "ws://zellowork.io/ws/xxxxx" "192.168.1.14" "08:31:44.027027" text "{\"refresh_token\":\"xxxxx\",\"success\":true,\"seq\":1}" text "{\"command\":\"on_channel_status\",\"channel\":\"Everyone\",\"status\":\"online\",\"users_online\":1,\"images_supported\":true,\"texting_supported\":true,\"locations_supported\":true}"

Are you actually connecting?

Run Wireshark BEFORE trying to connect and set the filter to websocket and see if you are actually connecting.

angeloniclaudio commented 2 weeks ago

The connection is successful and the authentication procedure has no problems. (Same responses you posted) I receive the "on_channel_status" without issue and the info provided are correct. From this point onward, I can send audio or text message from my client to the server with success. (Android app receives what I just sent) The problem is that I'm not able to receive events like "on_text_message", "on_stream_start", "on_location". (Sent by Android app --> thus sent to me by the Zello server) The connection seems one-directional from my client to the server. (I'm using zello consumer account)

Issue I'm facing is similar to the one reported by you with the statement: " I am able to send from channel API -> Android but there are no incoming packets from Android -> Channel API."

AndyW999 commented 2 weeks ago

Well mine seems to be working - I am using Zello paid for.

Make sure that what you are calling uses the correct character case - I used 'everyone' when it should have been 'Everyone' and it did not work.

Can you log all of the websocket interactions?

angeloniclaudio commented 2 weeks ago

yes, I can log the interactions and I can say that no events (packets) from the zello server are triggered by the server itself while a message is sent by other user. Wireshark logs all the packets in both directions and I can see all the correct traffic (Auth, on_cahnnel_status, kicked...). When another client sends a voice or text message, I don't see any packet from Zello (so my application cannot invoke any method of course). Maybe a limitation of the Zello consumer API? By the way I didn't find any declared limitation on the documentation or website. :(

AndyW999 commented 2 weeks ago

Well this is what I get - xxxxx is my confidential stuff!

open_socket "ws://zellowork.io/ws/xxxxx" "192.168.1.14" "11:40:26.938938" HandleConnectionStatus "ws://zellowork.io/ws/xxxxx" 0 "OK" "11:40:27.31031" HandleConnectionStatus "ws://zellowork.io/ws/xxxxx" 0 "OK" "11:40:27.589589" onConnected "ws://zellowork.io/ws/xxxxx" "192.168.1.14" "11:40:27.601601" text "{\"refresh_token\":\"xxxxx",\"success\":true,\"seq\":1}" text "{\"command\":\"on_channel_status\",\"channel\":\"Everyone\",\"status\":\"online\",\"users_online\":2,\"images_supported\":true,\"texting_supported\":true,\"locations_supported\":true}" text "{\"command\":\"on_stream_start\",\"type\":\"audio\",\"codec\":\"opus\",\"packet_duration\":120,\"stream_id\":11167,\"channel\":\"Everyone\",\"from\":\"Andy3\",\"key\":\"HtfrWNOTmhfL6LAyFUHw7209NchZTNX3AMTgS9fmNC8=\",\"codec_header\":\"gD4CPA==\"}" text "{\"command\":\"on_stream_stop\",\"stream_id\":11167}"

Are you getting the correct number of online users in both the ChannelAPI and the Android clients?

Are you getting true returned in on_channel_status?

Can you do what I am doing and getting the text output dumped when there is a text message and let me see them?

It does work - most of the time - and I have tried it with both the paid and unpaid versions.

The main limitation the ChannelAPI does not cover is when the channel you are trying to use needs a password - I have mentioned this before here I think but got no reply...

mattmelling commented 2 weeks ago

When another client sends a voice or text message, I don't see any packet from Zello (so my application cannot invoke any method of course).

I am also seeing this on certain channels, using Zello Consumer. I have one channel that consistently does not send audio to my app, even though the app can send audio to the channel.

On a different channel it works fine. Both of them I can log in on an Android device with the same account and transmit and receive. It seems to be an issue only when connecting through the Channels API.

The project I am working on also uses a bunch of Zello Work accounts, I have also seen this happen on one of the Work channels too, however it appears to be easier to reproduce on the Consumer channel we are using.

Logged separately as #236 where I've tried to detail this behavior.

mattmelling commented 2 weeks ago

Make sure that what you are calling uses the correct character case - I used 'everyone' when it should have been 'Everyone' and it did not work.

This comment escaped me late last night, reading through this thread again this morning and it stuck out like a sore thumb!

My app is working again and have updated that other issue with the same info.

AndyW999 commented 2 weeks ago

Yes, Zello were surprised at this...

Looks like somebody used a password comparison routine by mistake ;)

angeloniclaudio commented 2 weeks ago

The past night I made additional tests and I can confirm that the issue is present only on some channels. I switched my APP to another Consumer channel and now everything is working. Not clear the root cause of the malfunction but what I can say is:

1) Channel names are case-sensitive (even if the logon process is succesfull, actually not all events are announced by Zello) 2) If you have spaces in the channel name you could have issue 3) If the channel is configured as Zelection+ you could have issue with events (even if the users are all admins)

I didn't doubled check my previous points but if you pay attention to those, you should be able to have a fully functional Zello service. (Consumer)

My app is now fully woking but I'll investigate more asap.

AndyW999 commented 2 weeks ago

Remember that on the case sensitive issue Zello will tell lies ;)

If you log in for a channel called 'Everyone' using 'everyone' it does not report an error, it just does not work!