[2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: trying to set dtls conf on 0x7fc010073e78 [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: stefandebug setting bio 0x7fc0100818b0 an 0x7fc01007b2a0 and 0x7fc0100a92c0 [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: stefandebug setting connect_state 0x7fc0100818b0 [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: stefandebug setting bio 0x7fc0100211b0 an 0x7fc01008f6c0 and 0x7fc010001000 [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: stefandebug setting connect_state 0x7fc0100211b0 //chan sip parrses sdp and decides we should be DTLS clients [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: setting connect state on 0x7fc0100818b0 [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: setting connect state FINISHED on 0x7fc0100818b0 [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: setting connect state on 0x7fc0100211b0 [2015-03-01 14:27:19] ERROR[15933][C-000000f1] res_rtp_asterisk.c: setting connect state FINISHED on 0x7fc0100211b0 //openssl produces client hello on rtp and rtcps bios, which we send to webrtc peers [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: dtls perform handshake called on rtp, dtls, rtcp?: 0x7fc010073e78 , 0x7fc010084c50, 0 [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: stefandebug SSL_do_handshake finished, 0x7fc010073e78 , 0x7fc010084c50, 0x7fc0100818b0 [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: doing bio read in srtp check pending, 0x7fc010084c50, 0 [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: bio read return value, 169 [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: dtls perform handshake called on rtp, dtls, rtcp?: 0x7fc010073e78 , 0x7fc010090da0, 1 [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: stefandebug SSL_do_handshake finished, 0x7fc010073e78 , 0x7fc010090da0, 0x7fc0100211b0 [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: doing bio read in srtp check pending, 0x7fc010090da0, 1 [2015-03-01 14:27:19] ERROR[15067] res_rtp_asterisk.c: bio read return value, 169 //we received server hellos from webrtc peers on rtp-port and respond with a big dtls message containing "Certificate, Client Key Exchange, Certificate Verify, Change Cipher Spec, Encrypted Handshake Message - since this message is 1510 it produces ip packets bigger than MTU, not a problem?" [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: We received an ssl packet rtp,'0x7fc010073e78', dtls, 0x7fc010084c50 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Writing buf len 812 to dtls->read_bio ,'0x7fc010073e78', dtls, 0x7fc010084c50 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Finished reading, len -1,'0x7fc010073e78', dtls, 0x7fc010084c50 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: doing bio read in srtp check pending, 0x7fc010084c50, 0 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: bio read return value, 1510 //we received server hellos from webrtc peers on rtcp-port and respond with a big dtls message containing "Certificate, Client Key Exchange, Certificate Verify, Change Cipher Spec, Encrypted Handshake Message since this message is 1510 it produces ip packets bigger than MTU, not a problem?" [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: We received an ssl packet rtp,'0x7fc010073e78', dtls, 0x7fc010090da0 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Writing buf len 812 to dtls->read_bio ,'0x7fc010073e78', dtls, 0x7fc010090da0 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Finished reading, len -1,'0x7fc010073e78', dtls, 0x7fc010090da0 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: doing bio read in srtp check pending, 0x7fc010090da0, 1 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: bio read return value, 1510 //on RTP we receive "New Session Ticket, Change Cipher Spec, Encrypted Handshake Message" after passing this to openssl we decide it's time to call dtls_set_setup" [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: We received an ssl packet rtp,'0x7fc010073e78', dtls, 0x7fc010084c50 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Writing buf len 1306 to dtls->read_bio ,'0x7fc010073e78', dtls, 0x7fc010084c50 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Finished reading, len -1,'0x7fc010073e78', dtls, 0x7fc010084c50 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: calling dtls_set_setup from rtp_rcvfrom because init is finished on rtp->dtls->ssl,'0x7fc010073e78', 0x7fc010073e78 [2015-03-01 14:27:19] ERROR[25826][C-000000f1] res_rtp_asterisk.c: calling dtls_set_setup FINISHED - rtp_rcvfrom because init is finished on rtp->dtls->ssl,'0x7fc010073e78', //TIMEOUT happend on rtcp-stream, just before we receive "New Session Ticket, Change Cipher Spec, Encrypted Handshake Message" on RTCP-port... Was the timer (999 milliseconds) too short? //When timeout function calls dtls_srtp_check_pending, it reads the same buffer as the thread from __rtp_rcvfrom containing that 1510 message... This is not good we should have let the other thread finish... //To avoid this we need to protect dtls_srtp_check_pending from __rtp_rcvfrom somehow [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: dtls_srtp_handle_timeout called, instance: 0x7fc010073e78 [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: DTLSv1_handle_timeout FINISHED on RTCP, rtp instance,0x7fc010073e78 , dtls: (nil), dtls->ssl: (nil) [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: doing bio read in srtp check pending, 0x7fc010090da0, 1 [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: bio read return value, 1510 [2015-03-01 14:27:20] ERROR[25826][C-000000f1] res_rtp_asterisk.c: We received an ssl packet rtp,'0x7fc010073e78', dtls, 0x7fc010090da0 [2015-03-01 14:27:20] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Writing buf len 1215 to dtls->read_bio ,'0x7fc010073e78', dtls, 0x7fc010090da0 [2015-03-01 14:27:20] ERROR[25826][C-000000f1] res_rtp_asterisk.c: Finished reading, len -1,'0x7fc010073e78', dtls, 0x7fc010090da0 [2015-03-01 14:27:20] ERROR[25826][C-000000f1] res_rtp_asterisk.c: UNEXPECTED DTLS failure occurred on RTP instance '0x7fc010073e78' due to reason 'length mismatch', terminating [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: RTCP about to do SSL_free from ast_rtp_destroy on 0x7fbfe4083b20 [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: RTP destroy. about to do SSL_free from ast_rtp_destroy on 0x7fbfe4067160 [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: stefandebug DESTROYING RTP INSTANCE 0x7fc010073e78 [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: RTCP about to do SSL_free from ast_rtp_destroy on 0x7fc010090da0 [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: RTP destroy. about to do SSL_free from ast_rtp_destroy on 0x7fc010084c50 [2015-03-01 14:27:20] ERROR[15151] res_rtp_asterisk.c: RTP destroy. about to do SSL_free from ast_rtp_destroy on 0x7fbff0317b10