--- channels/chan_iax2.c.orig 2011-01-04 16:53:27.000000000 -0500 +++ channels/chan_iax2.c 2011-02-21 00:08:57.000000000 -0500 @@ -4555,7 +4555,7 @@ return -1; } ast_sockaddr_to_sin(&sin_tmp, sin); - sin->sin_port = htons(IAX_DEFAULT_PORTNO); + if (sin->sin_port == 0) sin->sin_port = htons(IAX_DEFAULT_PORTNO); /* use global iax prefs for unknown peer/user */ /* But move the calling channel's native codec to the top of the preference list */ memcpy(&ourprefs, &prefs, sizeof(ourprefs));