They need to ban the software and equipment that let's them make the calls.
Then there's multiple use. There's no/minimal difference between a script doing automated support callbacks and spam calls. You take a list of numbers, dial and connect the other end, handle hangups, do some reporting on connection success/failure. The completely isolated "other end" is either a person or an automated message or a combination of both.
There's really no reason to deal with any code here specifically, rather than just making the result illegal and enforcing that.