We have an exchange server that hosts a "Shared Contacts" public folder, which serves as our company-wide directory of clients and contacts. I wanted to be able to access the directory from our Aastra 57i phones, and I wanted Asterisk to use the Shared Contacts folder for Caller ID lookups. I got everything working quite nicely in our environment, so I'm posting it here in case anyone else finds it useful or instructive. Feedback is welcome, but I don't have a lot free time for support and can't take any further feature requests. Consider this as-is, no warranty express or implied.
Important Notes:
This requires Exchange 2007 Service Pack 1 or later. Your Exchange server must have Exchange Web Services (EWS) enabled (which it is by default on SBS 2008, I believe). A working SSL certificate on your exchange server is probably also required.
I forget how I implemented it, but I think that it will only work out-of-the-box if you have only one Contacts folder within your public folders (and it must be in the root of your public folders). If you have a different setup, your results may vary - just modify the code as needed.
Only US/Canada phone numbers will be listed/recognized. You could easily adapt the code to support other countries, though.
To use it:
0. Download it: http://www.bradenm.com/misc/exchange_link.zip
1. Unzip within the /var/www/html/ folder of your asterisk server. This will install it to /var/www/html/exchange_link/
2. Be sure to chown asterisk:asterisk /var/www/html/exchange_link/ as the directory must be writeable by PHP
3. Edit /var/www/html/exchange_link/config.php - self explanatory
4. Edit the last line of /var/www/html/exchange_link/services.wsdl to reflect the proper EWS URL for your exchange server (change 'remote.yourcompany.com'); hackish but necessary
5. Add the following softkey to your phone's profile or web config (change 4 to a free softkey slot):
softkey4 type:xml softkey4 label:Contacts softkey4 value:http://$$AA_XML_SERVER_AA$$/exchange_link/contacts.php softkey4 states:idle
6. Save changes and/or log in and log out of your phones and try the new softkey. If you set the automatic updates setting to false, you will have to use the 'update' menu option from within this script's main menu before first use.
7. (Optional) To integrate Caller ID lookup from the same source, go to "CallerID Lookup Sources" in FreePBX, and add a new HTTP source with host 'localhost', path '/exchange_link/cname.php' and query 'p=[NUMBER]'. Leave the other fields blank. Then, click on "Inbound Routes", and set the new source as your 'CID Lookup Source' for any inbound routes you have.

Member Since:
2009-11-18