I had somewhere rotary dialer from old phone, and first pulse should be longer than rest of them(I think that phone with IC do same thing when switched to pulse dialing).
First hook up phone to scope, you need 100R resistor 12V PSU and phone. So dial few number and get timing for first pulse and period for rest of them.
Logic would be wait for long pulse, than count impulses, with timeout period that is twice long as period that impulses are repeated. And reset timeout on each received pulse. Create something like SERIN works. It should be easy.
For measuring time you can use timer, or loop with pause 1 inside and count how many time loop are repeated, or timer with interrupt, and in ISR just increment some variable, etc...