I would NOT say it is connected to your digestion. If you cough it up it seems to be linked to mucus. It can be an allergic reaction so your body produces a sort of secretion which seems to come from somewhere in the throat, but in fact there´s where it comes through, I guess.
Have you ever checked if you are allergic to things such as: dog/cat fur, wool, etc? These and others can cause a smelly mucus.
I would dare say it is nothing conneceted to BILE.
Again, check a if your doctors can test your skin to see what you are allergic to.