CTI API integration with 3CX

As of the date of writing this comment, The integration is not possible, because there is no uniqueID that could be synced between newCall and hangup events which will be used in contact and ReportCall events in 3CX
and if you want just to keep the record at the end of the call on Zammad, it’s also not possible because Zammad does not just accept hangup event without previous newCall request.

If you just want to use the contact lookup and contact automatic creation then check this template

2 Likes

For ReportCall event to work I had to make a callID using the incoming phone number and datetime obtained from HTTP Request from the following URL
http://worldclockapi.com/api/json/utc/now using this key currentDateTime
Then this callID can be reproduced by concatonating the incoming phone number with the CallStartTimeUTC from 3CX in the hangup/ReportCall request

checkout the XML template and use it

2 Likes

Hi. Thank you @Mancy .
I am also tried to integrate with 3cx and Zammy.

You said right the event newCall must need before hangup.

With your template I tried to modified for my use.

First.
I modified the MaxLength bigger then 3cx contact comparing need, ex: 10 , and it’s running pretty well

Second.
I commented the call report journaling. After commented it looks like more stable for Zammy showing up the event

But it’s still hard to recognize inbound or outbound. Although event for quickly ticket opening is very good and also like a call log .

Will the CRM template still update or need different kind of CTI API in Zammad?

Thank you for the great work.

For me, incoming Calls would be enough.

But I just don’t get it to work. Using Zammad 3.2 und 3CX 16 Enterprise,
when I click on “test” in 3CX, it says:

Started scenario with empty id
Request text: http://worldclockapi.com/api/json/utc/now
Response text: {"$id":"1","currentDateTime":"2020-01-16T07:34Z","utcOffset":"00:00:00","isDayLightSavingsTime":false,"dayOfTheWeek":"Thursday","timeZoneName":"UTC","currentFileTime":132236336758724115,"ordinalDate":"2020-16","serviceResponse":null}
Response finished
Variable Calldate set to 2020-01-16T07:34Z
Started newCall
Request text: https://support.XXXXX/api/v1/groups
Request form value event set to newCall
Request form value callId set to 55512342020-01-16T07:34Z
Request form value to set to Customer Service
Request form value from set to 5551234
Request form value direction set to in
System.Net.Http.HttpRequestException: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat ---> System.Net.Sockets.SocketException: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at CrmIntegration.ScenarioProcessorBase.ProcessRequest(ScenarioRequest request, IValueManager customManager, HttpClient client, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessMatching(ProtocolScenario scenario, MatchingPath matching, ResponseMatcher responseMatcher, IValueManager customManager, HashSet`1 distinctMatchings, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessFoundMatchings(ProtocolScenario scenario, IValueManager customManager, List`1 matchings, ResponseMatcher responseMatcher, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.Execute(ProtocolScenario scenario, CancellationToken token)
   at CrmIntegration.CrmProcessor.GetContactInfoFromCrm(String contactNumber, String destinationEmail, Boolean createIfNotFound, CancellationToken token)

For me, this indicates that 3CX isn’t talking to Zammad, am I correct?
I also see the Word “Microsoft”, might that be a problem that my 3CX Instance is running on a Microsoft Server?

1 Like

Is this the CTI api url you are trying to connect to? It looks wrong, it should read s.th. like https://your-zammad-url/api/v1/cti/your-unique-id-string

1 Like

This feature is still needed. Please vote for it!

This is not a feature request but a development thread.
Voting on this thread thus has no effect.

Prite, if you have zammad onpremise, you can do the integration with 3CX through the sql integration on 3CX, you don’t really need the template to integration…

I’m developer by Xmartek, we do this types of integrations.

I guess I can’t repeat myself often enough:
Direct fiddling in Zammads database is more than discouraged. Especially if you plan on writing into it.
This may cause serious issues, not just in terms of inconsistent data. Use Zammads rails console and API instead. Like really, don’t.

1 Like

I have the same understanding. Thanks.

But it would really be helpful to have a standard integration for 3CX (leading player) and also zabbix connect would be perfekt. is there any area to vote? We would also pay for the development.

I don’t understand that statement. Zabbix has a media template and PR’d documentation on that regard and thus should already work just fine. But this is kinda off topic here.
https://admin-docs.zammad.org/en/latest/system/integrations/zabbix.html

Feel free to contact our sales team for a feature sponsoring for 3CX CTI integration just like the other three: sales [at] zammad [dot] com

1 Like

Hi there! I’ve been working on an integration for the past few days.

@Mancy’s script works fine except for one thing: Since there’s no unique caller ID the hangup-Event doesn’t work. I’ve researched quite a bit and while this has been requested for years, the developers of 3CX have yet to integrate it. The call is displayed in Zammad, but stays ‚active’ for an extended period of time.

My current implementation makes use of the ‚Call Flow‘ feature, which offers a variable with a unique ID for each call. Please note: Not available in the free version. Also, all calls (that you want to display in Zammad) need to go through the Call Flow.

First, it calls Zammad’s CTI API and creates a newCall event.
Next, the individual Call Flow components will be run (e.g. time based/skill based routing).
When the call gets dropped from the Call Flow, it calls Zammad’s CTI API again with a hangup event.

It works great, but there’s still one caveat: Whenever the call gets transferred to a user, group IVR or queue, the Disconnect Handler Flow will run, i.e. call the CTI API with the hangup event.

I hope someone can make use of this—if you have any questions, let me know. :slight_smile:

Hi, I can recommend our own project, we are using that for years now:

Hi ,
Another thing to know Call Flow are availables only for on premise 3cx , not on 3cx hosted

We were using it, since the Update to 3CX V20, it can’t login anymore. Have there been any changes in 3CX that we have to look for?

Hi,
we are using the REST API behind the management console. This doesn’t exist anymore. Anyone SHOULD check compatibility before updating especially that 3CX V20 is RC not stable.
My information so far are, that the new 3CX API we could use will come with V20 U2

Thank you. I didn’t realize that it was not a stable Version.
So I should try a Downgrade :frowning:

A working 3cx integration would be very cool. Because there are so much people using 3cx.

Feel free to open a feature request unless there’s one already.

1 Like