[libnice] Issue in using TURN functionality

Anand Sivaram aspnair at gmail.com
Thu May 19 13:24:44 UTC 2016

I found out the problem why the connectivity is failing.  The timing of
exchanging the ICE candidates is very important.  As I was manually copy
pasting the generated ICE ufrag/password/relay candidates between the two
shells one after another, it was getting timed out.  But, if the candidates
are copy/pasted on the two shells pretty fast, the connection is getting
through and the data is getting relayed through the TURN server.

But, I have two questions about that..

1) I did not see any timeout happening when the host/srflx candidates get
selected, but only for relay candidates.  Is it correct?
2) Is there any way to configure the timeout before declaring the
stream/component as failed?  Is there any settings for that?


On 17 May 2016 at 16:31, Anand Sivaram <aspnair at gmail.com> wrote:

> Hello All,
> In order to verify the TURN functionality, I modified the simple-example
> code as given below.  I setup coturn in one of the AWS servers with a
> username and password.
> 1. Just before calling nice_agent_gather_candidates(), included the
> following code.
> nice_agent_set_relay_info(agent, stream_id, 1, turn_addr, turn_port,
> With this change, I could see relay along with host and srflx candidates
> in the list of gathered candidates, but still it was using host/srflx.
> 2. In order to force using relay, I made the following change in
> print_local_data() to print only the relay candidates.
> for (item = cands; item; item = item->next) {
>   NiceCandidate *c = (NiceCandidate *)item->data;
>   if((c->type == NICE_CANDIDATE_TYPE_HOST) || (c->type ==
>       continue;  //do not print these candidates
>   }
> Then, I copy pasted the generated data between the two simple-example
> instances as I did previously.
> But, this time I am getting the following message as the connectivity
> check failed.
> SIGNAL: state changed stream 1 comp 1 connecting[2]
> SIGNAL: state changed stream 1 comp 1 failed[5]
> I captured all messages using wireshark.  Interestingly both Allocation
> Success Response and CreatePermission Success Response are coming back from
> the TURN server.  Also, libnice is sending a few Send Indication to the
> relay address of the other party.  But, after this libnice is sending a
> Refresh Request with a lifetime = 0 and the communication with TURN server
> is closed down.
> Any idea how to proceed?
> Thanks and Regards
> Anand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/nice/attachments/20160519/20a272fd/attachment.html>

More information about the nice mailing list