Send events to connected users from FOP2Callbacks.pm
Hello.
I'm trying to make FOP2 chrome app to open URL upon answering any call (not just queue calls) with FOP2Callbacks.pm. I see that FOP2Callbacks.pm is mostly aimed at executing AMI actions, is it possible to send events to connected users from FOP2Callbacks.pm?
What I'm aiming for is making fop2_server to send notification to client on receiving the BridgeEnter event (like it does on receiving the AgentConnect event).
I'm trying to make FOP2 chrome app to open URL upon answering any call (not just queue calls) with FOP2Callbacks.pm. I see that FOP2Callbacks.pm is mostly aimed at executing AMI actions, is it possible to send events to connected users from FOP2Callbacks.pm?
What I'm aiming for is making fop2_server to send notification to client on receiving the BridgeEnter event (like it does on receiving the AgentConnect event).
Comments
My suggestion is to use the new plugin architecture to write such a modification. The .pl part of the plugin should contain something similar to this (that might vary depending on your Asterisk version, this sample is for Asterisk 11). You have to use a UserEvent to return a command to the client side (browser/extension), the command you want to send is the notifyconnect (or notifyringing). The event to intercept is "LINK" as fop2 will translate events to make it backwards compatible...
Look at the sampleplugin source to get an idea of how to use it. You install plugins using the FOP2 Manager.
http://download.fop2.com/plugins/sampleplugin-1.0.0.tgz
Best regards,
I have some problems with substitutions in the popup link though. Only #{CLIDNUM} and #{CLIDNAME} work, both #{UNIQUEID} and #{EXTEN} substitute undefined.
WIP code for Asterisk 13 and FOP2 2.29 (wasn't tested thoroughly):