--- /usr/asterisk-11.18.0/res/res_rtp_asterisk.c 2015-06-03 20:44:42.000000000 -0400 +++ /usr/src/asterisk-11.18.0/res/res_rtp_asterisk.c 2015-06-15 08:31:11.450749712 -0400 @@ -104,7 +104,6 @@ #define ZFONE_PROFILE_ID 0x505a #define DEFAULT_LEARNING_MIN_SEQUENTIAL 4 - #define SRTP_MASTER_KEY_LEN 16 #define SRTP_MASTER_SALT_LEN 14 #define SRTP_MASTER_LEN (SRTP_MASTER_KEY_LEN + SRTP_MASTER_SALT_LEN) @@ -630,6 +629,7 @@ static void ast_rtp_ice_start(struct ast_rtp_instance *instance) { + struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); pj_str_t ufrag = pj_str(rtp->remote_ufrag), passwd = pj_str(rtp->remote_passwd); pj_ice_sess_cand candidates[PJ_ICE_MAX_CAND]; @@ -656,7 +656,6 @@ /* Reset the ICE session. Is this going to work? */ if (ice_reset_session(instance)) { - ast_log(LOG_NOTICE, "Failed to create replacement ICE session\n"); return; } @@ -1571,6 +1570,7 @@ { struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); + if (!dtls->ssl) { return; } @@ -1590,10 +1590,11 @@ #endif #ifdef USE_PJPROJECT -static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_status_t status) +static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_ice_strans_op op, pj_status_t status) { struct ast_rtp_instance *instance = ice->user_data; struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); + const char *opname = (op==PJ_ICE_STRANS_OP_INIT? "initialization" : (op==PJ_ICE_STRANS_OP_NEGOTIATION ? "negotiation" : "unknown_op")); if (status == PJ_SUCCESS) { struct ast_sockaddr remote_address; @@ -1607,17 +1608,20 @@ if (rtp->rtcp) { update_address_with_ice_candidate(rtp, AST_RTP_ICE_COMPONENT_RTCP, &rtp->rtcp->them); } - } - #ifdef HAVE_OPENSSL_SRTP - dtls_perform_handshake(instance, &rtp->dtls, 0); - - if (rtp->rtcp) { - dtls_perform_handshake(instance, &rtp->rtcp->dtls, 1); - } + dtls_perform_handshake(instance, &rtp->dtls, 0); + if (rtp->rtcp) { + dtls_perform_handshake(instance, &rtp->rtcp->dtls, 1); + } #endif - + } else { + char errmsg[PJ_ERR_MSG_SIZE]; + pj_strerror(status, errmsg, sizeof(errmsg)); + ast_log(LOG_NOTICE,"ICE %s failed: %s\n", opname, errmsg); + } + if (!strictrtp) { + ast_log(LOG_NOTICE, "not strict rtp\n"); return; } @@ -4772,7 +4776,6 @@ { struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); struct sockaddr_in suggestion_tmp; - ast_sockaddr_to_sin(suggestion, &suggestion_tmp); ast_stun_request(rtp->s, &suggestion_tmp, username, NULL); ast_sockaddr_from_sin(suggestion, &suggestion_tmp);