Skip to content

Instantly share code, notes, and snippets.

@d0ngl3md
Last active May 23, 2018 20:08
Show Gist options
  • Select an option

  • Save d0ngl3md/087d57fade4bf9f4c16e to your computer and use it in GitHub Desktop.

Select an option

Save d0ngl3md/087d57fade4bf9f4c16e to your computer and use it in GitHub Desktop.
A Dashing widget that displays number of calls in queue from a broadworks callcenter.

Description

Dashing widget to show number of calls in Queue for a Broadworks call center. This widget uses the default dashing meter widget.

This widget uses the XSI interface defined by the XSI Schema for your Broadworks deployment.

Installation

Add the following code snippet to your dashboard .erb file:

 <!-- set your data-max="" value to match your Queue length in your callcenter -->

 <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
      <div data-id="QUEUECALLS" data-view="Meter" data-title="Queue Calls" data-moreinfo="# of calls in Queue." data-min="0" data-max="100" style="background-color:#ff9618"></div>
    </li>

Copy qcalls.rb into your jobs directory.

Settings

In your dashboard.erb file set data-max="" to match your Call Center Queue length.

In qcalls.rb set the uri = URI(TO THE URL OF RESOURCE FOR YOUR BROADWORKS CALL CENTER)

In qcalls.rb set SCHEDULER.every <'NUMBER OF SECONDS'> to the number of seconds to poll Queue calls. Make sure you do not exceed server transaction limits.

#dependencies
require "xmlsimple"
require "net/http"
require "rubygems"
#Broadworks URL of resource edit host:port and <callcenterid> to math your environment
uri = URI("http(s)://<host:port>/com.broadsoft.xsi-actions/v2.0/callcenter/<callcenterid>/calls")
# :first_in sets how long it takes before the job is first run. In this case, it is run immediately
# set SCHEDULER.every 'seconds' so as not to violate server transaction limits.
SCHEDULER.every '4s', :first_in => 0 do |job|
send_event('widget_id', { })
#HTTP Requests
req = Net::HTTP::Get.new(uri.request_uri)
#enter Broadworks Call Center Username and Password
req.basic_auth 'USERNAME', 'PASSWORD'
res = Net::HTTP.start(uri.hostname, uri.port) {|http|
http.request(req)
}
#parse xml return
qentries = XmlSimple.xml_in(res.body, { 'KeyAttr' => 'name' })
count = 0
if(qentries["queueEntries"] != nil)
count = qentries["queueEntries"][0]["queueEntry"].length
else
count = 0
end
send_event('QUEUECALLS', { value: count })
end
@andrewturner
Copy link

Hi Alsoongit!

Have you ever pulled any other kind of call centre stats out of the XSI API's for display on a widget? Trying to track down the correct calls to get certain stats

@d0ngl3md
Copy link
Author

What stats are you looking for? I can probably get you the calls you need.

@semaja2
Copy link

semaja2 commented Oct 27, 2015

Would it be possible to pull out the StaffedAgents count on a queue?

@EnzoBitMatrix
Copy link

EnzoBitMatrix commented Feb 7, 2018

Hey there, I am getting the following output. Does anybody have any idea how to fix?

[IPADDRESS] - - [07/Feb/2018 14:37:56] "GET /events HTTP/1.1" 200 - 0.0010
[IPADDRESS] - - [07/Feb/2018 14:37:59] "GET /events HTTP/1.1" 200 - 0.0011

scheduler caught exception:
end of file reached

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment