gmaruzz / saraphone

SaraPhone is an open source SIP WebRTC phone, complete with HotDesking, Redial, BLFs, MWI, DND, PhoneBook, Hold, Mute, Notifications. SaraPhone is fully integrated with FusionPBX. Based on SIP.js, SaraPhone works with all WebRTC compliant servers: FreeSWITCH, Asterisk, OpenSIPS, Kamailio, etc. SaraPhone gets its name from Giovanni's wife, Sara.
Mozilla Public License 2.0
152 stars 71 forks source link

Location match in apache2 wss proxy #5

Closed juha-h closed 4 years ago

juha-h commented 4 years ago

I edited saraphone.html with my login and server info. When I then press Login, nothing happens except I'm asked for microphone permission.

Browser console has this:

Sat Apr 18 2020 15:28:12 GMT+0300 (Eastern European Summer Time) | sip.ua | next connection attempt in 2 seconds sip.js:2900:10
GEThttps://test.tutpro.com/saraphone/saraphone.html
[HTTP/1.1 200 OK 467ms]

Sat Apr 18 2020 15:28:12 GMT+0300 (Eastern European Summer Time) | sip.ua | user requested closure... sip.js:2900:10
Sat Apr 18 2020 15:28:12 GMT+0300 (Eastern European Summer Time) | sip.ua | closing registerContext sip.js:2900:10
Sat Apr 18 2020 15:28:12 GMT+0300 (Eastern European Summer Time) | sip.transport | closing WebSocket wss://192.168.43.82:443 sip.js:2900:10
GEThttps://test.tutpro.com/saraphone/css/bootstrap.min.css
[HTTP/1.1 200 OK 8ms]

GEThttps://test.tutpro.com/saraphone/css/style2.css
[HTTP/1.1 200 OK 165ms]

GEThttps://test.tutpro.com/saraphone/js/adapter.js
[HTTP/1.1 200 OK 39ms]

GEThttps://test.tutpro.com/saraphone/js/jquery.min.js
[HTTP/1.1 200 OK 277ms]

GEThttps://test.tutpro.com/saraphone/js/sip.js
[HTTP/1.1 200 OK 339ms]

GEThttps://test.tutpro.com/saraphone/saraphone.js?random=5e95b0591ba90
[HTTP/1.1 200 OK 262ms]

GEThttps://test.tutpro.com/saraphone/wav/0.wav
[HTTP/1.1 206 Partial Content 0ms]

GEThttps://test.tutpro.com/saraphone/wav/1.wav
[HTTP/1.1 206 Partial Content 0ms]

GEThttps://test.tutpro.com/saraphone/wav/2.wav
[HTTP/1.1 206 Partial Content 0ms]

GEThttps://test.tutpro.com/saraphone/wav/3.wav
[HTTP/1.1 206 Partial Content 1ms]

GEThttps://test.tutpro.com/saraphone/wav/4.wav
[HTTP/1.1 206 Partial Content 1ms]

GEThttps://test.tutpro.com/saraphone/wav/5.wav
[HTTP/1.1 206 Partial Content 0ms]

GEThttps://test.tutpro.com/saraphone/wav/6.wav
[HTTP/1.1 206 Partial Content 0ms]

GEThttps://test.tutpro.com/saraphone/wav/7.wav
[HTTP/1.1 206 Partial Content 1ms]

GEThttps://test.tutpro.com/saraphone/wav/8.wav
[HTTP/1.1 206 Partial Content 0ms]

GEThttps://test.tutpro.com/saraphone/wav/9.wav
[HTTP/1.1 206 Partial Content 1ms]

GEThttps://test.tutpro.com/saraphone/wav/star.wav
[HTTP/1.1 206 Partial Content 0ms]

GEThttps://test.tutpro.com/saraphone/wav/hash.wav
[HTTP/1.1 206 Partial Content 1ms]

GEThttps://test.tutpro.com/saraphone/wav/silence.wav
[HTTP/1.1 206 Partial Content 1ms]

GEThttps://test.tutpro.com/saraphone/mp3/ring.mp3
[HTTP/1.1 206 Partial Content 11ms]

The doctor is in saraphone.js:1004:13
Is something troubling you? saraphone.js:1005:13
GEThttps://test.tutpro.com/saraphone/favicon.ico
gmaruzz commented 4 years ago

seems you do not have a valid sip server speaking wss on port 443 you NEED or FreeSWITCH or OpenSIPS, or Asterisk, or Kamailio, or FusionPBX correctly configured and with correct certificates

an HTTP(s), like apache or nginx, will NOT be enough

Do you have a SIP server that speaks WSS? If you do not have it, please close this ticket

juha-h commented 4 years ago

I do have an apache server that acts as wss proxy:

<VirtualHost _default_:443>
    ...
    SSLProxyEngine on
    <LocationMatch /wss/>
            ProxyPass ws://192.168.43.188:7998/
    </LocationMatch>

</VirtualHost>
juha-h commented 4 years ago

Sara tries to connect, but does not succeed:

Sat Apr 18 2020 16:04:39 GMT+0300 (Eastern European Summer Time) | sip.transport | connecting to WebSocket wss://192.168.43.82:443

I don't know why. Nothing comes to apache2 access or error log. I'll try with JsSIP client to make sure that apache2 is OK.

gmaruzz commented 4 years ago

your location match ( <LocationMatch /wss/> ) in apache config will not match, unless you modify the saraphone code to connect to:

wss://192.168.43.82:443/wss/

juha-h commented 4 years ago

Are you saying that currently it is not possible to add path /wss by editing saraphone.html?