-->

SIPML 5 Client and SipServlets not works Using WSS

2019-07-19 18:00发布

问题:

I Have Tomcat run on HTTPS. I have tried to deploy SIPML5 WebSocket Application To into my tomcat. When I tried to connect Sip Servlets using ws : ws://192.168.X.Y:5082

And Sip Servlets Config looks like :

<Connector port="5082" 
         ipAddress = "192.168.X.Y"
         protocol="org.mobicents.servlet.sip.startup.SipProtocolHandler"
         signalingTransport="ws"/>

I got an error : SIPml-api.js:4 Mixed Content: The page at 'https://192.168.X1.X2:8443/CallCenterBK/CallCenterBK.jsp?sip=1' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://192.168.X.Y:5082/'. This request has been blocked; this endpoint must be available over WSS.

When I have changes my SIPML 5 Client to wss : wss://192.168.X.Y:5082

And my sip servlets config looks like :

<Connector port="5082" 
         ipAddress = "192.168.X.Y"
         protocol="org.mobicents.servlet.sip.startup.SipProtocolHandler"
         signalingTransport="wss"/>

I got another error : WebSocket connection to 'wss://192.168.X.Y:5082/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED

And when I have set to sipml 5 client : wss://192.168.X.Y:5082 and config changed to :

<Connector port="5082" 
         ipAddress = "192.168.X.Y"
         protocol="org.mobicents.servlet.sip.startup.SipProtocolHandler"
         signalingTransport="ws"/>

I got an error : WebSocket connection to 'wss://192.168.1.3:5082/' failed: Error in connection establishment: net::ERR_TIMED_OUT

What I did incorrectly ?

Any idea will be appreciated.

回答1:

You configured the HTTPs connector with the certificate information, you need to do the same thing for the WSS connector. Unfortunately the configuration for that is located at the SIP Stack level, so you need to edit your standalone/configuration/mss-sip-stack.properties and add

gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE=Disabled
javax.net.ssl.keyStore=$TRUSTSTORE_FILE
javax.net.ssl.keyStorePassword=$TRUSTSTORE_PASSWORD
javax.net.ssl.trustStorePassword=$TRUSTSTORE_PASSWORD
javax.net.ssl.trustStore=$TRUSTSTORE_FILE
javax.net.ssl.keyStoreType=JKS


回答2:

SIPML5 works fine with wss for sure. The problem is on your server side.

  1. Make sure that 5082 port is listening (telnet)
  2. Make sure that you have installed a valid SSL certificate to your server
  3. Make sure that 5082 is the secure (wss) port (On most servers the ws unsecured and wss secured are listening on different ports)