- Joined
- Jul 1, 2019
- Messages
- 12
- Reaction score
- 3
… or how I spent a week of my life with a few simple tasks
Why? Let me tell you, in order, the story of our client's integration with the crm system from bitrix24.
At begin, what would you understand, the standard template from the 3cx box can only do the following:
So we begin to modify the standard template for the needs of our client.
First problem. At Bitrix call record can be uploaded by setting Call_ID in special API function. Do we have it?
No. Because the original algorithm embedded in the 3CX template does not register the call – it’s only create “activity”.
But why did 3CX developers choose this path? If we can simply create call action by Bitrix API (telephony.externalcall.register)! If we use this function we automatically create correct lead, record in call journal in Bitrix (yes it’s important for making simple reports in Bitrix), correct activity, show call card in CRM for operator and we will have Call_ID for upload voice record later.
Ok, let’s try this way. It’s ok, but we mast close any registered call in Bitrix after call end by calling call special function (telephony.externalcall.finish). 3CX gives us this opportunity by Next in Output block.
But something is wrong here, will say me experienced 3CX administrator and will be right:
!!! 3CX has only two points of reference in CRM
!!! 3CX execute "get contact scenario" for same inbound number not more than once every ten minutes. 3CX for some reason made an internal cache for synchronizing contacts
At this moment I cried. Simple integration was getting harder.
Only the second way to solve the problem remains – create and immediately close Bitrix call when 3CX call is finished.
This is a terrible way, but it can to solve the problem of obtaining CALL_ID.
I have CALL_ID, what now? How can I use standard 3CX CRM end call variables to get call record? Answer – directly no way. Two problems here:
1. 3CX does not register the path to voice recording anywhere. It’s really problem.
2. External user (such as Bitrix voice downloader agent) cannot directly access 3CX web service without authorization
Therefore, we can try to make a script for uploading call voice record on base64 format to Bitrix. Unfortunately, my programming knowledge ends in PHP so I spent a lot of time screwing php to nginx of 3cx debian instance.
What is the next rake that got in my way?
!!! 3CX CRM CallEndTimeUTC variable has nothing to do with the filename of the voice record in local records folder – it’s random and I don’t know why. Magic in PHP does its job and unload the voice recording turned out
We are close to the finale, but not quite yet. At this stage, we want to display the customer card to the operator.
Operator will use 3CX Windows Client, Bitirix24 Desktop App, and desk phone to answer calls. And new rake from 3CX (thank you guys - so much I did not swear for a long time):
!!! 3CX Windows Client CAN’T DISPLAY CRM CARD/LINK. Only Web-client can do it. WHY???
I think that keeping the tab with the 3CX Web-client always open is not convenient and not reliable – operator can close it or forget to open on work day begin. How can we solve this problem? 3CX windows client can launch an external application with an incoming call, into which only two variables can be transferred - the incoming number and the name of the subscriber.
Solution: another PHP script on 3CX server side which start a bitrix call with showing client card in B24 App (yes, telephony.externalcall.register API function) and 3cx windows client that running hidden curl for call PHP script.
Phew! That’s all. Let’s try to port solution to our client side and starting beta tests.
…and we find a new rake and successfully get it on our her forehead. Because our client uses call queues
!!! 3CX doesn't do anything with CRM if an incoming call comes to 3CX queue and missing.
!!! 3CX doesn’t send correct callerid to 3CX windows client and PHP script can’t show client card.
At this place, I really cried. WHY??? 3CX developers why you do it? The answer on 3CX the forum really killed me – we don’t know which operator missed a call. Really??? Then what operators did 3CX just call in queue?
Yes, I decided this through serial redirection from operators by timeout, but this solution is disgusting to me. All the charm of 3CX queues has disappeared.
That’s all guys. My sad story is over.
Now a little concrete that I wanted to convey to the 3cx developers with this story:
p.s. All the rakes I found on the way to the solution, I found answers on the 3CX forum in the form of crutches, which I used later and the solution was only like that
p.s.2 Sorry for my poor English
Why? Let me tell you, in order, the story of our client's integration with the crm system from bitrix24.
At begin, what would you understand, the standard template from the 3cx box can only do the following:
- Sync contact to 3cx from Bitrix
- Create Lead / Contact in bitrix
- Create crm avtivity record about ended call (crm.activity.add api function)
So we begin to modify the standard template for the needs of our client.
First problem. At Bitrix call record can be uploaded by setting Call_ID in special API function. Do we have it?
No. Because the original algorithm embedded in the 3CX template does not register the call – it’s only create “activity”.
But why did 3CX developers choose this path? If we can simply create call action by Bitrix API (telephony.externalcall.register)! If we use this function we automatically create correct lead, record in call journal in Bitrix (yes it’s important for making simple reports in Bitrix), correct activity, show call card in CRM for operator and we will have Call_ID for upload voice record later.
Ok, let’s try this way. It’s ok, but we mast close any registered call in Bitrix after call end by calling call special function (telephony.externalcall.finish). 3CX gives us this opportunity by Next in Output block.
But something is wrong here, will say me experienced 3CX administrator and will be right:
!!! 3CX has only two points of reference in CRM
- At call income before 3CX will determine which extension will answer the call (!!!) on get contact scenario
- When call finished.
!!! 3CX execute "get contact scenario" for same inbound number not more than once every ten minutes. 3CX for some reason made an internal cache for synchronizing contacts
At this moment I cried. Simple integration was getting harder.
Only the second way to solve the problem remains – create and immediately close Bitrix call when 3CX call is finished.
This is a terrible way, but it can to solve the problem of obtaining CALL_ID.
I have CALL_ID, what now? How can I use standard 3CX CRM end call variables to get call record? Answer – directly no way. Two problems here:
1. 3CX does not register the path to voice recording anywhere. It’s really problem.
2. External user (such as Bitrix voice downloader agent) cannot directly access 3CX web service without authorization
Therefore, we can try to make a script for uploading call voice record on base64 format to Bitrix. Unfortunately, my programming knowledge ends in PHP so I spent a lot of time screwing php to nginx of 3cx debian instance.
What is the next rake that got in my way?
!!! 3CX CRM CallEndTimeUTC variable has nothing to do with the filename of the voice record in local records folder – it’s random and I don’t know why. Magic in PHP does its job and unload the voice recording turned out
We are close to the finale, but not quite yet. At this stage, we want to display the customer card to the operator.
Operator will use 3CX Windows Client, Bitirix24 Desktop App, and desk phone to answer calls. And new rake from 3CX (thank you guys - so much I did not swear for a long time):
!!! 3CX Windows Client CAN’T DISPLAY CRM CARD/LINK. Only Web-client can do it. WHY???
I think that keeping the tab with the 3CX Web-client always open is not convenient and not reliable – operator can close it or forget to open on work day begin. How can we solve this problem? 3CX windows client can launch an external application with an incoming call, into which only two variables can be transferred - the incoming number and the name of the subscriber.
Solution: another PHP script on 3CX server side which start a bitrix call with showing client card in B24 App (yes, telephony.externalcall.register API function) and 3cx windows client that running hidden curl for call PHP script.
Phew! That’s all. Let’s try to port solution to our client side and starting beta tests.
…and we find a new rake and successfully get it on our her forehead. Because our client uses call queues
!!! 3CX doesn't do anything with CRM if an incoming call comes to 3CX queue and missing.
!!! 3CX doesn’t send correct callerid to 3CX windows client and PHP script can’t show client card.
At this place, I really cried. WHY??? 3CX developers why you do it? The answer on 3CX the forum really killed me – we don’t know which operator missed a call. Really??? Then what operators did 3CX just call in queue?
Yes, I decided this through serial redirection from operators by timeout, but this solution is disgusting to me. All the charm of 3CX queues has disappeared.
That’s all guys. My sad story is over.
Now a little concrete that I wanted to convey to the 3cx developers with this story:
- Make a CRM call point at the time the operator answers
- Make correct template for Bitrix with callregister/callfinish
- Make a variable with full local path to call voice record by direct link.
- Consider the possibility of providing external direct access to conversation records (for example random link and REST variable)
- Make a transfer CRM client card link to windows client
- Pass the correct callerid variable to windows client when calling the queue
- Register a CRM action for a missed call in the queue. Yes, it’s not easy to implement, but necessary. My ways:
- Remember operator’s extensions whose phones have been ringing during a call. Than make N records about missing calls for each extension
- Register missing call for first queue manager in queue options
- Register missing call for queue number
p.s. All the rakes I found on the way to the solution, I found answers on the 3CX forum in the form of crutches, which I used later and the solution was only like that
p.s.2 Sorry for my poor English