p2p call through stun server

21 views
Skip to first unread message

Peter Arnold

unread,
Jun 17, 2022, 8:23:13 AM (8 days ago) Jun 17
to discuss-webrtc
Hi everyone! I want to make a simple point to point call , with default webrtc peer_connection_client, I have a call and it worked. Both of clients and server were in the same network, so there was no NAT in there. In PeerConnectionClient Source I have a method, called after making connection with local server , see below : 

bool Conductor::CreatePeerConnection() { 
RTC_DCHECK(peer_connection_factory_);
RTC_DCHECK(!peer_connection_);
webrtc::PeerConnectionInterface::RTCConfiguration config; config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan; 
webrtc::PeerConnectionInterface::IceServer server; 
server.uri = GetPeerConnectionString(); 
config.servers.push_back(server);
peer_connection_ = peer_connection_factory_->CreatePeerConnection( config, nullptr, nullptr, this); return peer_connection_ != nullptr; 
}

std::string GetPeerConnectionString() { 
return GetEnvVarOrDefault("WEBRTC_CONNECT", "stun:stun.l.google.com:19302"); 
}

In code upper, was added stun server address, to ICE candidate, after this initialization call has come.

I want to make a call point to point through NAT with stun, I can't find any examples, I found only stun_prober, and stun_server, stun_prober worked, but there was no logick about call, stun_sever doesn't work, but maybe I used it in incorrect way.

Please show me some example or pls help with some code parts for making c++ p2p video call through stun server.  
Reply all
Reply to author
Forward
0 new messages