2015-03-11 18 views
5

मैं एक WebRTC एप्लिकेशन है, और दो ग्राहकों (client1 और client2) मान लीजिए, वहाँ किसी भी तरह से पता लगाने के लिए क्या बर्फ उम्मीदवार client1 द्वारा दिए गए और इसके विपरीत client2 द्वारा प्रयोग किया जाता है? क्योंकि, हर बार यह पता लगाने के लिए, मैं दोनों ग्राहकों पर wireshark उपयोग करने के लिए है, मैं पढ़ने sdp मदद कर सकता है सोचा था, लेकिन मैं गलत था, के रूप में यह सब संभव उम्मीदवारों देता है ...WebRTC: निर्धारित करें कि चुने हुए बर्फ उम्मीदवार

परिदृश्य: सभी client1 की UDP बंदरगाहों ब्लॉक किए गए हैं (परीक्षण के लिए अवरुद्ध मेरी मुझे)।
Client1 के एसडीपी:

... 
a=rtcp:49407 IN IP4 <client1's IP> 
a=candidate:3864409487 1 udp 2122194687 <client1's IP> 49407 typ host generation 0 // this would never work, since the udp ports are blocked... 
a=candidate:3864409487 2 udp 2122194687 <client1's IP> 49407 typ host generation 0 
a=candidate:2832583039 1 tcp 1518214911 <client1's IP> 0 typ host tcptype active generation 0 
a=candidate:2832583039 2 tcp 1518214911 <client1's IP> 0 typ host tcptype active generation 0 
a=candidate:973648460 1 udp 25042687 <TURN server IP> 64790 typ relay raddr <Proxy IP> rport 39963 generation 0 
a=ice-ufrag:YSvrOiav8TglpCWD 
... 
+3

चेक बाहर इस सूत्र: https://groups.google.com/d/msg/discuss-webrtc/-VReEXf9RBM/h91i7CD-oJ8 जम्मू –

उत्तर

3

खैर,,, एक और सवाल

मैंने लिखा करने के लिए अपने answer से लिया और कोड के नीचे टुकड़ा परीक्षण किया दोनों फ़ायरफ़ॉक्स और क्रोम की में नवीनतम संस्करण में काम करता है getConnectionDetails रिटर्न एक वादा जो कनेक्शन विवरण के लिए हल करता है:

function getConnectionDetails(peerConnection){ 


    var connectionDetails = {}; // the final result object. 

    if(window.chrome){ // checking if chrome 

    var reqFields = [ 'googLocalAddress', 
         'googLocalCandidateType', 
         'googRemoteAddress', 
         'googRemoteCandidateType' 
        ]; 
    return new Promise(function(resolve, reject){ 
     peerConnection.getStats(function(stats){ 
     var filtered = stats.result().filter(function(e){return e.id.indexOf('Conn-audio')==0 && e.stat('googActiveConnection')=='true'})[0]; 
     if(!filtered) return reject('Something is wrong...'); 
     reqFields.forEach(function(e){connectionDetails[e.replace('goog', '')] = filtered.stat(e)}); 
     resolve(connectionDetails); 
     }); 
    }); 

    }else{ // assuming it is firefox 
    return peerConnection.getStats(null).then(function(stats){ 
     var selectedCandidatePair = stats[Object.keys(stats).filter(function(key){return stats[key].selected})[0]] 
      , localICE = stats[selectedCandidatePair.localCandidateId] 
      , remoteICE = stats[selectedCandidatePair.remoteCandidateId]; 
     connectionDetails.LocalAddress = [localICE.ipAddress, localICE.portNumber].join(':'); 
     connectionDetails.RemoteAddress = [remoteICE.ipAddress, remoteICE.portNumber].join(':'); 
     connectionDetails.LocalCandidateType = localICE.candidateType; 
     connectionDetails.RemoteCandidateType = remoteICE.candidateType; 
     return connectionDetails; 
    }); 

    } 
} 


//usage example: 
getConnectionDetails(pc).then(console.log.bind(console)); 
+0

मैं '' 'googLocalCandidateType''' के लिए' '' googRemoteCandidateType''' और '' 'relay''' के लिए' '' prflx''' मिला है। क्या आप जानते हैं कि '' prflx''' का अर्थ क्या है ?? –

+0

है @anand जाँच करने के लिए है, लेकिन मुझे लगता है कि अचेत बर्फ उम्मीदवार – mido

संबंधित मुद्दे