Version 1/61 - Next ยป - Current version
Redmine Admin, 03/20/2009 10:08 am


= ICE negotiation through OpenSIPS/Mediaproxy =

Background

MediaProxy rewrites the SDP in order to present the destination UA with a reachable IP:port number for sending RTP/RTCP. To allow end-points to negotiate ICE, the SDP offer must contain a candidate correspondent to the the c= line of the SDP. The rewrite of the SDP causes the target end-point to replay with ice missmatch and the ICE negotiation fails in its tracks.

Requirements

To circumvent this mediaproxy should be able to

  • Create proper candidates
  • Append them to the offer/answer SDP
  • Allow an administrator to set a policy for the use of the relay candidate
  • Solve the accounting issues and BYE sending depending on use of ICE
Implementation

Add a setting to mediaproxy module

{{{
mediaproxy_ice_candidate=none|low|medium|high
}}}

{{{
if mediaproxy_ice_candidate != none and SDP offer contains ice-offer (has a=candidate line(s)) then
append to the SDP the following line:
a=candidate:ID 1 UDP PRIORITY MP_IP MP_PORT typ relay raddr UA_IP rport UA_PORT
}}}

where

  • ID = is the highest ID found in SDP + 1
  • PRIORITY = 2!^24 * POLICY + 2!^8 * 65535 + 2!^0 * 256 - ID
  • POLICY = 0 if mediaproxy_ice_candidate = low and POLICY = 126 if mediaproxy_ice_candidate = high

This process must be performed at the first INVITE for both offer and answer.

Once the ICE negotiation is completed a re-INVITE indicates this fact. The re-INVITE contains the selected candidate and a flag to mention that the ICE negotiation has been completed. The mediaproxy module should analyze the re-invite and figure out whether the relay IP:port has been chosen for the RTP media. If the anser is negative than MediaProxy should deallocate its port and cancel subsequent action related to accounting and dialog terminating purposes.