Tag Archives: UCCX

{uccx api: dynamically changing an agents skill}

Product: UCCX 9.x and above (the configuration API wasn’t available until 9.x)
Scenario: An Agents answers calls for CSQ A from 12PM – 6PM and then needs to answer calls for CSQ B from 6:30PM – 8PM.
Problem: In UCCX, the only way for an Agent to be a member of more than one CSQ is to use Skills. In the Post, I will use a very simple demonstration of a Use of the API to Automate the Changing of an Agents Skill in order for that Agent to answer calls from different CSQs (and not overlap).
Disclaimer: This Post assumes you have Node.js installed and the Request Library loaded as a dependency in your project. I’m not going to show you how to install Node and or Request. The code I will leave you is classified as a Minimum Viable Product; for example, it seems as though the NodeJS rendition of the setTime function could cause memory leaks. Use this code at your own risk..Ultimately I wanted to demonstrate the use of the API in a real-world scenario as mentioned here.

I could use many tools to perform this little magic trick..Python, Java, Ruby, etc; today I wanted to break out Node.JS mainly to show you CRUD operations in a different language..and Node is just cool too!
Continue reading

{ccx script tips & tricks: agent rna => vm}

Product: UCCX version 8.x-10.x (but probably applies to 7.x and below as well)
Scenario: A call is transferred to an Agent, but the Agent does not answer the call so a Ring-No-Answer condition occurs which sends the call back into the CCX Script for processing. The call center supervisor wants all conditions that Match this Scenario to transfer the calls to a general delivery mailbox.
Problem: Number 1: If the UCCX System Parameter for Agent RNA automatically returns an Agent to READY, then the call could get stuck in a loop with the same “unavailable” Agent continuously. Number 2: Our customer’s requirement is asking that after an Agent RNA All Calls “Automatically” Transfer to a General Delivery Mailbox for the Group.

Hope that isn’t confusing. Ultimately, this post will spawn 2 videos. From a verbiage standpoint, I think this will be fairly brief however. The first order of business with the Select Resource Step is to ensure that it doesn’t “Connect” as soon as an Agent becomes available (we need the spacing this causes when we do it that way), but as part of this particular setting, it does force us to create a new User variable as you can see this below as uAgent; another tip, if you didn’t already know the Timeout below is the Default RNA timeout, of course when using the step as below that timeout doesn’t work..you would have to set that timer on the Connect Step that must be added to coincide with this particular setting in the select resource step:

Continue reading

{uccx rest devops: bulk provisioning}

This is not a post on UCCX Scripting. This post is about using the REST API as it is implemented in the UCCX Configuration API. This is also a post about adding functionality to the Administrative Interface of UCCX by providing a Bulk Provisioning tool. What I will leave you with today is a Command Line Tool that can and will improve the efficiency of creating configuration objects in the Cisco Unified Contact Center Express 9.x and later platform.

This is not my first foray into Representational State Transfer (REST). I previously wrote about using REST to reset a VoiceMail PIN (password): a utility that can be nicely integrated into a companies internal Website. REST is all the rage currently within “all” product lines (especially new ones or ones that didn’t have any APIs exposed previously such as the product we’ll be talking about today) within Cisco’s product portfolio. Why APIs? Why REST? Does this have implications when mentioned in the same breath as “Software Defined Networking (SDN)”? I believe so! But I’ll let that industry speak for itself..REST versus everything else I’ve seen is a simple choice. When working with REST, in order to get a list of data back from a source you merely call the HTTP GET method for what it is you want and what is returned is either an XML and/or JSON object (depends on who created the web service). Once you have the list of data you want, then you construct like objects (xml/json) to either create and/or modify (delete as well..but you don’t have to create an object) additional and/or existing configuration objects. In contrast, web services such as the Simple Access Object Protocol (SOAP) requires you to always pass an XML based object in the Request..this simply isn’t efficient. And if you notice in other posts I’ve created, CUCM still utilizes SOAP; they just call it Administrative XML (AXL) most of the time.

Continue reading

{uccx scripting shorts: subFlows}

Every so often a question appears in the Cisco Technical Support Forums concerning the SubFlow Step in a UCCX Script. And it’s always a pleasure answering them and collecting my 5 points. For me the riddle has been solved..but I remember the time when I used these tricky elements within my scripts and I didn’t have the slightest clue as to how they worked their magic..Today in this short, I hope to “break down” the mystique by simplifying what is occuring in these things..and the code is short..as it should be..

The SubFlow Step is a cool little widget that is similar to function calls in procedural programming languages such as C and even Python..and from an OOP (object-oriented) perspective you can almost look at it as if you are calling a method on an object..For those of you who have no idea what I just said, you can look at a SubFlow Step as a “call” to a script that performs a very specific task such as checking for a Holiday, get queue statistics, performing a DB dip (perhaps), et al. SubFlows are typically very small and the ideal for code reuse because they are normally used by all the organizations/departments that use the same CCX system. If you’ve read my blog before you’ve probably seen some Python code with multiple functions and function calls..but I will show you what that looks like below..

Continue reading

{uccx scripting: holiday check via XML}

There are numerous Holiday check scripts out there for CCX; I saw one yesterday that comes with some scripts Cisco provides for free (or used to anyhow) and thought I’d write this post with a script that is quite the dichotomy from that particular script..Of course the objective is the same: Is Today a Holiday or Not?

Below is the Document we are going to parse..

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Holidays>
  <Holiday>1/1/14</Holiday>
  <Holiday>1/20/14</Holiday>
  <Holiday>2/17/14</Holiday>
  <Holiday>7/4/14</Holiday>
  <Holiday>9/1/14</Holiday>
  <Holiday>10/17/14</Holiday>
  <Holiday>11/27/14</Holiday>
  <Holiday>12/25/14</Holiday>
  <Holiday>1/1/15</Holiday>
</Holidays>

Let’s briefly go over some terminology when it comes to XML. Holidays is considered the Root of this Document; other ways in which to refer to an item in an XML file are: Element, Tag, Node. In fact every Element within an XML Document is considered a Node; you have the Elements

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Holidays><Holiday></Holiday></Holidays>

Holidays is the Root Node/Element of the Document..another way to say this is the Root Tag is Holidays and the child element (Tag) is Holiday each of these Elements can be referred to as XML Nodes as well..another XML Node is the Text Node values of the Holiday Elements: the Dates in “M/dd/yy” Format (Short). Ok..let’s break this down in the most simple term I possibly could; once I’m done I feel that you will get it!

//First We Have a String that will be converted to a
//(java.text.DateFormat.SHORT) style
//Cisco Set Step Follows:
Set todaysDate = new Date()
//Properties of this shows Short Date
//Download the Document, Setup for PARSING
//DOC is Store in DOC Repository
dHolidays = Create XML Document(DOC[Holidays.xml])
//The Parser is SAX (from the STD Java Library)
//Next we use the Get XML DOC Data
//To do this you have to use XPath
//holiday is a String type
holiday = Get XML Documnet Data(dHolidays,
     "//Holiday[.='" + todaysDate + "']")
//The Xpression above is 3 Strings
//Concat'd together
If(todaysDate == holiday) Then
    True
        Set isHoliday = true
    False
        //Today is Not a Holiday

Because there are multiple Holiday Nodes, in our XPath Expression we need to pass in a “String” Value that matches the Style in the Document (“M/dd/yy”) which essential returns the same text if that Date exists in the document; hopefully that makes sense..it is a weird looking “syntax” (better than descendant/child IMO) but if you read what XPath is, Wikipedia says it best:

XPath, the XML Path Language, is a query language
for selecting nodes from an XML document. In addition,
XPath may be used to compute values (e.g. strings, numbers,
or Boolean values) from the content of an XML document.
XPath was defined by the World Wide Web Consortium (W3C).

We are done..it can’t get much easier than that to check for a Holiday. I’m going to leave you with the Script and the DOC that I used in this Post. Most use HolidayChecks with SubFlow Steps in the Script..but why? In fact, why do we store the Holidays in an XML file to begin with; as a guy said it best to me the other day in the SupportForums, “this is how I was taught” and that voodoo is the hardest break…Open the script in the version of CCX you are running (it should work on 7.x and above)

HolidayCheckScript

Lastly I decided I would leave you with a video..this video depicts 2 Debug Sessions..1 where the Date Doesn’t Match Today (Not A Holiday) and 1 where I Manually Set Today’s Date to Holiday in the Document..so (isHoliday will equal TRUE)..If you want to watch the video in HD..then you’ll have to go over to the vimeo site and watch it there..And before I forget, here are the files I promised: HolidayCheck

return sam;

{uccx problem solving series: XML and the outdated SAX parser}

A lot of you reading the title of this post may be asking yourself..what does a “SAX” have to do with UCCX…I’m sure there are many bugs to pick with how Cisco’s products operate (if that was a pun then it was definitely intended) especially when things go sideways..such as parsing XML documents. When I use the Create XML Document normally followed up with the Get XML Document Data what is occuring under the hood..besides supplying the Java Beans with Document, XPath Expression (what the H is that), and Output(String)..e.g. the “return” or the Data we really want from that document. That my dear readers is a mystery that you will “never” find out(never say never)..until an exception is thrown, you look deep into the bowls of the log files, and/or you “hack” the box and download the JARs Cisco uses for the product. But back to SAX: simply put *I believe*(based on debug outputs I will show) it is the parser Cisco uses behind the scenes to help Aid us (or hinder us in the case today) in the Parsing of XML Documents..and the version of it would be SAX1 (and I surmise this because v1 doesn’t handle XML Namespaces well and SAX2 addressed those issues).

This post is/was inspired by a Cisco supportforum thread in which an XML Document was being downloaded, “parsed”(Create XML Document actually sets up the Parser), and an attempt to extract data “failed” on the DOC (null String; the doc in that post wasn’t a well-formed doc btw)..Lets take a look at what the well-formed XML is supposed to be:

<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
     <storeInfo>
          <storeID>654</storeID>
          <storeType>Main</storeType>
     </storeInfo>
</string>

There nestled in the root tag/element (<string>) is the surreptitious NameSpace. Again as I stated earlier using UCCX’s standard procedure for parsing XML *DOES NOT WORK:

xml_1
Continue reading

{Code: The Data Conversion Black Hole}

*Note: when I started writing this post, I thought I had a real winner on my hands; and it was put together fairly quickly. At this point, besides wasting the thoughts that were going through my mind at the time, I suppose I should either completely scrap this entire post or just go ahead and publish it..and let the pieces fall where they will.

I was answering a question on the Cisco Support Forums (formerly netPro) the other day; the OP was trying to get the current time (so he could use it to compare 2 ints) by making the below statement (he used the Cisco T[now] syntax in the post):

int currentTime = int.valueOf(cal.get(cal.HOUR_OF_DAY+
     "" + cal.get(cal.MINUTE));

Continue reading