iPhone constantly outputting audio via universal connector
Take a look at this Apple Support article. Not exactly your problem, but similar.

Basically, it says that it there's nothing clogging the audio-related components. If there is, it suggests cleaning them and tells you how:


  If the speaker, microphone mesh, or
  top microphone (iPhone 4 only) appear
  clogged, please use a clean, small,
  dry, soft-bristled brush to clean
  them. To do this follow these
  instructions: Use the brush to
  carefully and gently brush the speaker
  and microphone mesh. Brush away from
  the 30-pin dock connector to avoid
  getting any debris into the dock
  connector.


And, if that doesn't work, Apple suggests that you get it serviced.