Level measurement in foaming media