How they did it I'm unsure, but it appears to be that he changes the phone line over to use the android lines. We know that the androids are operating what essentially boils down to a parallel and hidden community to the humans. This can be seen when Garland explains it to Deckard. Deckard had already started to work it out before this of course but it is made explicit here.
"When I phoned my apartment," Rick said, "why didn't I get my wife?"
"All our vidphone lines here are trapped. They recirculate the call to other offices within the building. This is a homeostatic enterprise we're operating here, Deckard. We're a closed loop, cut off from the rest of San Francisco. We know about them but they don't know about us. Sometimes an isolated person such as yourself wanders in here or, as in your case, is brought here — for our protection."
Do Androids Dream of Electric Sheep?, Chapter 11
It would appear that whatever Crams did to the phone when he initially touches it then blocks it from working later on. As we see Deckard can no longer ring out but Crams can easily.
Taking the receiver from the harness bull Rick said, "Mr. Bryant?" He listened, waited;
nothing. "I'll dial again." He hung up, waited, then redialed the familiar number. The phone
rang, but no one answered it; the phone rang on and on.
"Let me try," Officer Crams said, taking the receiver away from Rick. "You must have
misdialed." He dialed. "The number is 842 — "
"I know the number," Rick said.
"Officer Crams calling in," the harness bull said into the Phone receiver. "Is there an
Inspector Bryant connected with the department?" A short pause. "Well, what about a bounty hunter named Rick Deckard?" Again a pause. "You're sure? Could he have recently — oh, I see; okay, thanks. No, I have it under control." Officer Crams rang off, turned toward Rick.
Do Androids Dream of Electric Sheep?, Chapter 9
Note that we also never hear the end of the number Crams rings so it is entirely possible it starts the same but is different.
As far as I'm aware there is no explicit mention of how Crams manages to do what he did to the phone line only that he somehow changes it over to use the android one.
As @Shadow Wizard mentions in the comments we know that Roy Baty took some electronic equipment from the ship which he uses to rig up an alarm system and a two way bug. It's possible that Crams could have used some of this equipment to hack into the phone lines and activate it when he wanted to later on but nothing is made explicit.
I've got some electronic components in my car, junk I ripped off the ship. I'll install a two-way bug so Pris you can hear us and we can hear you, and I'll rig up an alarm system that any of the four of us can set off.
Do Androids Dream of Electric Sheep?, Chapter 14
However, we know Luba managed to ring through to the android police station too so it's possible that the device to hack the phone line is on their persons.