[libnice] Issue in using TURN functionality

Anand Sivaram aspnair at gmail.com
Tue May 17 11:01:40 UTC 2016

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
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/nice/attachments/20160517/5b046194/attachment.html>

More information about the nice mailing list