From a45b6fbd73ab227baa95d23f2c032a2905115e3f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 25 Jul 2012 15:32:51 +0200 Subject: [PATCH] Add raddr and rport values in ICE candidate attributes in the SDP. --- coreapi/sal_eXosip2_sdp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c index a85b5ef5a..8c9279aa1 100644 --- a/coreapi/sal_eXosip2_sdp.c +++ b/coreapi/sal_eXosip2_sdp.c @@ -227,9 +227,21 @@ static void add_payload(sdp_message_t *msg, int line, const PayloadType *pt, boo static void add_candidate_attribute(sdp_message_t *msg, int lineno, const IceCandidate *candidate) { char buffer[1024]; + int nb; - snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", + nb = snprintf(buffer, sizeof(buffer), "%s %d UDP %d %s %d typ %s", candidate->foundation, candidate->componentID, candidate->priority, candidate->taddr.ip, candidate->taddr.port, ice_candidate_type(candidate)); + if (nb < 0) { + ms_error("Cannot add ICE candidate attribute!"); + return; + } + if (candidate->type != ICT_HostCandidate) { + nb = snprintf(buffer + nb, sizeof(buffer) - nb, " raddr %s rport %d", candidate->base->taddr.ip, candidate->base->taddr.port); + if (nb < 0) { + ms_error("Cannot add ICE candidate attribute!"); + return; + } + } sdp_message_a_attribute_add(msg, lineno, osip_strdup("candidate"), osip_strdup(buffer)); }