Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 376139) +++ channels/chan_sip.c (working copy) @@ -12498,6 +12498,12 @@ i = ao2_iterator_init(candidates, 0); while ((candidate = ao2_iterator_next(&i))) { + static const int generation = 0; + static const int svn = 25; + int i, len = strlen(candidate->transport); + for(i = 0; i < len; ++i){ + candidate->transport[i] = tolower(candidate->transport[i]); + } ast_str_append(a_buf, 0, "a=candidate:%s %d %s %d ", candidate->foundation, candidate->id, candidate->transport, candidate->priority); ast_str_append(a_buf, 0, "%s ", ast_sockaddr_stringify_host(&candidate->address)); ast_str_append(a_buf, 0, "%s typ ", ast_sockaddr_stringify_port(&candidate->address)); @@ -12514,7 +12520,7 @@ ast_str_append(a_buf, 0, " raddr %s ", ast_sockaddr_stringify_host(&candidate->relay_address)); ast_str_append(a_buf, 0, "rport %s", ast_sockaddr_stringify_port(&candidate->relay_address)); } - + ast_str_append(a_buf, 0, " generation %d svn %d", generation, svn); ast_str_append(a_buf, 0, "\r\n"); ao2_ref(candidate, -1); } @@ -13172,6 +13178,12 @@ ast_debug(3, "-- Done with adding codecs to SDP\n"); + /*/ FIXME: WebRTC + ast_str_append(&a_audio, 0, "a=mid:audio\r\n"); + ast_str_append(&a_audio, 0, "a=ssrc:%u cname:%s\r\n", 1911648931, "ldjWoB60jbyQlR6e"); + ast_str_append(&a_audio, 0, "a=ssrc:%u mslabel:%s\r\n", 1911648931, "6994f7d1-6ce9-4fbd-acfd-84e5131ca2e2"); + ast_str_append(&a_audio, 0, "a=ssrc:%u label:%s\r\n", 1911648931, "Doubango");*/ + if (!p->owner || !ast_internal_timing_enabled(p->owner)) ast_str_append(&a_audio, 0, "a=silenceSupp:off - - - -\r\n"); Index: channels/sip/sdp_crypto.c =================================================================== --- channels/sip/sdp_crypto.c (revision 376139) +++ channels/sip/sdp_crypto.c (working copy) @@ -48,6 +48,7 @@ struct sdp_crypto { char *a_crypto; + char *tag; unsigned char local_key[SRTP_MASTER_LEN]; char local_key64[SRTP_MASTER_LEN64]; unsigned char remote_key[SRTP_MASTER_LEN]; @@ -63,6 +64,7 @@ void sdp_crypto_destroy(struct sdp_crypto *crypto) { ast_free(crypto->a_crypto); + ast_free(crypto->tag); crypto->a_crypto = NULL; ast_free(crypto); } @@ -282,6 +284,7 @@ return -1; } snprintf(p->a_crypto, attr_len + 10, "a=crypto:%s %s inline:%s\r\n", tag, suite, p->local_key64); + p->tag = strdup(tag); } return 0; } @@ -294,8 +297,8 @@ ast_free(p->a_crypto); } - if (snprintf(crypto_buf, sizeof(crypto_buf), "a=crypto:1 AES_CM_128_HMAC_SHA1_%i inline:%s\r\n", - taglen, p->local_key64) < 1) { + if (snprintf(crypto_buf, sizeof(crypto_buf), "a=crypto:%s AES_CM_128_HMAC_SHA1_%i inline:%s\r\n", + p->tag ? p->tag : "0", taglen, p->local_key64) < 1) { return -1; } Index: res/pjproject/pjnath/src/pjnath/stun_auth.c =================================================================== --- res/pjproject/pjnath/src/pjnath/stun_auth.c (revision 376139) +++ res/pjproject/pjnath/src/pjnath/stun_auth.c (working copy) @@ -256,6 +256,22 @@ p_info->realm = cred->data.static_cred.realm; p_info->nonce = cred->data.static_cred.nonce; } else if (cred->type == PJ_STUN_AUTH_CRED_DYNAMIC) { + // FIXME: bug in chrome: ICE gathering stops when we start receiving success responses before the end of the process + // -> send auth failure until we get SDP response from chrome + pj_str_t tx_realm = {0}, tx_username = {0}, tx_nonce = {0}, tx_password = {0}; + pj_stun_passwd_type data_type = PJ_STUN_PASSWD_PLAIN; + status = cred->data.dyn_cred.get_cred(msg, cred->data.dyn_cred.user_data, + pool, + &tx_realm, + &tx_username, + &tx_nonce, + &data_type, &tx_password); + if (status != PJ_SUCCESS) + return status; + if(!tx_username.slen && !tx_password.slen){ + err_code = PJ_STUN_SC_UNAUTHORIZED; + goto on_auth_failed; + } status = cred->data.dyn_cred.get_auth(cred->data.dyn_cred.user_data, pool, &p_info->realm, &p_info->nonce);