The only way i can think of that will give you a full list of used extensions that you can use to determine the available extension numbers is through the DN table included in the support files.
Alternatively you can use the call control API to retrieve the used extension numbers and provide you with a list of available extension numbers.