Asterisk-zammad-cti-bridge: push Asterisk queue events into Zammad's CTI integration

I had mentioned my Asterisk AMI -> Zammad CTI script in the past; back then it was just a GitHub gist.

Since then, I’ve added the following improvements:

  • It now queues events internally to ensure that they are pushed to Zammad in order.

    This is necessary because it uses asynchronous HTTP requests, and the old version was able to confuse Zammad when you’ve configured your Asterisk queues like this:

    joinempty=yes
    leavewhenempty=loose
    

    This causes a newCall request that is immediately followed by a hangup request when a caller joins an empty queue (because Asterisk will allow him to, but also immediately kick him). Due to the asynchronous HTTP requests, it was possible for Zammad to process the hangup request before the newCall request, which obviously didn’t work. The internal queue solves this issue.

  • The configuration has been separated into a config file.

  • It prints a readable log to STDOUT that allows you to see what’s going on.

  • It can now reconnect to Asterisk when the connection breaks (e.g. due to an Asterisk restart).

It’s been running for the last two months without any significant issues, so I feel it now deserves a proper repository and a new thread :slight_smile:

You can find it here: https://github.com/martinvonwittich/asterisk-zammad-cti-bridge

PS: can we get a “General discussion” category or something similar here? This topic doesn’t really fit in any of the current categories.

1 Like

Good idea regarding the new category, maybe @Hannes can do that, I lack the permissions. :slight_smile:

I guess this will soon™ be ready for living as part of the documentation as I’m sure that this will be usefull for other people as well. :slight_smile:

Edit, we now have “Lobby” for exactly that.

The script in that form wont work with our Asterisk 11, so i have to make some changes to get it working:

  • in line 126 i have to change
    if ($event->{Event} eq “QueueCallerJoin”)
    to
    if ($event->{Event} eq “Join”)

In our setup, the caller joins a queue, and than, if no one is answering, the caller gets an announcement and is than directed to another queue. Unfortunately he dont get another unique call id from the asterisk server, when joining the 2nd level queue, so zammad is confused, because the call with that id is already hangup and is therefore not displayed.

To avoid this, i added the number of the active queue to each call id by changing every line, which contains
callId => $event->{Uniqueid},
to
callId => $event->{Queue}.$event->{Uniqueid},

Anyway this is a nice and good working script.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.