Roger Anderson may not seem like a superhero. But to many, he has become one.

By day, Mr. Anderson is a consultant who works on phone systems, setting up phone lines for companies and the kind of networks that ask you to press 1 for this, 2 for that. He loves telephones. When he’s on vacation, he visits places like the Museum of Communications in Seattle, where he takes selfies next to old telephones wires. (His wife even made him a little hat embroidered with telephones.)

But by night, he wages battles against evil telemarketers, tweaking and honing a robot that can talk endlessly to telemarketers, wasting their time so they don’t have to waste yours.

It all started a few years ago, when a telemarketer called Mr. Anderson with a pitch, and rather than talk to the sales guy, he handed the phone to his young son. The telemarketer cursed at the little boy. Enough was enough.

Average people harassed by telemarketers do not have many options. They may try to block callers by painstakingly entering each number into their smartphone’s block list, signing up for VoIP phone services that offer spam call filters, or downloading apps like Truecaller. There is also a national Do Not Call Registry, but many calls still get through.