You can do this, but it's not so simple. Two options:
1) Create a custom java class to read LDAP and return the info you require
2) Implement a middleware web server that you can call from UCCX, that would take ANI as a parameter and return the email address.
I've done 1) before, or something very similar...
Just watch out for what the failure mode is, if the query doesn't return. I've had something similar where the AD server didn't respond (due to patching) and the calls were then having large wait times before being placed into the CSQ.
AD resilience in general is a pain...
This discussion is pretty old now, but I'm forced to revisit it now as I have to get this working. I need to query AD to pull the email address of internal callers based on ANI. I've read Gergely's post and tried using some of the things in it to accomplish what I need but am not having any luck because I don't know what the heck I'm doing and this forum is the only resource I have available to ask for assistance. So, if anyone has any wisdom to share on how to query AD from script variables, and return query results back into a script variable, I'd very much appreciate it. Please note that I'm not a Java developer.
If you have Premium licensing it seems like you could do a SQL call to the domain controller and try and pull the email that way.
For compatibility sake may have to dump the AD data into a compatible SQL database first though and then query that DB.
That seems like the most down and dirty way to me without having to do anything with Java. The Java method seems like it would be the most fun though.
Thanks, Joshua. I don't mind doing Java, I just need some guidance. I think everything I'd need to do it exists in Gergely's example, but I don't know what chunks of it to pull out and use in my script, nor how to pass from a variable to the java code and then the results back to a variable.
Joe, would you mind posting the account details of a typical user in your AD structure? All I need to know is what fields contain the phone number and the email address. We'll have to use these fields in our LDAP query. I'll help you with the Java part.
You have no idea how much I would appreciate your help! I really did try and tailor what you had done in your document to my situation, but after trying for a day and a half I came to the realization that I simply don't have enough knowledge to customize or get it to work for what I need. So, the AD attributes where users ext and email address are populated are named telephoneNumber and mail.