NewMav
I once had an allergic phlegm reaction perhaps 20 years ago after consuming a cheap chocolate easter egg and an avocado after work. I felt a bit tired light headed soon after so I went to take a rest on the couch, but I started having massive white fleghm come out of my nose and clogging my throught, I could not rest, and it was coming out like I was a dripping fountain.
My gut instinct reaction was to make myself a strong coffee, espresso, I had a slight fear that it would make it worse, but magically it stopped the outpouring of the phlegm like magic. My after thoughts were that It may have been an asthmatic reaction and the caffeine worked to end it. It all happened/ lasted perhaps less than an hours time.
I don't know if your circumstances are simular, but if its been happening for hours it may not be same as happened to me, so your reasons/ solution may be different.