I remember reading somewhere on arfcom that the only acceptable methods the ATF would accept were welding or silver soldering. Someone made the point that there were a couple other ways, but basically it has to be in a way that would require destruction of the barrel or the flash hider (or both) in order to remove it for it to be considered permanent.
Someone, I think in the build it yourself forum, posted a DIY Silver Solder method. It required a torch and getting your barrel cherry hot at the tip so be careful if you try it, or something like it. Honestly, you would be better off either buying a barrel in the configuration you want or having a professional do it. Just think of how bad you could ruin your barrel by just tapping it while the barrel is cherry hot. Or cracking the linning of the barrel. Cracking the barrel itself if you heat and cool to quick.
Just be careful.