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

Tcp socket implementation #416

Merged

Conversation

mikaelwills
Copy link
Collaborator

@mikaelwills mikaelwills commented Dec 20, 2023

Recently In a research project for work we were looking into integrating SIP phone functionality into our existing client flutter app. The main constraint was that it had to work with a 3cx server.

Unfortunately 3cx doesn't accept web socket connections and seeing as this was the only viable dart sip ua package on pub dev I had to go about adding the ability to connect to 3cx over tcp with this package.

I have successfully registered with a 3cx server and made calls between two clients.
I then went back and made sure that I could still register fine with an Asterisk server on FreePBX using the existing websockets.

In a nutshell what i did was abstract out the websocket class into a socket_interface. Then have web_socket and tcp_socket classes extend this abstracted interface.
In the example app when you register the connection, a type is chosen with a radio check box.
When what ever type is chosen, the sip_ua_helper creates the appropriate socket types and adds them to the array of sockets.

The rest of the package carries on as usual not caring about what type of socket is used. It just calls .send() on the socket interface and the sockets deal with how they connect.

At the risk of sounding lame, im hoping this will eventually be accepted as it will be my first contribution as a developer to public open source code :)

@cloudwebrtc
Copy link
Member

cloudwebrtc commented Dec 21, 2023

Thanks @mikaelwills, this is great work.
Before merging, we may need to do some checks

  1. Make sure this patch does not affect Flutter Web because the browser does not support TCP
  2. Since TCP is already supported, I think TLS can also be supported (using SecureSocket). Of course, it is not necessary. I am very interested to see if it can be supported.

Maybe I can also do some general testing and try connecting to asterisk/freeswitch/opensips using TCP/TLS

@mikaelwills
Copy link
Collaborator Author

Great news.

I'll start looking into those two points. WIth the second point possibly making a third secure_socket.class the extends the abstract class and getting that to work.

@jonentropy
Copy link

This is really good news as it would make this library so much more versatile.

@mikaelwills mikaelwills force-pushed the mw/TcpImplementation branch 2 times, most recently from dae0588 to 425ec98 Compare April 23, 2024 13:26
Copy link
Member

@cloudwebrtc cloudwebrtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@mikaelwills mikaelwills force-pushed the mw/TcpImplementation branch from 425ec98 to 2614cc3 Compare May 8, 2024 13:48
@cloudwebrtc cloudwebrtc merged commit 024d0e8 into flutter-webrtc:master May 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants