I use LD 20 to find out how many digital ports are unused:
req: LUVU
type: 2000 (this will show digital ports not programmed).
If you wanted to see how many analog ports available, you would use:
req: LUU
type: 500 (RETURN)
Lastly, after finding out what IS in use, you can enable all disabled sets and then do an IDU in LD 20
example:
req: IDU 72 0 0 1 (RETURN)
M3900 TN 72 0 0 1
NT CODE: NTMN03EA
COLOR CODE: 70
RLS CODE: 02
SER NUM: 0403CX
This is a lot like pinging a computer to see if the other side is there and alive. The above can only be accomplished for enabled digital sets, and not analog, but if there is a phone at the far end, you will get information as printed above.