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

WebSocket connection issue #435

Open
Vinayak006 opened this issue May 2, 2024 · 1 comment
Open

WebSocket connection issue #435

Vinayak006 opened this issue May 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Vinayak006
Copy link

Description:
We are encountering an error while trying to establish a WebSocket connection. The web team has successfully connected to the WebSocket using the JavaScript SIP package (JS SIP), but the mobile application is facing difficulties. We are using the testing credentials given in SIP JS.

Context:

  • The web team uses the JS SIP package, which is a JavaScript version of SIP_UA.
  • We are using a SIP JS test accounts for proof of concepts (POCs).
  • The error occurs specifically on the mobile platform.

Expected Behavior:

  • The mobile application should be able to connect to the WebSocket and use the SIP functionality similar to the web application.

Additional Information:

  • We suspect there may be compatibility issues or configuration differences between the web and mobile platforms.
  • Any insights or suggestions for resolving this issue would be greatly appreciated.

React code: (using JS SJIP)

const socket = new WebSocketInterface("wss://edge.sip.onsip.com");
  socket.via_transport = "WSS";
  const userName = localStorage.getItem("user_name") || "";
  const password = localStorage.getItem("password") || "";
  const configuration = {
    sockets: [socket],
    uri: `sip:${userName}@sipjs.onsip.com`,
    authorization_user: userName,
    password: password,
    display_name: userName,
 };
 const ua = new UA(configuration);
 ua.start();

Flutter code: (using SIP UA)

await SIPUAHelper().start(
  UaSettings()
    ..webSocketUrl = "wss://edge.sip.onsip.com"
    ..webSocketSettings.transport_scheme = "WSS"
    ..displayName = "8000"
    ..password = "123"
    ..authorizationUser = "8000"
    ..uri = "sip:8000@sipjs.onsip.com",
);

If sip_ua is dart version of js sip, websocket should have connected successfully but we are getting error given below:

flutter: [2024-05-02 16:43:39.316] Level.debug websocket_interface.dart:13 ::: new() [url:wss://edge.sip.onsip.com]
flutter: [2024-05-02 16:43:39.375] Level.debug websocket_interface.dart:30 ::: SIP URI: sip:edge.sip.onsip.com;transport=wss
flutter: [2024-05-02 16:43:39.387] Level.debug ua.dart:89 ::: new() [configuration:Instance of 'Settings']
flutter: [2024-05-02 16:43:39.400] Level.info config.dart:259 ::: Check mandatory parameter => sockets.
flutter: [2024-05-02 16:43:39.403] Level.info config.dart:259 ::: Check mandatory parameter => uri.
flutter: [2024-05-02 16:43:39.437] Level.debug config.dart:266 ::: Check optional parameter => authorization_user.
flutter: [2024-05-02 16:43:39.444] Level.debug config.dart:266 ::: Check optional parameter => user_agent.
flutter: [2024-05-02 16:43:39.446] Level.debug config.dart:266 ::: Check optional parameter => connection_recovery_max_interval.
flutter: [2024-05-02 16:43:39.447] Level.debug config.dart:266 ::: Check optional parameter => connection_recovery_min_interval.
flutter: [2024-05-02 16:43:39.448] Level.debug config.dart:266 ::: Check optional parameter => contact_uri.
flutter: [2024-05-02 16:43:39.450] Level.debug config.dart:266 ::: Check optional parameter => display_name.
flutter: [2024-05-02 16:43:39.451] Level.debug config.dart:266 ::: Check optional parameter => instance_id.
flutter: [2024-05-02 16:43:39.452] Level.debug config.dart:266 ::: Check optional parameter => no_answer_timeout.
flutter: [2024-05-02 16:43:39.454] Level.debug config.dart:266 ::: Check optional parameter => session_timers.
flutter: [2024-05-02 16:43:39.456] Level.debug config.dart:266 ::: Check optional parameter => session_timers_refresh_method.
flutter: [2024-05-02 16:43:39.457] Level.debug config.dart:266 ::: Check optional parameter => password.
flutter: [2024-05-02 16:43:39.459] Level.debug config.dart:266 ::: Check optional parameter => realm.
flutter: [2024-05-02 16:43:39.461] Level.debug config.dart:266 ::: Check optional parameter => ha1.
flutter: [2024-05-02 16:43:39.463] Level.debug config.dart:266 ::: Check optional parameter => register.
flutter: [2024-05-02 16:43:39.464] Level.debug config.dart:266 ::: Check optional parameter => register_expires.
flutter: [2024-05-02 16:43:39.466] Level.debug config.dart:266 ::: Check optional parameter => registrar_server.
flutter: [2024-05-02 16:43:39.468] Level.debug config.dart:266 ::: Check optional parameter => register_extra_contact_uri_params.
flutter: [2024-05-02 16:43:39.469] Level.debug config.dart:266 ::: Check optional parameter => use_preloaded_route.
flutter: [2024-05-02 16:43:39.470] Level.debug config.dart:266 ::: Check optional parameter => dtmf_mode.
flutter: [2024-05-02 16:43:39.471] Level.debug config.dart:266 ::: Check optional parameter => ice_gathering_timeout.
flutter: [2024-05-02 16:43:39.478] Level.debug transport.dart:42 ::: new()
flutter: [2024-05-02 16:43:39.511] Level.debug ua.dart:151 ::: start()
flutter: [2024-05-02 16:43:39.513] Level.debug transport.dart:89 ::: connect()
flutter: [2024-05-02 16:43:39.515] Level.debug ua.dart:906 ::: Transport connecting
flutter: [2024-05-02 16:43:39.519] Level.debug sip_ua_helper.dart:146 ::: connecting => Instance of 'EventSocketConnecting'
flutter: [2024-05-02 16:43:39.525] Level.debug websocket_interface.dart:71 ::: connect()
flutter: [2024-05-02 16:43:39.526] Level.debug websocket_interface.dart:87 ::: connecting to WebSocket wss://edge.sip.onsip.com
flutter: [2024-05-02 16:43:39.530] Level.info websocket_dart_impl.dart:26 ::: connect wss://edge.sip.onsip.com, {}, [sip]
flutter: [2024-05-02 16:43:40.920] Level.debug websocket_interface.dart:103 ::: Closed [500, WebSocketException: Connection to 'https://edge.sip.onsip.com:0#' was not upgraded to websocket]!
flutter: [2024-05-02 16:43:40.921] Level.debug websocket_interface.dart:167 ::: WebSocket wss://edge.sip.onsip.com closed
flutter: [2024-05-02 16:43:40.923] Level.debug sip_ua_helper.dart:158 ::: disconnected => Code: [500], Cause: error, Reason: WebSocketException: Connection to 'https://edge.sip.onsip.com:0#' was not upgraded to websocket
flutter: [2024-05-02 16:43:40.926] Level.debug transport.dart:183 ::: reconnection attempt: 1. next connection attempt in 2 seconds
flutter: [2024-05-02 16:43:42.927] Level.debug transport.dart:89 ::: connect()
flutter: [2024-05-02 16:43:42.928] Level.debug ua.dart:906 ::: Transport connecting
flutter: [2024-05-02 16:43:42.929] Level.debug sip_ua_helper.dart:146 ::: connecting => Instance of 'EventSocketConnecting'
flutter: [2024-05-02 16:43:42.930] Level.debug websocket_interface.dart:71 ::: connect()
flutter: [2024-05-02 16:43:42.931] Level.debug websocket_interface.dart:120 ::: disconnect()
flutter: [2024-05-02 16:43:42.931] Level.debug websocket_interface.dart:167 ::: WebSocket wss://edge.sip.onsip.com closed
flutter: [2024-05-02 16:43:42.932] Level.debug sip_ua_helper.dart:158 ::: disconnected => Code: [0], Cause: error, Reason: Client send disconnect
flutter: [2024-05-02 16:43:42.933] Level.debug transport.dart:183 ::: reconnection attempt: 2. next connection attempt in 3 seconds
flutter: [2024-05-02 16:43:42.935] Level.error websocket_interface.dart:131 ::: close() | error closing the WebSocket: Null check operator used on a null value
flutter: [2024-05-02 16:43:42.935] Level.debug websocket_interface.dart:87 ::: connecting to WebSocket wss://edge.sip.onsip.com
flutter: [2024-05-02 16:43:42.936] Level.info websocket_dart_impl.dart:26 ::: connect wss://edge.sip.onsip.com, {}, [sip]
flutter: [2024-05-02 16:43:44.137] Level.debug websocket_interface.dart:103 ::: Closed [500, WebSocketException: Connection to 'https://edge.sip.onsip.com:0#' was not upgraded to websocket]!
flutter: [2024-05-02 16:43:44.138] Level.debug websocket_interface.dart:167 ::: WebSocket wss://edge.sip.onsip.com closed
flutter: [2024-05-02 16:43:44.138] Level.debug sip_ua_helper.dart:158 ::: disconnected => Code: [500], Cause: error, Reason: WebSocketException: Connection to 'https://edge.sip.onsip.com:0#' was not upgraded to websocket

@Vinayak006 Vinayak006 added the bug Something isn't working label May 2, 2024
@opendeeple
Copy link

I am getting this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants