flutter-webrtc / dart-sip-ua

A dart-lang version of the SIP UA stack.
MIT License
331 stars 255 forks source link

sip_ua + asterisk sip over ws #132

Open prozaklob opened 3 years ago

prozaklob commented 3 years ago

hi. im try up asterisk server with ws,by sip_ua no whana connect to server. im try rebuild server 999+ try :)

sip.conf

[general]
udpbindaddr=0.0.0.0:5060
transport=udp,ws
nat=force_rport,comedia

[webrtc](!)
host=dynamic
context=from-internal
type=friend
encryption=yes
avpf=yes
force_avp=yes
icesupport=yes
directmedia=no
disallow=all
qualify=yes
videosupport=yes
allow=ulaw,alaw,vp8,h264,h263p,mpeg4
dtlsenable=no
dtlsverify=no
;dtlscertfile=/etc/asterisk/keys/asterisk.pem
;dtlscafile=/etc/asterisk/keys/ca.crt
;dtlssetup=actpass

[101](webrtc)
defaultusername=101
secret=101

http.conf

[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088

error


I/flutter (26295): [2020-10-01 19:57:08.421] Level.debug websocket_interface.dart:37 ::: new() [url:ws://192.168.1.200:8088]
I/flutter (26295): [2020-10-01 19:57:08.512] Level.debug websocket_interface.dart:50 ::: SIP URI: sip:192.168.1.200:8088;transport=ws
I/flutter (26295): [2020-10-01 19:57:08.517] Level.debug ua.dart:103 ::: new() [configuration:Instance of 'Settings']
I/flutter (26295): [2020-10-01 19:57:08.524] Level.info config.dart:254 ::: Check mandatory parameter => sockets.
I/flutter (26295): [2020-10-01 19:57:08.542] Level.info config.dart:254 ::: Check mandatory parameter => uri.
I/flutter (26295): [2020-10-01 19:57:08.547] Level.debug config.dart:260 ::: Check optional parameter => authorization_user.
I/flutter (26295): [2020-10-01 19:57:08.549] Level.debug config.dart:260 ::: Check optional parameter => user_agent.
I/flutter (26295): [2020-10-01 19:57:08.556] Level.debug config.dart:260 ::: Check optional parameter => connection_recovery_max_interval.
I/flutter (26295): [2020-10-01 19:57:08.558] Level.debug config.dart:260 ::: Check optional parameter => connection_recovery_min_interval.
I/flutter (26295): [2020-10-01 19:57:08.561] Level.debug config.dart:260 ::: Check optional parameter => contact_uri.
I/flutter (26295): [2020-10-01 19:57:08.564] Level.debug config.dart:260 ::: Check optional parameter => display_name.
I/flutter (26295): [2020-10-01 19:57:08.566] Level.debug config.dart:260 ::: Check optional parameter => instance_id.
I/flutter (26295): [2020-10-01 19:57:08.569] Level.debug config.dart:260 ::: Check optional parameter => no_answer_timeout.
I/flutter (26295): [2020-10-01 19:57:08.571] Level.debug config.dart:260 ::: Check optional parameter => session_timers.
I/flutter (26295): [2020-10-01 19:57:08.574] Level.debug config.dart:260 ::: Check optional parameter => session_timers_refresh_method.
I/flutter (26295): [2020-10-01 19:57:08.576] Level.debug config.dart:260 ::: Check optional parameter => password.
I/flutter (26295): [2020-10-01 19:57:08.579] Level.debug config.dart:260 ::: Check optional parameter => realm.
I/flutter (26295): [2020-10-01 19:57:08.581] Level.debug config.dart:260 ::: Check optional parameter => ha1.
I/flutter (26295): [2020-10-01 19:57:08.583] Level.debug config.dart:260 ::: Check optional parameter => register.
I/flutter (26295): [2020-10-01 19:57:08.585] Level.debug config.dart:260 ::: Check optional parameter => register_expires.
I/flutter (26295): [2020-10-01 19:57:08.587] Level.debug config.dart:260 ::: Check optional parameter => registrar_server.
I/flutter (26295): [2020-10-01 19:57:08.589] Level.debug config.dart:260 ::: Check optional parameter => register_extra_contact_uri_params.
I/flutter (26295): [2020-10-01 19:57:08.591] Level.debug config.dart:260 ::: Check optional parameter => use_preloaded_route.
I/flutter (26295): [2020-10-01 19:57:08.603] Level.debug transport.dart:53 ::: new()
I/flutter (26295): [2020-10-01 19:57:08.639] Level.debug ua.dart:163 ::: start()
I/flutter (26295): [2020-10-01 19:57:08.641] Level.debug transport.dart:111 ::: connect()
I/flutter (26295): [2020-10-01 19:57:08.644] Level.debug ua.dart:845 ::: Transport connecting
I/flutter (26295): [2020-10-01 19:57:08.647] Level.debug sip_ua_helper.dart:114 ::: connecting => Instance of 'EventSocketConnecting'
I/flutter (26295): [2020-10-01 19:57:08.651] Level.debug websocket_interface.dart:71 ::: connect()
I/flutter (26295): [2020-10-01 19:57:08.653] Level.debug websocket_interface.dart:82 ::: connecting to WebSocket ws://192.168.1.200:8088
I/flutter (26295): [2020-10-01 19:57:08.659] Level.info websocket_dart_impl.dart:25 ::: connect ws://192.168.1.200:8088, {Origin: 192.168.1.200, Host: 192.168.1.200:8088}, [sip]
I/flutter (26295): [2020-10-01 19:57:08.824] Level.debug websocket_interface.dart:89 ::: Web Socket is now connected
I/flutter (26295): [2020-10-01 19:57:08.826] Level.debug websocket_interface.dart:158 ::: WebSocket ws://192.168.1.200:8088 connected
I/flutter (26295): [2020-10-01 19:57:08.829] Level.debug ua.dart:851 ::: Transport connected
I/flutter (26295): [2020-10-01 19:57:08.831] Level.debug sip_ua_helper.dart:120 ::: connected => Instance of 'EventSocketConnected'
I/flutter (26295): [2020-10-01 19:57:08.837] Level.warning registrator.dart:140 ::: <sip:j67r627z@3d3yzevfevaa.invalid>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:bf70187e-14fa-486b-a4be-8177772938ef>"
I/flutter (26295): [2020-10-01 19:57:08.855] Level.debug transport.dart:167 ::: send()
I/flutter (26295): [2020-10-01 19:57:08.858] Level.debug websocket_interface.dart:133 ::: send()
I/flutter (26295): [2020-10-01 19:57:08.872] Level.debug websocket_dart_impl.dart:51 ::: send:
I/flutter (26295):
I/flutter (26295): REGISTER sip:192.168.1.200 SIP/2.0
I/flutter (26295): Via: SIP/2.0/WS 3d3yzevfevaa.invalid;branch=z9hG4bK829148245
I/flutter (26295): Max-Forwards: 69
I/flutter (26295): To: <sip:101@192.168.1.200>
I/flutter (26295): From: "Flutter SIP UA" <sip:101@192.168.1.200>;tag=4v8i37f5t3
I/flutter (26295): Call-ID: fydoelzravralr9vsoi6uw
I/flutter (26295): CSeq: 1 REGISTER
I/flutter (26295): Contact: <sip:j67r627z@3d3yzevfevaa.invalid>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:bf70187e-14fa-486b-a4be-8177772938ef>";expires=600
I/flutter (26295): Expires: 600
I/flutter (26295): Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO
I/flutter (26295): Supported: path,gruu,outbound
I/flutter (26295): User-Agent: Dart SIP Client v1.0.0
I/flutter (26295): Content-Length: 0
I/flutter (26295):
I/flutter (26295): [2020-10-01 19:57:08.887] Level.debug websocket_interface.dart:98 ::: Closed [1002, null]!
I/flutter (26295): [2020-10-01 19:57:08.889] Level.debug websocket_interface.dart:163 ::: WebSocket ws://192.168.1.200:8088 closed
I/flutter (26295): [2020-10-01 19:57:08.893] Level.debug non_invite_client.dart:52 ::: transport error occurred, deleting transaction z9hG4bK829148245
I/flutter (26295): [2020-10-01 19:57:08.899] Level.debug sip_ua_helper.dart:147 ::: registrationFailed => Code: [500], Cause: SIP Failure Code, Reason: Connection Error
I/flutter (26295): [2020-10-01 19:57:08.903] Level.debug sip_ua_helper.dart:126 ::: disconnected => Code: [1002], Cause: error, Reason: null
I/flutter (26295): [2020-10-01 19:57:08.906] Level.debug transport.dart:206 ::: reconnection attempt: 1. next connection attempt in 2 seconds
Application finished.
Exited (sigterm)
ghenry commented 3 years ago

What's the Asterisk console saying?

prozaklob commented 3 years ago

nothing according to the traffic on the server, I see that the connection to the socket is taking place, but it does not reach sip registration

ghenry commented 3 years ago

Does tryit.jssipt.net work in your LAN?

ghenry commented 3 years ago

https://tryit.jssip.net/

prozaklob commented 3 years ago

yap. this host work.

ghenry commented 3 years ago

ngrep the ws on asterisk and see what's happening.

I had the with opensips as the ws sec key wasn't right.

prozaklob commented 3 years ago

i think flutter not connected to ws if i try open url on browser http://192.168.1.200:8088/ws i take error on asterisk debug:

WARNING[28673]: res_http_websocket.c:831 __ast_websocket_uri_cb: WebSocket connection from '192.168.1.114:38473' could not be accepted - did not request WebSocket

bt i not see debug http in asterisk if i try connect from flutter

prozaklob commented 3 years ago

hmm

now im try run app on real phone and take other error

flutter (22547): [2020-10-02 00:53:57.156] Level.debug websocket_interface.dart:37 ::: new() [url:ws://192.168.1.200:8088/ws]
I/flutter (22547): [2020-10-02 00:53:57.295] Level.debug websocket_interface.dart:50 ::: SIP URI: sip:192.168.1.200:8088;transport=ws
I/flutter (22547): [2020-10-02 00:53:57.302] Level.debug ua.dart:103 ::: new() [configuration:Instance of 'Settings']
I/flutter (22547): [2020-10-02 00:53:57.313] Level.info config.dart:254 ::: Check mandatory parameter => sockets.
I/flutter (22547): [2020-10-02 00:53:57.343] Level.info config.dart:254 ::: Check mandatory parameter => uri.
I/flutter (22547): [2020-10-02 00:53:57.350] Level.debug config.dart:260 ::: Check optional parameter => authorization_user.
I/flutter (22547): [2020-10-02 00:53:57.367] Level.debug config.dart:260 ::: Check optional parameter => user_agent.
I/flutter (22547): [2020-10-02 00:53:57.372] Level.debug config.dart:260 ::: Check optional parameter => connection_recovery_max_interval.
I/flutter (22547): [2020-10-02 00:53:57.376] Level.debug config.dart:260 ::: Check optional parameter => connection_recovery_min_interval.
I/flutter (22547): [2020-10-02 00:53:57.381] Level.debug config.dart:260 ::: Check optional parameter => contact_uri.
I/flutter (22547): [2020-10-02 00:53:57.386] Level.debug config.dart:260 ::: Check optional parameter => display_name.
I/flutter (22547): [2020-10-02 00:53:57.390] Level.debug config.dart:260 ::: Check optional parameter => instance_id.
I/flutter (22547): [2020-10-02 00:53:57.393] Level.debug config.dart:260 ::: Check optional parameter => no_answer_timeout.
I/flutter (22547): [2020-10-02 00:53:57.396] Level.debug config.dart:260 ::: Check optional parameter => session_timers.
I/flutter (22547): [2020-10-02 00:53:57.399] Level.debug config.dart:260 ::: Check optional parameter => session_timers_refresh_method.
I/flutter (22547): [2020-10-02 00:53:57.402] Level.debug config.dart:260 ::: Check optional parameter => password.
I/flutter (22547): [2020-10-02 00:53:57.405] Level.debug config.dart:260 ::: Check optional parameter => realm.
I/flutter (22547): [2020-10-02 00:53:57.407] Level.debug config.dart:260 ::: Check optional parameter => ha1.
I/flutter (22547): [2020-10-02 00:53:57.409] Level.debug config.dart:260 ::: Check optional parameter => register.
I/flutter (22547): [2020-10-02 00:53:57.411] Level.debug config.dart:260 ::: Check optional parameter => register_expires.
I/flutter (22547): [2020-10-02 00:53:57.414] Level.debug config.dart:260 ::: Check optional parameter => registrar_server.
I/flutter (22547): [2020-10-02 00:53:57.417] Level.debug config.dart:260 ::: Check optional parameter => register_extra_contact_uri_params.
I/flutter (22547): [2020-10-02 00:53:57.419] Level.debug config.dart:260 ::: Check optional parameter => use_preloaded_route.
I/flutter (22547): [2020-10-02 00:53:57.433] Level.debug transport.dart:53 ::: new()
I/flutter (22547): [2020-10-02 00:53:57.485] Level.debug ua.dart:163 ::: start()
I/flutter (22547): [2020-10-02 00:53:57.487] Level.debug transport.dart:111 ::: connect()
I/flutter (22547): [2020-10-02 00:53:57.489] Level.debug ua.dart:845 ::: Transport connecting
I/flutter (22547): [2020-10-02 00:53:57.493] Level.debug sip_ua_helper.dart:114 ::: connecting => Instance of 'EventSocketConnecting'
I/flutter (22547): [2020-10-02 00:53:57.498] Level.debug websocket_interface.dart:71 ::: connect()
I/flutter (22547): [2020-10-02 00:53:57.500] Level.debug websocket_interface.dart:82 ::: connecting to WebSocket ws://192.168.1.200:8088/ws
I/flutter (22547): [2020-10-02 00:53:57.508] Level.info websocket_dart_impl.dart:25 ::: connect ws://192.168.1.200:8088/ws, {Origin: 192.168.1.200, Host: 192.168.1.200:8088}, [sip]
I/flutter (22547): [2020-10-02 00:53:59.79] Level.error websocket_dart_impl.dart:107 ::: error SocketException: OS Error: No route to host, errno = 113, address = 192.168.1.200, port = 38709
I/flutter (22547): [2020-10-02 00:53:59.85] Level.debug websocket_interface.dart:98 ::: Closed [500, SocketException: OS Error: No route to host, errno = 113, address = 192.168.1.200, port = 38709]!
I/flutter (22547): [2020-10-02 00:53:59.89] Level.debug websocket_interface.dart:163 ::: WebSocket ws://192.168.1.200:8088/ws closed
I/flutter (22547): [2020-10-02 00:53:59.96] Level.debug sip_ua_helper.dart:126 ::: disconnected => Code: [500], Cause: error, Reason: SocketException: OS Error: No route to host, errno = 113, address = 192.168.1.200, port = 38709
I/flutter (22547): [2020-10-02 00:53:59.101] Level.debug transport.dart:206 ::: reconnection attempt: 1. next connection attempt in 2 seconds

mb problem on premissions?

prozaklob commented 3 years ago

im found trouble pls,dont close topic, i will write a mini manul for setting up an asterisk for sip_ua over wss :)

ghenry commented 3 years ago

Nice work!

On Fri, 2 Oct 2020, 11:16 prozaklob, notifications@github.com wrote:

im found trouble pls,dont close topic, i will write a mini manul for setting up an asterisk for sip_ua over wss :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flutter-webrtc/dart-sip-ua/issues/132#issuecomment-702647973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG66F5SPAK6ZJBIN6GEWLSIWSAHANCNFSM4SA32OGA .

prozaklob commented 3 years ago

I jumped a little to conclusions. I was able to start the server with sipml5 wss. But in the application I get the error

[2020-10-02 14:09:15.87] Level.warning registrator.dart:140 ::: <sip:1oh248uh@p41881umg0df.invalid>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:d5800269-86c3-417c-be3d-bd0c6d735ab7>" :(

ghenry commented 3 years ago

That line is correct. Just a debug log. You need to confirm WebSockets are establishing correctly.

prozaklob commented 3 years ago
  Map<String, String> _wsExtraHeaders = {
    'Origin': ' https://sip.url.by',
    'Host': 'sip.url.by:8089'
  };
          _preferences.getString('ws_uri') ?? 'wss://sip.url.by:8089/ws';
      _sipUri = _preferences.getString('sip_uri') ?? 'sip:101@sip.url.by';
      _displayName = _preferences.getString('display_name') ?? 'Flutter SIP UA';
      _password = _preferences.getString('password') ?? '101';
      _authorizationUser = _preferences.getString('auth_user') ?? '101';
I/flutter ( 6220): [2020-10-02 14:09:08.42] Level.debug websocket_interface.dart:37 ::: new() [url:wss://sip.url.by:8089/ws]
I/flutter ( 6220): [2020-10-02 14:09:08.171] Level.debug websocket_interface.dart:50 ::: SIP URI: sip:sip.url.by:8089;transport=ws
I/flutter ( 6220): [2020-10-02 14:09:08.178] Level.debug ua.dart:103 ::: new() [configuration:Instance of 'Settings']
I/flutter ( 6220): [2020-10-02 14:09:08.188] Level.info config.dart:254 ::: Check mandatory parameter => sockets.
I/flutter ( 6220): [2020-10-02 14:09:08.220] Level.info config.dart:254 ::: Check mandatory parameter => uri.
I/flutter ( 6220): [2020-10-02 14:09:08.228] Level.debug config.dart:260 ::: Check optional parameter => authorization_user.
I/flutter ( 6220): [2020-10-02 14:09:08.247] Level.debug config.dart:260 ::: Check optional parameter => user_agent.
I/flutter ( 6220): [2020-10-02 14:09:08.252] Level.debug config.dart:260 ::: Check optional parameter => connection_recovery_max_interval.
I/flutter ( 6220): [2020-10-02 14:09:08.256] Level.debug config.dart:260 ::: Check optional parameter => connection_recovery_min_interval.
I/flutter ( 6220): [2020-10-02 14:09:08.260] Level.debug config.dart:260 ::: Check optional parameter => contact_uri.
I/flutter ( 6220): [2020-10-02 14:09:08.265] Level.debug config.dart:260 ::: Check optional parameter => display_name.
I/flutter ( 6220): [2020-10-02 14:09:08.268] Level.debug config.dart:260 ::: Check optional parameter => instance_id.
I/flutter ( 6220): [2020-10-02 14:09:08.271] Level.debug config.dart:260 ::: Check optional parameter => no_answer_timeout.
I/flutter ( 6220): [2020-10-02 14:09:08.274] Level.debug config.dart:260 ::: Check optional parameter => session_timers.
I/flutter ( 6220): [2020-10-02 14:09:08.277] Level.debug config.dart:260 ::: Check optional parameter => session_timers_refresh_method.
I/flutter ( 6220): [2020-10-02 14:09:08.280] Level.debug config.dart:260 ::: Check optional parameter => password.
I/flutter ( 6220): [2020-10-02 14:09:08.283] Level.debug config.dart:260 ::: Check optional parameter => realm.
I/flutter ( 6220): [2020-10-02 14:09:08.285] Level.debug config.dart:260 ::: Check optional parameter => ha1.
I/flutter ( 6220): [2020-10-02 14:09:08.287] Level.debug config.dart:260 ::: Check optional parameter => register.
I/flutter ( 6220): [2020-10-02 14:09:08.289] Level.debug config.dart:260 ::: Check optional parameter => register_expires.
I/flutter ( 6220): [2020-10-02 14:09:08.291] Level.debug config.dart:260 ::: Check optional parameter => registrar_server.
I/flutter ( 6220): [2020-10-02 14:09:08.294] Level.debug config.dart:260 ::: Check optional parameter => register_extra_contact_uri_params.
I/flutter ( 6220): [2020-10-02 14:09:08.296] Level.debug config.dart:260 ::: Check optional parameter => use_preloaded_route.
I/flutter ( 6220): [2020-10-02 14:09:08.310] Level.debug transport.dart:53 ::: new()
I/flutter ( 6220): [2020-10-02 14:09:08.361] Level.debug ua.dart:163 ::: start()
I/flutter ( 6220): [2020-10-02 14:09:08.364] Level.debug transport.dart:111 ::: connect()
I/flutter ( 6220): [2020-10-02 14:09:08.366] Level.debug ua.dart:845 ::: Transport connecting
I/flutter ( 6220): [2020-10-02 14:09:08.369] Level.debug sip_ua_helper.dart:114 ::: connecting => Instance of 'EventSocketConnecting'
I/flutter ( 6220): [2020-10-02 14:09:08.374] Level.debug websocket_interface.dart:71 ::: connect()
I/flutter ( 6220): [2020-10-02 14:09:08.376] Level.debug websocket_interface.dart:82 ::: connecting to WebSocket wss://sip.url.by:8089/ws
I/flutter ( 6220): [2020-10-02 14:09:08.384] Level.info websocket_dart_impl.dart:25 ::: connect wss://sip.url.by:8089/ws, {Origin:  https://sip.url.by, Host: sip.url.by:8089}, [sip]
I/flutter ( 6220): [2020-10-02 14:09:08.633] Level.debug websocket_interface.dart:89 ::: Web Socket is now connected
I/flutter ( 6220): [2020-10-02 14:09:08.636] Level.debug websocket_interface.dart:158 ::: WebSocket wss://sip.url.by:8089/ws connected
I/flutter ( 6220): [2020-10-02 14:09:08.640] Level.debug ua.dart:851 ::: Transport connected
I/flutter ( 6220): [2020-10-02 14:09:08.644] Level.debug sip_ua_helper.dart:120 ::: connected => Instance of 'EventSocketConnected'
I/flutter ( 6220): [2020-10-02 14:09:08.651] Level.warning registrator.dart:140 ::: <sip:1oh248uh@p41881umg0df.invalid>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:d5800269-86c3-417c-be3d-bd0c6d735ab7>"
I/flutter ( 6220): [2020-10-02 14:09:08.670] Level.debug transport.dart:167 ::: send()
I/flutter ( 6220): [2020-10-02 14:09:08.675] Level.debug websocket_interface.dart:133 ::: send()
I/flutter ( 6220): [2020-10-02 14:09:08.691] Level.debug websocket_dart_impl.dart:51 ::: send:
I/flutter ( 6220):
I/flutter ( 6220): REGISTER sip:sip.url.by SIP/2.0
I/flutter ( 6220): Via: SIP/2.0/WS p41881umg0df.invalid;branch=z9hG4bK436126262
I/flutter ( 6220): Max-Forwards: 69
I/flutter ( 6220): To: <sip:101@sip.url.by>
I/flutter ( 6220): From: "Flutter SIP UA" <sip:101@sip.url.by>;tag=7281676672
I/flutter ( 6220): Call-ID: 8il8vt6xfoo6giy9fie5yp
I/flutter ( 6220): CSeq: 1 REGISTER
I/flutter ( 6220): Contact: <sip:1oh248uh@p41881umg0df.invalid>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:d5800269-86c3-417c-be3d-bd0c6d735ab7>";expires=600
I/flutter ( 6220): Expires: 600
I/flutter ( 6220): Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO
I/flutter ( 6220): Supported: path,gruu,outbound
I/flutter ( 6220): User-Agent: Dart SIP Client v1.0.0
I/flutter ( 6220): Content-Length: 0
I/flutter ( 6220):
I/flutter ( 6220): [2020-10-02 14:09:08.706] Level.debug websocket_interface.dart:98 ::: Closed [1002, null]!
I/flutter ( 6220): [2020-10-02 14:09:08.708] Level.debug websocket_interface.dart:163 ::: WebSocket wss://sip.url.by:8089/ws closed
I/flutter ( 6220): [2020-10-02 14:09:08.713] Level.debug non_invite_client.dart:52 ::: transport error occurred, deleting transaction z9hG4bK436126262
I/flutter ( 6220): [2020-10-02 14:09:08.722] Level.debug sip_ua_helper.dart:147 ::: registrationFailed => Code: [500], Cause: SIP Failure Code, Reason: Connection Error
I/flutter ( 6220): [2020-10-02 14:09:08.727] Level.debug sip_ua_helper.dart:126 ::: disconnected => Code: [1002], Cause: error, Reason: null
I/flutter ( 6220): [2020-10-02 14:09:08.730] Level.debug transport.dart:206 ::: reconnection attempt: 1. next connection attempt in 2 seconds
I/flutter ( 6220): [2020-10-02 14:09:10.744] Level.debug transport.dart:111 ::: connect()
I/flutter ( 6220): [2020-10-02 14:09:10.748] Level.debug ua.dart:845 ::: Transport connecting
I/flutter ( 6220): [2020-10-02 14:09:10.750] Level.debug sip_ua_helper.dart:114 ::: connecting => Instance of 'EventSocketConnecting'
I/flutter ( 6220): [2020-10-02 14:09:10.754] Level.debug websocket_interface.dart:71 ::: connect()
I/flutter ( 6220): [2020-10-02 14:09:10.757] Level.debug websocket_interface.dart:115 ::: disconnect()
I/flutter ( 6220): [2020-10-02 14:09:10.758] Level.debug websocket_interface.dart:163 ::: WebSocket wss://sip.url.by:8089/ws closed
I/flutter ( 6220): [2020-10-02 14:09:10.760] Level.debug sip_ua_helper.dart:126 ::: disconnected => Code: [0], Cause: error, Reason: Client send disconnect
I/flutter ( 6220): [2020-10-02 14:09:10.762] Level.debug transport.dart:206 ::: reconnection attempt: 2. next connection attempt in 2 seconds
ghenry commented 3 years ago

Stick with ws:// and debug that first on the server side.

prozaklob commented 3 years ago

ws too not work in app

ghenry commented 3 years ago

Well it does :-)

Just not with your config?

prozaklob commented 3 years ago

app or server? im test server on any app and work fine

ghenry commented 3 years ago

I presume you're using the example app?

prozaklob commented 3 years ago

yes

prozaklob commented 3 years ago

hmmm... im now try run on web 'chrome' and registr - ok

Do you need to add something to the permissions for android, or additional settings?

my manifest file have:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
ghenry commented 3 years ago

Ah, I remember now. I had to set the Origin ws extra headers when https://tryit.jssip.net worked but the example app didn't. I do this:

    var _wsExtraHeaders = <String, String>{
      'X-Example-App':
          'Example-App-Name v${_packageInfo.version}+${_packageInfo.buildNumber}: ' +
              EnvConf.GIT_REV,
      'Origin': _packageInfo.packageName,
    };

...
    settings.webSocketSettings.extraHeaders = _wsExtraHeaders;

You don't need the X- header above, but we use it to cross check things.

Technically the Origin header isn't a required header for the WebSocket spec unless you're using a web browser, but most server side implementations need it - https://tools.ietf.org/html/rfc6455#section-10.2

@cloudwebrtc should we add this to the example app as default?

prozaklob commented 3 years ago

in example now:

  Map<String, String> _wsExtraHeaders = {
    'Origin': ' https://sip.url.by',
    'Host': 'sip.url.by:8089'
  };
prozaklob commented 3 years ago

im try comment settings.webSocketSettings.extraHeaders = _wsExtraHeaders;

browser work fine android - not work

ghenry commented 3 years ago

Did you run:

https://github.com/flutter-webrtc/dart-sip-ua/tree/master/example/scripts

and have the same perms?

prozaklob commented 3 years ago

run add-line.py - install

run sh - create Project [sip_ua_example] already exists!

prozaklob commented 3 years ago

now. im cleanup and create again testing

prozaklob commented 3 years ago

had no effect

ghenry commented 3 years ago

You'll figure it out. Compare the WebSocket traffic to a working web browser.

prozaklob commented 3 years ago

ok. now:

wscat -s echo -c wss://sip.url.by:8089/ws
error: unable to verify the first certificate

im use wildcard

ws://sip.url.by:8088/ws
connected

now im try use ws in sip_ua:

I/flutter (30845): [2020-10-03 00:12:11.358] Level.error websocket_dart_impl.dart:108 ::: error Bad state: Insecure HTTP is not allowed by platform: http://sip.url.by:8088
I/flutter (30845): [2020-10-03 00:12:11.363] Level.debug websocket_interface.dart:98 ::: Closed [500, Bad state: Insecure HTTP is not allowed by platform: http://sip.url.by:8088]!
I/flutter (30845): [2020-10-03 00:12:11.367] Level.debug websocket_interface.dart:163 ::: WebSocket ws://sip.url.by:8088/ws closed

hmm...

ghenry commented 3 years ago

Do you have the right certificate chain?

https://www.google.com/search?q=test%20my%20certificate%20chain

prozaklob commented 3 years ago

yes. it wildcard comodo.

if i open https://sip.url.by:8089/ws in browser - i see guard connection. cert is fine

prozaklob commented 3 years ago

The wscat error while connecting to wss is not indicative. This may indicate that the system has old certificates. ( debian )

ghenry commented 3 years ago

That doesn't mean the chain is correct.

I would try a non wildcard certificate.

On Fri, 2 Oct 2020, 22:29 prozaklob, notifications@github.com wrote:

yes. it wildcard comodo.

if i open https://sip.url.by:8089/ws in browser - i see guard connection. cert is fine

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flutter-webrtc/dart-sip-ua/issues/132#issuecomment-702966301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG66FEH24QEYZRLKIRFC3SIZA2XANCNFSM4SA32OGA .

prozaklob commented 3 years ago

im try self cert. no result ))

ghenry commented 3 years ago

What Asterisk version? I'll try the example against it tomorrow night.

Can you create a GitHub repo I can clone with a similar Asterisk config?

Just plain ws first.

Thanks.

prozaklob commented 3 years ago

now i change flutter channel from master to stable and again take error:

I/flutter ( 7960): [2020-10-02 22:00:21.781] Level.debug websocket_interface.dart:98 ::: Closed [1002, null]! I/flutter ( 7960): [2020-10-02 22:00:21.783] Level.debug websocket_interface.dart:163 ::: WebSocket ws://10.10.11.200:8088/ws closed

prozaklob commented 3 years ago

mb problem on version sdk and webrtc?

    • Flutter version 1.22.0
    • Dart version 2.10.0
    • Platform android-30, build-tools 30.0.2
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

flutter_webrtc-0.3.3
ghenry commented 3 years ago

Nope, l works for me on those.

We use OpenSIPS 3.1 with wss in from of FreeSWITCH.

Have you set up like this?

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=40818097

prozaklob commented 3 years ago

yes. it true manual. sip is old. now use pjsip.

I've been administering an asterisk for more than 10 years, but I've never experienced such humiliation )))))

I can't figure out why the web version works well and connects to wss ( sip ua on chrome ), same way SIPML5 too work fine. only android not work.

prozaklob commented 3 years ago
pjsip.conf

[transport-wss]
type=transport
protocol=ws
bind=0.0.0.0

[webrtc_client]
type=aor
max_contacts=5
remove_existing=yes

[webrtc_client]
type=auth
auth_type=userpass
username=101
password=101

[webrtc_client]
type=endpoint
aors=webrtc_client
auth=webrtc_client
webrtc=yes
context=default
disallow=all
allow=opus,ulaw

http.conf

[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
tlsenable=yes
tlsbindaddr=0.0.0.0:8089
tlscertfile=/etc/asterisk/keys/asterisk.crt
tlscafile=/etc/asterisk/keys/asterisk.ca-bundle
tlsprivatekey=/etc/asterisk/keys/asterisk.key
ghenry commented 3 years ago

Compare the ws traffic and check for missing things

On Fri, 2 Oct 2020 at 23:15, prozaklob notifications@github.com wrote:

yes. it true manual. sip is old. now use pjsip.

I've been administering an asterisk for more than 10 years, but I've never experienced such humiliation )))))

I can't figure out why the web version works well and connects to wss ( sip ua on chrome ), same way SIPML5 too work fine.

only android not work.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/flutter-webrtc/dart-sip-ua/issues/132#issuecomment-702980664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG66D65ET7QJDVD72L5MLSIZGGPANCNFSM4SA32OGA .

-- Kind Regards,

Gavin Henry. Managing Director.

T +44 (0) 330 44 50 000 D +44 (0) 330 44 55 007 M +44 (0) 7930 323266 F +44 (0) 1224 824887 E ghenry@suretec.co.uk

Open Source. Open Solutions(tm).

http://www.suretecsystems.com/

Suretec Systems is a limited company registered in Scotland. Registered number: SC258005. Registered office: 24 Cormack Park, Rothienorman, Inverurie, Aberdeenshire, AB51 8GL.

Subject to disclaimer at http://www.suretecgroup.com/disclaimer.html

prozaklob commented 3 years ago

how Compare? in debug log?

cloudwebrtc commented 3 years ago

I think you can try this version, https://github.com/flutter-webrtc/dart-sip-ua/commit/cd1e37a79e868c5bfef7ea2c439c2dbc788930f9,

On the old version of FreeSwitch, because of the problem caused by the case sensitivity of the WebSocket Upgrade Header, we got the normal registration after changing to the mandatory case (dart-sdk will convert all HTTP headers to lower case by default), so maybe on asterisk, The same problem exists,

prozaklob commented 3 years ago

I think you can try this version, cd1e37a,

On the old version of FreeSwitch, because of the problem caused by the case sensitivity of the WebSocket Upgrade Header, we got the normal registration after changing to the mandatory case (dart-sdk will convert all HTTP headers to lower case by default), so maybe on asterisk, The same problem exists,

thanks. I'll try now, but there is little faith. :( Because the web version from the browser connects without problems

prozaklob commented 3 years ago

I think you can try this version, cd1e37a,

On the old version of FreeSwitch, because of the problem caused by the case sensitivity of the WebSocket Upgrade Header, we got the normal registration after changing to the mandatory case (dart-sdk will convert all HTTP headers to lower case by default), so maybe on asterisk, The same problem exists,

yap. its not work :(

cloudwebrtc commented 3 years ago

@prozaklob What version of Asterisk are you using? Can you package a copy of /etc/asterisk/*.conf for me? This way I can try to test on docker.

prozaklob commented 3 years ago

@prozaklob What version of Asterisk are you using? Can you package a copy of /etc/asterisk/*.conf for me? This way I can try to test on docker.

16 and 17

need only 2 config pjsip and http https://github.com/flutter-webrtc/dart-sip-ua/issues/132#issuecomment-702981376

ghenry commented 3 years ago

Do an ngrep on the plain text ws

On Sat, 3 Oct 2020, 00:14 prozaklob, notifications@github.com wrote:

how Compare? in debug log?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flutter-webrtc/dart-sip-ua/issues/132#issuecomment-702995771, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG66DZH2WEZ74IQ72HYNLSIZNEVANCNFSM4SA32OGA .

prozaklob commented 3 years ago

Do an ngrep on the plain text ws

?

ghenry commented 3 years ago

Run this on the Asterisk server:

ngrep -W byline -td any . port 8088

Run sip-ua in plain websocket mode on the mobile and Web browser and compare both traces.

Make sense?

Thanks