It is caused by anxiety and panic at being short of breath and not knowing, (if at all!), the pflegm is going to loosen and enable itself to be coughed-up. When this happens a single Ativan (also known as Lorazepam) helps to calm the anxiety and panic, and sooner or later the mucus will allow itself to be coughed-up. For this purpose I can strongly recommend the use of water soluble NAC600 tabs, which you can buy OTC and are relatively fair price wise. They also work extremely quickly!
Hope to have helped!
Derek Hardy.