#504 OpalTransportWSS doesn't work (Google Chrome)

Development_Branch
closed-fixed
nobody
None
5
2014-03-24
2014-03-19
No

It seems like OpalTransportWS works fine, but OpalTransportWSS doesn't (I'm trying to make an incoming call).

According to Wireshark dump OPAL closes TCP connection.
I see that OPAL receives HTTP request, so SSL connection is established.

Last log messages:

14-03-19 19:22:51,790 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL General: before/accept initialization
14-03-19 19:22:51,791 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: before/accept initialization
14-03-19 19:22:51,793 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 read client hello A
14-03-19 19:22:51,793 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 write server hello A
14-03-19 19:22:51,795 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 write certificate A
14-03-19 19:22:51,795 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 write server done A
14-03-19 19:22:51,796 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 flush data
14-03-19 19:22:51,850 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 read client key exchange A
14-03-19 19:22:51,859 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 read finished A
14-03-19 19:22:51,860 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 write session ticket A
14-03-19 19:22:51,860 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 write change cipher spec A
14-03-19 19:22:51,863 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 write finished A
14-03-19 19:22:51,864 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSLv3 flush data
14-03-19 19:22:51,864 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL General: SSL negotiation finished successfully
14-03-19 19:22:51,865 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Accept: SSL negotiation finished successfully
14-03-19 19:22:51,868 (MCUTest.Blank) INFO Opal Listener:10556 transports.cxx(1342) OpalTCP Started connection to 192.168.201.21:56451 (if=192.168.201.21:8080)
14-03-19 19:22:51,869 (MCUTest.Blank) DEBUG Opal Listener:10556 pssl.cxx(1670) SSL Alert write warning: close notify
14-03-19 19:22:51,870 (MCUTest.Blank) DEBUG Opal Listener:10556 transports.cxx(764) Listen Waiting on socket accept on wss$192.168.201.21:8080
14-03-19 19:22:51,870 (MCUTest.Blank) INFO Opal Answer:9976 transports.cxx(641) Listen Handling accepted connection: wss$192.168.201.21:56451<if=wss$192.168.201.21:8080>
14-03-19 19:22:51,871 (MCUTest.Blank) DEBUG Opal Answer:9976 sipep.cxx(227) SIP Remembering transport wss$192.168.201.21:56451<if=wss$192.168.201.21:8080>
14-03-19 19:22:51,871 (MCUTest.Blank) DEBUG Opal Answer:9976 sipep.cxx(233) SIP Transport read thread started.
14-03-19 19:22:51,872 (MCUTest.Blank) DEBUG Opal Answer:9976 sipep.cxx(357) SIP Waiting for PDU on wss$192.168.201.21:56451<if=wss$192.168.201.21:8080>
14-03-19 19:22:51,872 (MCUTest.Blank) ERROR Opal Answer:9976 sippdu.cxx(2132) SIP Attempt to read PDU from closed transport wss$192.168.201.21:56451<if=wss$192.168.201.21:8080>
14-03-19 19:22:51,873 (MCUTest.Blank) DEBUG Opal Answer:9976 sipep.cxx(242) SIP Transport read thread finished.
14-03-19 19:22:51,873 (MCUTest.Blank) INFO Opal Answer:9976 osutils.cxx(2054) PTLib Thread ended: name="Opal Answer:9976", real=0.004, kernel=0.000 (0%), user=0.000 (0%), both=0.000 (0%)

Discussion

  • OpalTransportWSS isn't opened after OpalListenerWSS::OnAccept, so the next code is executed.

    if (!m_transport->IsOpen()) {
    PTRACE(1, "SIP\tAttempt to read PDU from closed transport " << *m_transport);
    return Local_TransportLost;
    }

    I see that OpalTransportWS opens m_channel in the c-tor, but OpalTransportWSS contains m_channel (PSSLChannel) that is not opened (IsOpen returns false).

     
    Last edit: Valeriy V. Argunov 2014-03-20
  • I see that PSSLChannel must be opened from PSSLChannel::Accept.
    So I've found the real bug: OpalListenerWSS doesn't call ws.Detach();

    I've changed OpalListenerWSS::OnAccept:

    OpalTransport * OpalListenerWSS::OnAccept(PTCPSocket * socket)
    {
    PSSLChannel * ssl = new PSSLChannel(m_sslContext);
    if (ssl->Accept(socket)) {
    PHTTPServer ws;
    ws.SetWebSocketNotifier("sip", PHTTPServer::WebSocketNotifier());

    if (ws.Open(*ssl)) {
      while (ws.ProcessCommand())
        ;
      ws.Detach();
      if (ssl->IsOpen())
        return new OpalTransportWSS(endpoint, ssl);
    }
    

    }

    PTRACE(1, "OpalTLS\tAccept failed: " << ssl->GetErrorText());
    delete ssl; // Will also delete socket
    return NULL;
    }

    and now the connection proceeds (but there are other troubles).

     
    Last edit: Valeriy V. Argunov 2014-03-20
  • Patch #266 fixes this.

     
    • status: open --> closed-fixed