Later on spam filtering relied on analyzing email text, but before that was available there was the blunt instrument of blackholing ISPs that refused to police their users.
I remember Bayesian spam filters being the first widely used ones. But it was a long time ago.
It’s not clear to me that carriers would be allowed to do that, especially accounting for situations where VoIP traffic is laundered through a legitimate service (so the entity at the exchange boundary with the end-user carrier is a legitimate one).
Could they get around common carrier restrictions by offering that service as opt in? I’m not so sure about that either.
That approach could work here.