David Staudt | Many factors can influence the system's dial-plan, and various features like configured directory numbers, direct inward dial numbers, internal/external phone number masks, etc. can have complex/flexible effects to how a user's 'phone number' might be calculated/presented in various contexts. For an example an 'area code' (along with 10 digit dialing, a concept significant only within the North American numbering plan - among multiple supported by UCM), could be assigned to a dialed number at the line appearance, translation pattern, route pattern, gateway, dynamically via an application, etc. To definitively parse all of the relevant UCM config options to calculate a presented phone number (for all contexts, e.g. internal, external, varied by service provider, etc.) might be pretty involved. That being said, if you just want to get at the number that is populated in the user directory, you can do something like: select userid,firstname,lastname,telephonenumber from enduser But note that this value is optional, is populated either manually by the admin or by some kind of external tool or sync operation (e.g. LDAP sync) and may not exist or may not reflect the 'actual' dialable number configured in the UCM dial plan. Also you will almost certainly want to take care in executing this request on a live system with a large number of users: be aware of AXL data throttling limits, consider using SQL skip/first commands to retrieve limited chunks of data, and test the performance impact of your query against UCM databases of various size, on systems under load. |