Talking on the phone, I heard the doorbell ring.
The doorbell rang while I was talking on the phone.
Both of these sentences are correct and do not use dangling modifiers. In the first one, "I" is the correct descriptor of the person talking on the phone, so it makes sense. The second sentence is even clearer.