Asterisk: How to setup Agent Status on Polycom Idle Display
This tutorial describes how to configure the idle display screens on Polycom phones to subscribe to a XHTML file that reads their Agent status from Asterisk. When the phone is not in active use it displays the web page.
My tutorial has three components. A specific Polycom option(found in sip.cfg) added to the configuration file of each phone, a BASH script I wrote, and a little Asterisk configuration. This tutorial assumes you have a working Asterisk 1.6+ PBX with a basic queue setup. It also assumes you are using automatic web provisioning of your Polycom phones.
Here is a link to my previous article on configuring Polycom SoundPoint IP phones for Asterisk:
How to configure a Polycom SoundPoint IP phone for Asterisk on Fedora 10
To get the idle display screen to work correctly we will need to modify our standard configuration file a bit. Navigate to the FTP/HTPP directory you provision your phones from. Edit an Agent phone similar to the following,
/home/polycom/your-phones-mac-address-phone.cfg:
<?xml version="1.0" standalone="yes"?> <PHONE_CONFIG> <OVERRIDES tcpIpApp.sntp.address="pool.ntp.org" reg.1.server.1.address="10.1.10.222" msg.mwi.1.callBack="299" msg.mwi.1.callBackMode="contact" mb.idleDisplay.home="http://10.1.10.222/polycom/189.xhtml" mb.idleDisplay.refresh="3" reg.1.auth.password="m35at5toooo4342dfkj44dsa2311" reg.1.label="189" reg.1.address="189" reg.1.auth.userId="189" reg.1.displayName="189" /> </PHONE_CONFIG>
I created a BASH script that generates a XHTML file that each phone subscribes too. When an agent logs onto the ‘Sales Queue’ the script is executed, resulting in XHTML that will read, “Logged in as 189″. The file is saved by default to the apache web located at ‘/var/www/html/polycom’. So please create a directory named polycom in your web root; or modify the script to fit your needs.
/etc/asterisk/bin/agent-status.sh:
#!/bin/bash
#set -x AGENTXHTML=$( echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" echo "<html lang=\"en-US\" xml:lang=\"en-US\" xmlns=\"http://www.w3.org/1999/xhtml\">" echo "<head>" echo "<title>Logged in as $1</title>" echo "</head>" echo "<body>" #echo "<p>LOGGED IN AS $1" #echo "</p>" echo "</body>" echo "</html>") echo $AGENTXHTML > /var/www/html/polycom/$1.xhtml ; chown -R apache:apache /var/www/html/polycom/
A similar script is called when an Agent logs out,
/etc/asterisk/bin/agent-status-logoff.script:
/etc/asterisk/extensions.conf:
#!/bin/bash
#set -x
AGENTXHTML=$(
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
echo "<html lang=\"en-US\" xml:lang=\"en-US\" xmlns=\"http://www.w3.org/1999/xhtml\">"
echo "<head>"
echo "<title>Agent logged off</title>"
echo "</head>"
echo "<body>"
#echo "<p>AGENT LOGGED OFF"
#echo "</p>"
echo "</body>"
echo "</html>")
echo $AGENTXHTML > /var/www/html/polycom/$1.xhtml
Below is an example of a context called ‘utilities’ that includes an extension for logging into and out of a queue named ‘sales’. When a Agent successfully enters the ‘sales’ queue ‘agent-status.sh’ is executed with ‘${CALLERID(num)}’ as the positional parameter(in BASH parlance $1). The result is that a simple XHTML file named after the extension is created. Every three seconds the phone updates this XHTML file. The phone displays this page when not in use.
/etc/asterisk/extensions.conf
[utilities]
exten => 2078,1,Answer
exten => 2078,n,authenticate(888)
exten => 2078,n,AddQueueMember(sales,SIP/${CALLERID(num)},1,)
exten => 2078,n,Playback(agent-loginok)
exten => 2078,n,system(/etc/asterisk/bin/agent-status.sh ${CALLERID(num)})
exten => 2078,n,Hangup
exten => 3078,1,Answer
exten => 3078,n,authenticate(888)
exten => 3078,n,RemoveQueueMember(sales,SIP/${CALLERID(num)},1,)
exten => 3078,n,Playback(agent-loggedoff)
exten => 3078,n,system(/etc/asterisk/bin/agent-status-logoff.sh ${CALLERID(num)})
exten => 3078,n,Hangup
Asterisk combined with feature rich Polycom Soundpoint IP phones provide a high quality feature rich Call Center environment. If you have any questions, suggestions, or improvements please post!
No Comments »
RSS feed for comments on this post. TrackBack URL

