Asterisk Presence Applet


Download application and source code

Popup menuThis utility for Windows provides a system or notification tray “applet” to show who is on the phone (assuming you are using Asterisk.  The applet can be activated by selecting an option from the popup menu attached to the icon in the system tray but it will automatically activate when your extension rings.

How it works

Popup window exampleThe applet itself does very little work and really is only a host for a web page from the FOP (Flash Operator Panel) application by Nicolás Gudiño.  FOP is quite nice but is aimed more at an  operator type user.  What I want is to be able to see who is calling but also to be able to see if other users are free.  If they are, I can decide whether to let them answer the call or answer it myself.

FOP does display this information but it needs to be shown in a whole web page and what I want is a simple pop-up applet to see call information.

Although FOP is a Flash web page application, buried in the release is a cut-down version of the Flash object called communicator.swf which has no user interface and exists in a web page only to raise JavaScript events in response to activity on the Asterisk server. See the screenshot right.  OK, its a bit sad calling myself but easier than waiting for a call.

The web page that this applet will display is index_dhtml.php, also part of FOP.  This page implements an Html based operator interface, largely written in JavaScript, and does so by responding to the events raised by the hidden SWF.  The SWF in turn interacts with the FOP daemon running on a server somewhere.

The one modification made to FOP for this applet is to edit: js/operator.js to add one line to the beginning of the newevent() function:

window.external.ShowForm(params);

This line tells the page to send information to a function in the page host (this applet) called ShowForm().

ShowForm() looks at the parameter passed (ultimately an asterisk event) to see if it refers to any of the extensions you have listed.  If it does, it displays the form and, so, the hosted web page.

Changing the look and feel

Because the page displayed is just a web page written using Html and JavaScript, you can change the interface presented to the user without changing any of the code here.  That is, you do not need to compile or change the c# here.  Most of the code is to display the tray icon, respond its menu events and make the control disappear.  Instead you can just use the executable and make changes to the web page.

Options

The applet has a menu option to allow the url of the FOP communicator page to be defined.  It allow allows you to define the extension or extensions to be tracked so the applet can be shown automatically.

The applet will disappear after an amount of time set in the options (default 20 seconds) unless the mouse is over the form.

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

Reader Comments

Any chance you will have this working with fop2 as well ?

No plans – at least until we have a need to upgrade FOP. But do you know that it doesn’t work? The client UI only shows a web page which shows standard FOP widgets. Have these been changed?