Find channel from extension

Hi,
I’m using a socket to check extension status, that works fine.
However, I’d like to know who’s calling in Ringing status.
The PBX uses SIP peers.

Which are the ways to “link” extensions and callerID?
Do I necessarily have to know channel name?

Regards,

Arbitrarily large numbers of channels can be executing an extension. I think you have a terminology problem.

Caller ID is a property of a call, not a device,

The easiest way of attaching caller ID to some finite set of entities is probably to define global variables, or astdb entries, for them, and then have the dialplan save the callerID or channel name into those variables/database entries.