Bluetooth headset playing low quality on ubuntu 18

Install all dependencies with:

sudo apt install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth

Then add the following lines to the file /etc/bluetooth/audio.conf

   [General]
   Enable=Source,Sink,Media,Socket

Now restart the bluetooth device:

sudo service bluetooth restart

Now you should be using the a2dp high quality instead hsp/hfp (low quality)