Issue with Bitrix-3CX Integration.

Status
Not open for further replies.

setechnical

Customer
Joined
Dec 13, 2019
Messages
40
Reaction score
1
I'm having problems with call logging. The calls log in to the Bitrix calendar at 5 hours behind. It's screaming timezone issues. But I can't see where. I've checked Timezone at (UTC -5) on 3CX, Bitrix, and the Users Profile, and everything is set to UTC -5. I can't make sense of it. I set verbosity to max, and can attach the 3cxsystemservice log. Does anyone have any ideas what to check?
 
Interestingly the Bitrix report the call at 12:08PM, but real time is 5:08PM. Everywhere I have things set to UTC -5. Where else can I check?
 
The Bitrix template reports the call using local time zone. This is from the template XML:
<Value Passes="0" Key="START_TIME" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>

So, that will use the local time of the 3CX server. The 3cxSystemService in verbose logs will tell you the date and time sent to Bitrix, so you can determine if the issue is on the 3CX side, or the Bitrix side...
 
Ernesto, Thanks for your reply. I will attach the 3CX screenshot. Bitrix keeps telling me to contact 3CX... but I believe it is a Bitrix issue. You can see here in this image that the Local time (using the top entry) that the call arrives is reported at 11:22:54AM... but it registers the call in Bitrix exactly 5 hours earlier. Despite having the same time zone
 

Attachments

  • Bitrixcall report.JPG
    Bitrixcall report.JPG
    129.8 KB · Views: 9
As I told you, enable verbose logs from the 3CX Console > Dashboard > Activity Log > Settings. Then make a test call, and the 3cxSystemService.log will show you exactly what information is being sent to Bitrix. That's what you need to confirm if the issue is on the 3CX server or on the Bitrix side.
 
Hi Ernesto,
I've finished troubleshooting with Bitrix, and they are saying that 3CX isn't sending timezone information:

Please see the following transcript:

"
ello, Shane. Thank you for waiting for an answer. I deactivated recording REST API logs on your portal. Thank you for the information. I've studied situation and see in logs this information:
"START_TIME":"2020-01-10T08:48:22Z"

This app don't send timezone, that you are using. https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_add.php — here you can see, that in examples there are timezone:
var dateStr = d.getFullYear() + '-' + paddatepart(1 + d.getMonth()) + '-' + paddatepart(d.getDate()) + 'T' + paddatepart(d.getHours()) + ':' + paddatepart(d.getMinutes()) + ':' + paddatepart(d.getSeconds()) + '+00:00';

(in the end)

Please, contact your application support and ask them to solve this situation. Here full logs: " (see attached)
 

Attachments

This is weird, we don't have this issue in our testins account, and no other user has reported this so far... In any case, you can edit the template to achieve what you need as follows:
  1. Go to the 3CX Console > Settings > CRM Integration > Bitrix > Show template button. Copy the XML shown, and paste it in a new empty text file. Save this file as "Bitrix_custom.xml".
  2. Edit the following lines:
  • In line 2 change: Name="Bitrix" to Name="Bitrix_custom"
  • In line 313 change:
<Value Passes="0" Key="START_TIME" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>
to:
<Value Passes="0" Key="START_TIME" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>-05:00

  1. Save the changes.
  2. Go to the 3CX Console > Settings > CRM Integration > Add button, and upload your custom Bitrix template.
  3. Select the template "Bitrix_custom", configure it and test it.
 
Ernesto,

In my version, it is line 307 and is this text:

<Value Key="START_TIME" Passes="0" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>

changed to:

<Value Key="START_TIME" Passes="0" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>-05:00

Also, I had to name the file Bitrixcustom instead of Bitrix_custom and of course change the associated name inside the XML.

Error : "Template name should contain only alphanumeric characters"

After retesting, the problem remains unchanged, and calls still show 5 hours behind.

Note that I did not try rebooting either 3CX or Bitrix servers. Can you see something I did wrong?

Thanks-Shane
 

Attachments

  • Bitrixcustom.xml
    Bitrixcustom.xml
    23.5 KB · Views: 5
  • 2020-01-14 18_19_08-Window.png
    2020-01-14 18_19_08-Window.png
    208.6 KB · Views: 1
Note: rebooting both does not fix either
 
<Value Key="START_TIME" Passes="0" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]</Value>-05:00
This is wrong. The time zone value need to go inside the <Value> element:
<Value Key="START_TIME" Passes="0" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]-05:00</Value>
 
So after doing this, there is nothing reporting now to Bitrix. This change may have broken it. I deleted and reattempted twice. Attached are the logs from a recent attempt.
 

Attachments

You sent the 3CX Activity Log, which doesn't have information related to the CRM integration. You need to enable verbose logs and check the 3cxSystemService.log file.
 
ok, started it over again.... this time it now registers to Bitrix, but the timezone is still off, just as before:

Here is the string used

<Value Key="START_TIME" Passes="0" Type="String">[[CallStartTimeLocal].ToString("yyyy-MM-ddTHH:mm:ssZ")]-05:00</Value>

Any other suggestions? To confirm, here is a screenshot of the active custom template


Thanks for your help
 

Attachments

  • 2020-01-16 14_34_06-Window.png
    2020-01-16 14_34_06-Window.png
    257.4 KB · Views: 3
  • Capture.JPG
    Capture.JPG
    137 KB · Views: 3
Please, enable verbose logs from the 3CX Console > Dashboard > Activity Log > Settings. Then make a test call and check the 3cxSystemService.log. There you will see what information is being sent to Bitrix.
 
Sorry about the delay here. Here is the log requested.
 

Attachments

The call activity is not being created now. This is from the logs:
2020/01/21 13:49:02.229|545|0026|Verb|Performing GET request 'https://bitrix.southeastern.biz/rest/1/5m3wxv0ae8wt90ru/user.get.json?filter[UF_PHONE_INNER]=701'.
2020/01/21 13:49:02.351|545|0027|Verb|The response is: '{"result":[{"ID":"1","ACTIVE":true,"EMAIL":"[email protected]","NAME":"Shane","LAST_NAME":"Lewis","SECOND_NAME":"","PERSONAL_GENDER":"","PERSONAL_PROFESSION":"","PERSONAL_WWW":"","PERSONAL_BIRTHDAY":"","PERSONAL_PHOTO":"https:\/\/bitrix.southeastern.biz\/upload\/main\/08b\/avatar.jpg","PERSONAL_ICQ":"","PERSONAL_PHONE":"","PERSONAL_FAX":"","PERSONAL_MOBILE":"4047877125","PERSONAL_PAGER":"","PERSONAL_STREET":"5509 Radford Rd, Suite D","PERSONAL_CITY":"Flowery Branch","PERSONAL_STATE":"GA","PERSONAL_ZIP":"30542","PERSONAL_COUNTRY":"122","WORK_COMPANY":"","WORK_POSITION":"","WORK_PHONE":"6788076156","UF_DEPARTMENT":[1,4,2],"UF_INTERESTS":null,"UF_SKILLS":null,"UF_WEB_SITES":null,"UF_XING":null,"UF_LINKEDIN":"https:\/\/www.linkedin.com\/in\/shane-lewis-0b6935a\/","UF_FACEBOOK":"https:\/\/www.facebook.com\/cfm56","UF_TWITTER":"https:\/\/twitter.com\/setechnical","UF_SKYPE":null,"UF_DISTRICT":null,"UF_PHONE_INNER":"701","USER_TYPE":"employee"}],"total":1,"time":{"start":1579632542.282326,"finish":1579632542.336661,"duration":0.05433511734008789,"processing":0.018249988555908203,"date_start":"2020-01-21T13:49:02-05:00","date_finish":"2020-01-21T13:49:02-05:00"}}'
2020/01/21 13:49:02.351|545|0027|Verb|Filtered variables for matching:
2020/01/21 13:49:02.351|545|0027|Verb| 'ResponsibleId' = '1'
2020/01/21 13:49:02.351|545|0027|Verb|Processing scenario 'CreateCallActivity'.
2020/01/21 13:49:02.351|545|0027|Verb|Creating new HttpClient with no authentication
2020/01/21 13:49:02.352|545|0027|Erro|Exception during call reporting: System.Exception: Unknown expression: :FullName. Part: :FullName.

Are you using that ":FullName" variable as part of your parameters? How are you configuring the integration? The default value for the description of an inbound call for example is:
Answered Inbound Call:" Default="[DateTime]: Answered incoming call from [Number] [Contact::FullName] to [Agent] ([Duration])

The variable [Contact::FullName] is retrieved during contact lookup. Are you referencing this variable or you made a typo?
 
That part I added as it said I could utilize variables in the subject string. Maybe it's got a typo. let me set back to default and try
 
So actually none of that was changed, those were the default values I believe.. I only added was the ":FullName" portion to the subject, but it looks like it should be " [Contact::FullName] ".

So now my subject reads:
Call: [Contact::FullName] :[Number]
instead of:
Call: [:FullName] :[Number].

Let me try and see how it goes.
 
ok, call registration in Bitrix is working again with that fix... but it's still 5 hours off. See new logs and test call.
 

Attachments

The logs show the date and time sent:
2020/01/21 14:24:49.644|545|0034|Verb|Performing POST request to 'https://bitrix.southeastern.biz/rest/1/5m3wxv0ae8wt90ru/crm.activity.add' with message '{"fields":{"TYPE_ID":2,"OWNER_ID":"1051","OWNER_TYPE_ID":"3","RESPONSIBLE_ID":"1","START_TIME":"2020-01-21T14:24:43Z-05:00","PRIORITY":2,"COMPLETED":"Y","SUBJECT":"Call: Jane Doe :4047877125","DIRECTION":"1","DESCRIPTION":"1/21/20 2:24 PM: Answered incoming call from 4047877125 Jane Doe to 701 (00:04)","COMMUNICATIONS":[{"VALUE":"4047877125"}]}}'.
2020/01/21 14:24:49.814|545|0032|Verb|The response is: '{"result":1017,"time":{"start":1579634689.653204,"finish":1579634689.767836,"duration":0.11463212966918945,"processing":0.0822439193725586,"date_start":"2020-01-21T14:24:49-05:00","date_finish":"2020-01-21T14:24:49-05:00"}}'

You should check with Bitrix if that's the format that should be sent.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,990
Messages
590,161
Members
164,926
Latest member
tohoken1