I’ve been dabbling with the IM an Expert tool for Microsoft Lync. I’ve made some mistakes as well as run into some “issues” and have had to figure them out. Here are some of the errors and how I fixed them.
If you send a /ping to the Bot, it is supposed to respond with “0. No Error”. I was getting no response at all. Looking at the Bot log file, I saw the following messages:
2012-04-11T10:29:43 0 RECEIVED_CALL sip:firstname.lastname@example.orgReceived call
2012-04-11T10:29:44 0 ADD_CONVERSATION sip:email@example.com Added new conversation to map: (sip=sip:firstname.lastname@example.org)
2012-04-11T10:29:45 0 ROUTE_QUESTION sip:email@example.com Received message at 4/11/2012 10:29:45 AM: /ping
2012-04-11T10:29:45 0 PROCESSING_MESSAGE sip:firstname.lastname@example.org queued for 0.00 secs /ping
2012-04-11T10:29:45 0 SERIOUS_EXCEPTION system System.ArgumentException: The user name and password must either both be null or both must be non-null._NL_ at System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials(String userName, String password, ContextOptions options)_NL_ at Microsoft.Lync.ImAnExpert.MessageProcessor.HasValidCredentials(String username)_NL_ at Microsoft.Lync.ImAnExpert.MessageProcessor.ProcessMessage()
The tip off to the fix is the bit in the last line about the username and password must either both be Null or both have a value. I looked through my imx.config file and at the very top in General Settings I had a value for “EmailUsername” but no value for “EmailPassword”. SO I just commented out the “EmailUsername” and now the /ping started working.
And by “started working” I mean it sent back an error via IM now instead of the anticipated “0. No Error”.WHen I ran the /ping command I now got the following message: “302 Searcher Error, no candidates returned”. Looking through the most recent Bot log file, I saw the following:
2012-04-11T10:50:48 0 RECEIVED_CALL sip:email@example.com Received call
2012-04-11T10:50:49 0 REPLACE_CONVERSATION sip:firstname.lastname@example.org Replacing old conversation: (was sip=sip:email@example.com. Now is sip=sip:firstname.lastname@example.org)
2012-04-11T10:50:49 0 ROUTE_QUESTION sip:email@example.com Received message at 4/11/2012 10:50:49 AM: /ping
2012-04-11T10:50:49 0 PROCESSING_MESSAGE sip:firstname.lastname@example.org queued for 0.07 secs /ping
2012-04-11T10:50:49 0 ANSWERER_ALLOWED DISTRESSLERflinchböt allowed
2012-04-11T10:50:49 0 CANDIDATE_ADD_LEAST_QUESTIONS DISTRESSLERflinchböt add answerer with least answers
2012-04-11T10:50:49 0 ANSWERER_ALLOWED DISTRESSLERdsnaden allowed
2012-04-11T10:50:49 0 CANDIDATE_ADD_LEAST_QUESTIONS DISTRESSLERdsnaden add answerer with least answers
2012-04-11T10:50:49 0 ANSWERER_ALLOWED DISTRESSLERAdministrator allowed
2012-04-11T10:50:49 0 ANSWERER_NOT_SELECTED DISTRESSLERAdministrator Not selecting random user because: user disabled random questions
2012-04-11T10:50:49 0 ANSWERER_ALLOWED DISTRESSLERnkoconno allowed
2012-04-11T10:50:49 0 ANSWERER_NOT_SELECTED DISTRESSLERnkoconno Not selecting random user because: user disabled random questions
2012-04-11T10:50:49 0 QUERY_STATUS system Waited .5 seconds
2012-04-11T10:50:49 0 ANSWERER_UNAVAILABLE DISTRESSLERflinchböt not available (status=Offline)
2012-04-11T10:50:49 0 ANSWERER_UNAVAILABLE DISTRESSLERdsnaden not available (status=Offline)
2012-04-11T10:50:49 0 CANDIDATE_LIST RetrieveListOfCandidates available: 0 / 2 (0.00%) were available (4/11/2012 10:50:49 AM)
2012-04-11T10:50:49 0 WARNING RetrieveListOfCandidates Only asking 0 people who were online
2012-04-11T10:50:49 0 SENDING_MESSAGE sip:email@example.com Sending message: ‘302 Searcher Error, no candidates returned’ with contentType=text/html
2012-04-11T10:50:49 0 SEND_COMPLETE sip:firstname.lastname@example.org (0.1699284 s) 302 Searcher Error, no candidates returned
In short, this 302 error means that there are no available Experts in the environment. This makes sense in that this is a total lab environment and my client PC’s were turned off so my test Experts were all unavailable. Once I got a test user fired up, I finally saw the goodness:
My website was running great. Then it suddenly quit working. What the? I didn’t change anything in IIS! I did some IISresets, I verified the security/ACL’s. Same problem. Looking in the IIS logs, I was receiving the wildly unhelpful 500 error which just means “there is some error and we have no idea what it is. Good luck!”.
So I thought back to any changes I may have made and one did spring to mind. Access to the admin.aspx webpage is controleld via the imx.config file and the “WebsiteAdminUsernames” key. I had added my test user account “distresslerflinchböt” as one of the admins. Guess what? the config file doesn’t support non-English characters. As soon as I removed that user everything worked great.
The world may be flat, but we aren’t all using the English character set. Yet.
Typos are killer.
So you send a user over to the IM an Expert website to set up their profile. The home page loads just fine but when they click to set up their profile, they get this fabulous error:
Uh…that’s bogus! That email address totally exists! You’re dumb!
What happens here is that IM an Expert caches AD information for users – and it sure loves to use the cache instead of going out and seeing if the cache is wrong. So if you’ve made some changes to the user object*, you’ll need to delete the user from the cache. The brash way is to go to the Admin.aspx page and delete the entire cache. But if you are the type of person who prefers a chisel to a sledgehammer, then you can delete the specific user out of the SQL database with this command:
Delete FROM [IM-an-Expert].[dbo].[usercache]where username='domainusername‘
As soon as I ran that, my user was able to get to the profile screen and set up his profile.
*I have no idea what these changes are. This was a new user and I did fiddle with a lot of the account settings including setting up an Exchange mailbox. I didn’t have this issue with any of my other test users. I will say that when I first tried to set up the profile, I had NOT set up an Exchange mailbox yet. This may be completely wrong, but I get the impression that in order to use IM an Expert, your Experts must be Exchange-enabled.
I tried following the instructions in the documentation on how to set up my Bot as a service. The instructions point you to using the installutil.exe tool that ships with the .Net framework. I could never get the service to start using this method.
This worked for me.