I’m trying to setup rtcp for asterisk, but I can’t get it to add the rtcp attribute in the sdp.
I can see Asterisk is trying to just send the rtcp reports using rtp port +1, but because it never added the rtcp option in the sdp, the remote does not accept it.
Is there any way to get asterisk to add the rtcp attribute in the SDP?
As understand from the RFC the rtcp port MAY be algorithmically deduced from rtp port +1 (parity rule) or it MAY be specified as an attribute in the sdp.
Apparently the provider i’m using has decided to use last option (they are using Freeswitch) the missing rtcp attribute makes Freeswitch not listining on the rtcp port.
I have never come across a device that specifies RTCP ports in the SDP, so FreeSwitch is badly broken if it requires the peer to do so.
If it wants to receive SDP on a non-standard port, it is up to it to send the SDP attribute, not the peer.
It looks like we are talking about RFC 3605. Note that this says:
The RTCP attribute addresses a very specific problem, the
documentation of port numbers as they appear after address
translation by a port-mapping NAT. The RTCP attribute SHOULD NOT be
used for other applications.
The right solution for the Asterisk end in this case is to ensure that your RTP port number range is not remapped by your router. An ITSP really should not have NAT issues at their end, so should not be using the attribute. Any options that has should not constraints in certain cases certainly should not be a mandatory requirement .
I rather suspect that, although labelled as standards track, this is a dead end RFC, and the world has move to ICE for NAT traversal on SIP, although I don’t know how ICE deals with RTCP port mapping.
I’ve dug into the Freeswitch code and from what I can see, if the rtcp attribute is not in the sdp from remote party, rtcp is not enabled. It IS however still using the parity rule (rtp port +1) as you can see when assigning port.
So is there a way to get Asterisk to insert the rtcp attribute?
You would need to modify the source code and recompile. You would be violating a SHOULD NOT requirement in the RFC. I would guess it is simple code change.