martinvonwittich / asterisk-zammad-cti-bridge

A bridge between an Asterisk server (via AMI) and the Zammad CTI interface.
GNU General Public License v3.0
22 stars 8 forks source link

Support for user[] in newCall event #6

Open siddolo opened 4 years ago

siddolo commented 4 years ago

Hi,

can you support the new zammad API? It uses array of user: https://docs.zammad.org/en/latest/cti/api-push.html?highlight=user[]#endpoint

Thanks

martinvonwittich commented 4 years ago

Sounds good, but I'm unfortunately swamped with work currently and I have no idea when I can get back to asterisk-zammad-cti-bridge :/

motechsolutions commented 3 years ago

I have the same problem with the latest version of Zammad (3.6), can you point me in the right direction on where to fix/change the asterisk-zammad-cti-bridge script to enable this great project to work with the latest version of Zammad

martinvonwittich commented 3 years ago

I have the same problem with the latest version of Zammad (3.6), can you point me in the right direction on where to fix/change the asterisk-zammad-cti-bridge script to enable this great project to work with the latest version of Zammad

Hm, I thought this was an optional new feature; I wasn't aware that asterisk-zammad-cti-bridge no longer works with the latest Zammad version? We stopped using Zammad's CTI integration some time last year, so if it has stopped working, I wouldn't have noticed.

In theory, the parameter is easy to add:

asterisk.iserv.eu /opt/asterisk-zammad-cti-bridge # git diff
diff --git a/asterisk-zammad-cti-bridge b/asterisk-zammad-cti-bridge
index 89b1483..dae00c0 100755
--- a/asterisk-zammad-cti-bridge
+++ b/asterisk-zammad-cti-bridge
@@ -188,6 +188,7 @@ sub cb_default
         to => $event->{Queue},
         direction => "in",
         callId => $event->{Queue}.$event->{Uniqueid},
+        "user[]" => <some useful value>,
       };
   }
   elsif ($event->{Event} eq "AgentConnect")

But I don't know that value to submit here. I tried $event->{CallerIDName} (e.g. Lastname, Firstname of the caller), but Zammad seems to expect the opposite here:

It is the name of the calling user when direction is “out”, or of the users receiving the call when direction is “in”. Group calls may be received by multiple users. In that case a “user[]” parameter is set for each of these users. It is always “user[]” (not “user”), even if only one user is involved.

$event->{CallerIDName} is the name of the calling user for direction in, but Zammad expects the name of the called user. Doesn't seem very useful to me?

motechsolutions commented 3 years ago

Thank you martinvonwittich, that worked perfectly, as per your post i added "user[]" => $event->{CallerIDName}, at line 191 just under callId => $event->{Queue}.$event->{Uniqueid}, and restarted the script asterisk-zammad-cti-bridge

Its a brill add on for Zammad, thank you again for helping me to resolve this problem

martinvonwittich commented 3 years ago

Thank you martinvonwittich, that worked perfectly, as per your post i added "user[]" => $event->{CallerIDName}, at line 191 just under callId => $event->{Queue}.$event->{Uniqueid}, and restarted the script asterisk-zammad-cti-bridge

I'm still curious what your use case is here. The way it looks in my test Zammad without the change is this:

Download

The calling number "+49 ..." in the "from" column, and the destination queue "support" in the "to" column. With the change, I'll still have the number "+49 ..." in the "from" column, but the destination queue "support" is replaced with the name of the caller. This doesn't seem very useful to me - I'd rather have the name of the caller in the "from" column, and keep the destination queue in the "to" column. Does this work differently for you?

motechsolutions commented 3 years ago

Hi martinvonwittich Without the change the script refuses to work at all with Zammad 3.6, it just errors when a call is received but when i added your fix at least now i get notification inside Zammad of a call etc, i agree i would of liked to have the queue name in the "to" column but for now apart from the "to" column the rest works fine

martinvonwittich commented 3 years ago

Hi martinvonwittich Without the change the script refuses to work at all with Zammad 3.6, it just errors when a call is received but when i added your fix at least now i get notification inside Zammad of a call etc, i agree i would of liked to have the queue name in the "to" column but for now apart from the "to" column the rest works fine

Hm, strange. My test zammad says "This is Zammad version 3.6.x" and there it seems to work.

motechsolutions commented 3 years ago

The strangest thing, i removed the line i added and restarted the asterisk-zammad-cti-bridge service and its now working as expected. I removed the line so i could copy/paste the error i was getting when running the service but its working, now sure why!!