TAPI or JTAPI allow you to monitor phones and get data about the call before the phone even starts ringing.. so you can start a number -> name lookup at this point and push the result to the phone using one of the XML elements defined in the IP Phone Service SDK (an IPPhoneText is the most convenient).
So it comes down to your programming language preference.. if it's C, you'll go for TAPI, if it's Java, you'll go for JTAPI.