Phone line to 3.5mm audio line
If you intend to use the mic input mic input to your sound card, it will have a current source or pullup resistor to supply a bias to the microphone to which it was intended.

It might not be good for the speaker to have DC flowing through it.

If your phone is connected to the telco, be very careful.  The speaker may run at quite a CM voltage and the DC offset might be -48V (depending which way round it is wired).

Telephones wires are very good at attracting lightning.  During a storm high common mode voltages may be on the earpiece.

Stricly speaking you should use an audio transformer to couple the earpiece signal into the sound card, this provides DC isolation and some protection against lightning.  Adding a TVS across the output of that transformer would be a good idea too.

The ac signal on the earpiece might be quite small.  Only a few hundred mV. For a mic input, this will be fine (and can be potted down at the output of your transformer)  but for line levels, which are usually 1Vrms it might be very quiet.

Not all phones work the same way, so measure the voltage first using a scope and judge the divsor as required.

The audio transformer should also be protected against DC usign a DC blocking (aka coupling) capacitor.

This circuit protects against discharge and DC currents, though use with caution as a mistake will cost you a PC!