Sending call notifications from Asterisk to HipChat

Shaun Ewing Technology 0 Comments

We run an Asterisk PBX with agents who take inbound phone calls from our various phone queues. We also use HipChat as our internal instant messaging and group chat system.

So that agents are aware a call may be headed their way, we have a room within HipChat where call notifications are sent automatically. They look like this:

notification

To get started with this you will need:

  • A functioning Asterisk PBX with access to install AGI scripts
  • A functioning HipChat installation with administrative access
  • PHPAGI installed and configured

Step 1- Setup HipChat

First you need to configure an integration within HipChat. This will provide you with an API endpoint and credentials that you’ll need in step 2.

From the HipChat web interface you need to select Integrations on the top menu and then Build your own integration.


Once done you need to select the room where notifications will be sent and a name for your integration. The name will appear as part of the notification so choose carefully.


The final step will show the API details. You’ll need to make note of the notification URL as you’ll need this in step 2


Click save and that’s the end of step 1.

Step 2 – Setup your AGI script

As mentioned in the pre-requisites you should have PHPAGI installed and configured. You’ll need to create an AGI script like the following. On my system this has been set to /var/lib/asterisk/agi-bin/hipchatnotify.php.

You’ll need to replace YOURURL with the notification URL provided in step 1. You probably want to change the “From” field too, otherwise it’ll display “Ewing IT PBX”.

You may also notice a timeout of 3 seconds. This is to ensure that a timeout connecting to the HipChat API doesn’t prevent your calls from progressing.

Save and move on to step 3!

Step 3 – Setup your dial plan

How you do this exactly will depend on your system setup, however you’ll need to insert a call to the AGI script before the call enters your queue.

A very basic example on extension 1501 might look like this:

You’ll note that I have included “Support” as a parameter. This is so that the notification shows where the call is going and you could put arbitrary text here.

Step 4 – You’re done

Once you’ve done these steps and reloaded the system try a test call. If everything is working correctly, you should receive a notification in your room like this:


Did this work for you? Let me know how you went in the comments below!

About the Author
Sending call notifications from Asterisk to HipChat was last modified: May 1st, 2017 by Shaun Ewing

Leave a Reply

Your email address will not be published. Required fields are marked *