Hi, We have an application using PJ media over ICE (STUN, no TURN) and it works fine if we allocate a single fixed RTP port (no port_range) but when we try and enable RTCP some odd things are seen. We do not use pjsua_media but instead call pjnath directly, e.g. pjmedia_ice_create3. Initially we tried setting the pj_ice_strans_cfg.stun.cfg with a bound_addr containing port 17000 and zero port_range. We have also increased the comp_cnt = 2 when calling pjmedia_ice_create3 to enable the RTCP component. This results in an "Address already in use" when the RTCP component is trying to be created. It looks like pjnath uses the same fixed port when creating a socket for each component that uses the STUN requests. So we increased the port_range in the stun.cfg to get around this problem but this produces the following outbound INVITE SDP which has mismatched RTP/RTCP ports, e.g. o=- 1431981810 1431981810 IN IP4 192.168.32.144 c=IN IP4 192.168.32.144 t=0 0 m=audio *17000 *RTP/AVP 100 a=rtcp:*17001 *IN IP4 192.168.32.144 a=ice-ufrag:3855585c a=ice-pwd:70a64e2a a=candidate:Hc0a82090 *1 *UDP 2130706431 192.168.32.144 *17001 *typ host a=candidate:Hc0a83865 *1 *UDP 2130706431 192.168.56.101 *17001 *typ host a=candidate:Hc0a82090 *2 *UDP 2130706430 192.168.32.144 *17000 *typ host a=candidate:Hc0a83865 *2 *UDP 2130706430 192.168.56.101 *17000 *typ host You can see that this INVITE has an incorrect Candidate Compenent IDs (1 = RTP, 2 = RTCP) and we intended the RTP port to be 17000 but this has been filled out as ID=2 instead. It gets worse though as when the port_range is 1, sometimes we still get the same "Address is in use" error. It looks like the port selection is random within the range specified but only attempts the same number as the port range which for small ranges will result in the address sometimes being already in use. Even when we set the bound_addr port to 0 and the port_range to 0, this results in the same mismatch between the candidate ports and the media and attributes for RTP/RTCP ports. To work around this, we've has to modify the pjnath ice_strans function create_comp() so if the bound_addr port != 0 and the port_range = 0 then the bound_addr port is incremented based upon the component number that is passed in. This results in the candidate ports matching SDP m=audio and a=rtcp entries. pjsua_media uses a large port_range and supports the option of a base port, but I have not verified whether this also fills out the SDP incorrectly. I'm wondering if there is something wrong with our use of the pjnath and SDP encode that is not as intended or whether we've just come across a scenario where we want fixed ports for both RTP and RTCP that no-one else uses, presumably not as this is a fairly standard RTP/RTCP setup over STUN? Thanks, Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20150520/772a17d8/attachment.html>