Open LarryHemenway opened 4 years ago
Looking at the code, I believe these values need to be updated too:
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin,
const char *password, const
char *rpassword, ice_proto_t proto,
switch_core_media_ice_type_t
type, ice_t *ice_params)
{
char ice_user[80]; // make 513?
char user_ice[80]; // make 513?
char luser_ice[80]; // make 256?
ice_user & user_ice both appear to have the full "ufrag:ufrag" , but luser_ice appears to have only up the to ":" of user_ice:
ice_user +k8f:fGyeQ8r1tdGIkDLN, user_ice fGyeQ8r1tdGIkDLN:+k8f, luser_ice fGyeQ8r1tdGIkDLN+k8f
feel free to toss us a pull request. stun trace in sofia has nothing to do with stun/ice in the media stack so that’s why that setting has no effect.
FreeSWITCH Version 1.10.2-release.4~64bit (-release.4 64bit)
When sending in a STUN username of greater than 34 bytes, the STUN Binding request is ignored because it truncates the username.
The problem is in switch_rtp.c handle_ice() function:
For example, my STUN Binding request is
but it gets truncated to
The function 'icecmp' compares the truncated value stored in username above to the full username stored in ice->user_ice and returns failure. The request is then ignored.
I looked at a RFC5389 STUN and found the following
The easiest solution would be to increase the username to conform to RFC5389 and make it 513 bytes. After doing that, the buf that contains the copied data would also need to increase. I have less analysis on this, but I think it makes sense to bump it up to a typical MTU of 1500. Combined, the updates would be
Other Potential Issue
Stun trace does not appear to work from the CLI, or at least not in the way I would expect: sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]
When I type:
I get the following:
Background:
We noticed this when using a test tool that uses GStreamer webrtc. Our tool is responding to BIND requests and sending good responses back, but its BIND requests are ignored by FreeSWITCH. After making a private build of FreeSWITCH with the updates above, everything works.
Other notes
The username appears to use the ufrag values for the SDP offer & answer with format "ufrag:ufrag". Looking at the draft-ietf-rtcweb-jsep-26 it indicates that handling ufrag should conform to draft-ietf-mmusic-ice-sip-sdp-24
So, in theory, if FreeSWITCH conforms to never make a ufrag value of length > 32 bytes, we could make the username something like:
where