[Nice] Need help to debug gathering turn server relay

ly tran congly85 at yahoo.com
Mon Oct 22 01:56:42 PDT 2012


Hi,

My video call application using libnice and turn server for symmetric NAT traversal.
In some case, I can gather relay server for both video and audio like below sdp:

v=0
o=- 2184017736251815492 8580066925214433698 IN IP4 192.168.1.41
s=-
t=0 0
m=video 33993 RTP/AVP 98
c=IN IP4 192.168.1.41
a=rtpmap:98 theora/90000
a=candidate:1 1 UDP 2013266431 192.168.1.41 33993 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 39193 typ host
a=candidate:3 1 UDP 1677721855 210.245.54.74 60885 typ srflx
a=candidate:4 1 UDP 1006633215 83.150.122.225 55671 typ relay
a=ice-pwd:7SBrRWChu2A3z+hsKpNN0r
a=ice-ufrag:bdDn
a=rtcp:0
m=audio 38143 PCMU/AVP 0
c=IN IP4 192.168.1.41
a=rtpmap:0 PCMU/8000
a=candidate:1 1 UDP 2013266431 192.168.1.41 38143 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 48049 typ host
a=candidate:3 1 UDP 1677721855 210.245.54.74 61047 typ srflx
a=candidate:4 1 UDP 1006633215 83.150.122.225 62630 typ relay
a=ice-pwd:Pqc3Or66wkjS+wN6z73ww8
a=ice-ufrag:m9AG
a=rtcp:0

but in another time, I only gather relay server for audio or video or nothing:
v=0
o=- 8769129355780658083 7584008823329948515 IN IP4 192.168.1.41
s=-
t=0 0
m=video 52520 RTP/AVP 98
c=IN IP4 192.168.1.41
a=rtpmap:98 theora/90000
a=candidate:1 1 UDP 2013266431 192.168.1.41 52520 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 41380 typ host
a=candidate:3 1 UDP 1677721855 210.245.54.74 61557 typ srflx
a=candidate:4 1 UDP 1006633215 83.150.122.225 59608 typ relay
a=ice-pwd:fHBGxclzwZqz6fNl+PdAYI
a=ice-ufrag:0GRT
a=rtcp:0
m=audio 58936 PCMU/AVP 0
c=IN IP4 192.168.1.41
a=rtpmap:0 PCMU/8000
a=candidate:1 1 UDP 2013266431 192.168.1.41 58936 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 50804 typ host
a=ice-pwd:GmuIDz7o9IHVLxqhr52JeM
a=ice-ufrag:dX+Z
a=rtcp:0
=================================================================
v=0
o=- 4016385316294493094 2686950318062895343 IN IP4 192.168.1.41
s=-
t=0 0
m=video 46895 RTP/AVP 98
c=IN IP4 192.168.1.41
a=rtpmap:98 theora/90000
a=candidate:1 1 UDP 2013266431 192.168.1.41 46895 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 38023 typ host
a=ice-pwd:2EOBEvTTpL/e88j2ymvd6f
a=ice-ufrag:IIX4
a=rtcp:0
m=audio 57581 PCMU/AVP 0
c=IN IP4 192.168.1.41
a=rtpmap:0 PCMU/8000
a=candidate:1 1 UDP 2013266431 192.168.1.41 57581 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 48726 typ host
a=ice-pwd:WGag9CGVWa4UpCJ6Myeyto
a=ice-ufrag:LgYu
a=rtcp:0
==================================================================
v=0

o=- 8900533634173556908 2270264087450858543 IN IP4 192.168.1.41
s=-
t=0 0
m=video 47791 RTP/AVP 98
c=IN IP4 192.168.1.41
a=rtpmap:98 theora/90000
a=candidate:1 1 UDP 2013266431 192.168.1.41 47791 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 33952 typ host
a=ice-pwd:+jft1vZC9UNJg//cgrFzSn
a=ice-ufrag:fnyD
a=rtcp:0
m=audio 39922 PCMU/AVP 0
c=IN IP4 192.168.1.41
a=rtpmap:0 PCMU/8000
a=candidate:1 1 UDP 2013266431 192.168.1.41 39922 typ host
a=candidate:2 1 UDP 2013266431 192.168.2.14 58084 typ host
a=candidate:3 1 UDP 1677721855 210.245.54.74 63425 typ srflx
a=candidate:4 1 UDP 1006633215 83.150.122.225 55358 typ relay
a=ice-pwd:JqbJd1xHYFkkIK6U9B7BL3
a=ice-ufrag:G93f
a=rtcp:0

I'm using seperate turn server with 
## Max relay per username.
max_relay_per_username = 10

## Allocation lifetime.
allocation_lifetime = 360

And my source code :
self->v_stream_id=nice_agent_add_stream(self->v_agent,1);
nice_agent_set_relay_info(self->v_agent,self->v_stream_id,NICE_COMPONENT_TYPE_RTP,

NUMB_IP,NUMB_PORT,NUMB_USER,NUMB_PASS,NICE_RELAY_TYPE_TURN_UDP);
nice_agent_gather_candidates(self->v_agent,self->v_stream_id);
nice_agent_attach_recv(self->v_agent,self->v_stream_id,NICE_COMPONENT_TYPE_RTP,
g_main_context_default(),cb_nice_v_recv,
self);

self->a_stream_id=nice_agent_add_stream(self->a_agent,1);
nice_agent_set_relay_info(self->a_agent,self->a_stream_id,NICE_COMPONENT_TYPE_RTP,
NUMB_IP,NUMB_PORT,NUMB_USER,NUMB_PASS,NICE_RELAY_TYPE_TURN_UDP);
nice_agent_gather_candidates(self->a_agent,self->a_stream_id);

nice_agent_attach_recv(self->a_agent,self->a_stream_id,NICE_COMPONENT_TYPE_RTP,
g_main_context_default(),cb_nice_a_recv,
self);

After gathering done:
local_cands=nice_agent_get_local_candidates(self->v_agent,self->v_stream_id,c_id);
...
and
local_cands=nice_agent_get_local_candidates(self->a_agent,self->a_stream_id,c_id);
...

Can anyone help me to gather relay server all time ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20121022/6d2533d4/attachment-0001.html>


More information about the nice mailing list