Issue with Vtiger 3CX Integration: Pick existing contacts

In the past (3CX v12.5) it was not so easy integrating 3CX with CRMs such as Vtiger, but with version 15.5 and it’s integration feature, it is now a lot easier to trigger actions in your ERP, CRM etc. whenever a call event happens inside of 3CX.

So, essentially, integrating Vtiger with 3CX was supposed to be easy but for some unknown reasons, I could not get 3CX to pull the customer’s contact whenever an agent received a call.

I had been passively trying (because I had other tasks to check off my list plus one Mr. L was sabotaging my work) to get the integration working, but it just didn’t. For all calls that came in, 3CX would initiate “create a new contact” in Vtiger…and I was 100% sure I had all the configuration right.

The first thing I did was to setup a lab to test the configuration, but this came with its own problems and 3CX failed to trigger for all calls to my client. I still don’t know why that happened, but this led me down the rabbit hole of Vtiger webservice. I had to mock the getchallenge, login and query calls to be sure the vtiger instances (lab and live) we behaving OK…and they sure were.

Then I turned my attention to the source code for the vtiger integration plugin which you can find at C:\ProgramData\3CXPhone for Windows\PhoneApp\DotNetScripts\vTiger for the 3CX client and also, the logs which you can find at C:\Users\[username]\AppData\Roaming\3CXPhone for Windows.

I should add that someone else implemented the Vtiger solution for this client and it was heavily modified, so we were dealing with an installation that was far from “out of the box”.

After digging through the source and replaying the webservice requests, I landed upon the issue. You see, the 3CX Vtiger plugin would run a query for “mobile”, “phone”, “fax number” etc. but apparently, it was not designed to deal with the case where the API returned

{"success":false,"error":{"code":"ACCESS_DENIED","message":"Permission to access phone attribute denied."}}

I believe there was an ACL on this field and the 3CX Vtiger plugin was not designed to handle this case.

I’ll report this case to the 3CX team, but in the mean time you can get your integration working by digging into some C# code. Comment out TelephoneMatches for fields besides “mobile” in ContactEntity.cs and modify ContactFinder.cs to omit all fields that may have been ACLd. Note that I was primarily interested in comparing against the “mobile” field as this was the field used to store contact phone numbers in this Vtiger installation.

3CX contactentity.cs

3CX contactentity.cs

3CX contactfinder.cs

3CX contactfinder.cs

Since this works now, I’ll have to edit the vtiger plugin on the server so I can push to all the windows clients.

I hope you find this helpful? If you did please share.

I still don’t know why 3CX would not trigger Vtiger on localhost though. Could it be because 3CX was remote?

Leave a Reply