Crackling static on an analog phone line is caused when you have a bad connection or a short to foreign voltage/ground.
Back in the day the source of this issue was often caused by an open telephone wire running between insulators on telephone poles. When there was a strong wind, wires from other phone lines would touch and cause that annoying static sound. It could also come when power lines would cross with telephone wires.
Another source of crackling static is ‘data noise’. This comes from nearby computer equipment static. If you have too much equipment nearby, this might be the cause of the static. A common culprit that is often overlooked is your cell phone.
The key is to determine whether data noise is your problem or a bad connection. If the problem is at the Demarc with the wiring inside your phone, you can replace the cable. If it is with the cables running from the phone lines outside, alert your phone company so that they address the problem.