02-22-2012 08:20 AM - edited 03-14-2019 09:25 AM
Dear Anthony,
I am trying write a simple script which I need to accomplish the following.
If the calling number ( Customer Number) XXXXXXXX, I should check this number in an XML file and if it is there I need to set priority for that number 10 other wise the number will get default priority in the que. I have UCCX enhanced. I am having morethan 100 numbers.
Will you please put a light on this.
Solved! Go to Solution.
02-22-2012 10:58 AM
I have a couple of options here for you. Let me know if you have any trouble making them work.
String calling_number = ""
java.util.HashMap vip_numbers_map =
{
java.util.HashMap vip_numbers_map = new java.util.HashMap();
vip_numbers_map.put("6125551000", 10);
vip_numbers_map.put("6125552000", 5);
return vip_numbers_map;
}
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
If (vip_numbers_map.containsKey(calling_number))
True
Set Priority (--Triggering Contact--, Assign: (int) vip_numbers_map.get(calling_number))
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.csv
Contents:
6125551000,10
6125552000,5
String calling_number = ""
String[] vip_numbers_array = null
Document vip_numbers_doc = DOC[vip_numbers.csv]
java.util.HashMap vip_numbers_map = new java.util.HashMap()
String vip_numbers_string = ""
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set vip_numbers_string = vip_numbers_doc
Set vip_numbers_array = vip_numbers_string.split("\r\n")
Do {
int i;
int j = vip_numbers_array.length;
String[] vip_number_entry;
for (i = 0; i < j; i++) {
vip_number_entry = vip_numbers_array[i].split(",");
vip_numbers_map.put(vip_number_entry[0], vip_number_entry[1]);
}
}
If (vip_numbers_map.containsKey(calling_number))
True
Set Priority (--Triggering Contact--, Assign: (int) vip_numbers_map.get(calling_number))
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.csv
Contents:
6125551000,10
6125552000,5
String calling_number = ""
String[] vip_numbers_array = null
Document vip_numbers_doc = URL[http://1.1.1.1/uccx/vip_numbers.csv]
java.util.HashMap vip_numbers_map = new java.util.HashMap()
String vip_numbers_string = ""
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set vip_numbers_string = vip_numbers_doc
Set vip_numbers_array = vip_numbers_string.split("\r\n")
Do {
int i;
int j = vip_numbers_array.length;
String[] vip_number_entry;
for (i = 0; i < j; i++) {
vip_number_entry = vip_numbers_array[i].split(",");
vip_numbers_map.put(vip_number_entry[0], vip_number_entry[1]);
}
}
If (vip_numbers_map.containsKey(calling_number))
True
Set Priority (--Triggering Contact--, Assign: (int) vip_numbers_map.get(calling_number))
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.xml
Contents:
6125551000
10
6125552000
5
String calling_number = ""
Document vip_numbers_doc = DOC[vip_numbers.xml]
String xpath_priority = ""
String xpath_result = ""
int vip_priority = 0
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set xpath_priority = "//calling_number[number='" + calling_number + "']/priority"
vip_numbers_doc = Create XML Document (vip_numbers_doc)
xpath_result = Get XML Document Data (vip_numbers_doc, xpath_priority)
If (xpath_result != null && xpath_result.trim() != "")
True
Set vip_priority = Integer.parseInt(xpath_result)
Set Priority (--Triggering Contact--, Assign: vip_priority)
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.xml
Contents:
6125551000
10
6125552000
5
String calling_number = ""
Document vip_numbers_doc = URL[http://1.1.1.1/uccx/vip_numbers.xml]
String xpath_priority = ""
String xpath_result = ""
int vip_priority = 0
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set xpath_priority = "//calling_number[number='" + calling_number + "']/priority"
vip_numbers_doc = Create XML Document (vip_numbers_doc)
xpath_result = Get XML Document Data (vip_numbers_doc, xpath_priority)
If (xpath_result != null && xpath_result.trim() != "")
True
Set vip_priority = Integer.parseInt(xpath_result)
Set Priority (--Triggering Contact--, Assign: vip_priority)
False
/* Leave at default priority of 1 */
End
02-23-2012 09:15 AM
No problem. Let's see if we can work through them.
02-22-2012 08:34 AM
Hello,
Thanks for posting your question to the forums.
Before we get into a solution (which I promise we'll get to), let's dsicover a few more things about your project.
Looking forward to your reply,
Anthony
02-22-2012 08:43 AM
1. Send to default priority 1
2. It is not mandatory to use XML file, but I was thinking if the contact center supervisor wants to update the list it is easy for him to edit the xml file.
3. No we want to put different priorty lets say Group A 10 Group B 5 Group C 3 No matching ?(Default) 1
4. Contact center supervisor.
02-22-2012 08:49 AM
Thanks for the quick reply.
02-22-2012 08:56 AM
I think maintain a list of numbers is fine with me. We are having only one CSQ.
I am also intrested how the XML scenario works ( can discuss later)
02-22-2012 10:58 AM
I have a couple of options here for you. Let me know if you have any trouble making them work.
String calling_number = ""
java.util.HashMap vip_numbers_map =
{
java.util.HashMap vip_numbers_map = new java.util.HashMap();
vip_numbers_map.put("6125551000", 10);
vip_numbers_map.put("6125552000", 5);
return vip_numbers_map;
}
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
If (vip_numbers_map.containsKey(calling_number))
True
Set Priority (--Triggering Contact--, Assign: (int) vip_numbers_map.get(calling_number))
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.csv
Contents:
6125551000,10
6125552000,5
String calling_number = ""
String[] vip_numbers_array = null
Document vip_numbers_doc = DOC[vip_numbers.csv]
java.util.HashMap vip_numbers_map = new java.util.HashMap()
String vip_numbers_string = ""
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set vip_numbers_string = vip_numbers_doc
Set vip_numbers_array = vip_numbers_string.split("\r\n")
Do {
int i;
int j = vip_numbers_array.length;
String[] vip_number_entry;
for (i = 0; i < j; i++) {
vip_number_entry = vip_numbers_array[i].split(",");
vip_numbers_map.put(vip_number_entry[0], vip_number_entry[1]);
}
}
If (vip_numbers_map.containsKey(calling_number))
True
Set Priority (--Triggering Contact--, Assign: (int) vip_numbers_map.get(calling_number))
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.csv
Contents:
6125551000,10
6125552000,5
String calling_number = ""
String[] vip_numbers_array = null
Document vip_numbers_doc = URL[http://1.1.1.1/uccx/vip_numbers.csv]
java.util.HashMap vip_numbers_map = new java.util.HashMap()
String vip_numbers_string = ""
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set vip_numbers_string = vip_numbers_doc
Set vip_numbers_array = vip_numbers_string.split("\r\n")
Do {
int i;
int j = vip_numbers_array.length;
String[] vip_number_entry;
for (i = 0; i < j; i++) {
vip_number_entry = vip_numbers_array[i].split(",");
vip_numbers_map.put(vip_number_entry[0], vip_number_entry[1]);
}
}
If (vip_numbers_map.containsKey(calling_number))
True
Set Priority (--Triggering Contact--, Assign: (int) vip_numbers_map.get(calling_number))
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.xml
Contents:
6125551000
10
6125552000
5
String calling_number = ""
Document vip_numbers_doc = DOC[vip_numbers.xml]
String xpath_priority = ""
String xpath_result = ""
int vip_priority = 0
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set xpath_priority = "//calling_number[number='" + calling_number + "']/priority"
vip_numbers_doc = Create XML Document (vip_numbers_doc)
xpath_result = Get XML Document Data (vip_numbers_doc, xpath_priority)
If (xpath_result != null && xpath_result.trim() != "")
True
Set vip_priority = Integer.parseInt(xpath_result)
Set Priority (--Triggering Contact--, Assign: vip_priority)
False
/* Leave at default priority of 1 */
End
Filename:
vip_numbers.xml
Contents:
6125551000
10
6125552000
5
String calling_number = ""
Document vip_numbers_doc = URL[http://1.1.1.1/uccx/vip_numbers.xml]
String xpath_priority = ""
String xpath_result = ""
int vip_priority = 0
Start
calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)
Set xpath_priority = "//calling_number[number='" + calling_number + "']/priority"
vip_numbers_doc = Create XML Document (vip_numbers_doc)
xpath_result = Get XML Document Data (vip_numbers_doc, xpath_priority)
If (xpath_result != null && xpath_result.trim() != "")
True
Set vip_priority = Integer.parseInt(xpath_result)
Set Priority (--Triggering Contact--, Assign: vip_priority)
False
/* Leave at default priority of 1 */
End
02-22-2012 11:25 AM
Thanku very much I will try and get back to you.
02-22-2012 03:13 PM
What a great posts Anthony
I was trying to write just 3 or 4-lines in java to deal with java custom methods
only do you recommend me a training course to be good in this part. I mean to be good in calling java methods or to write xml
Regards
Haitham
02-22-2012 07:01 PM
@hythamhadad: I don't have a good answer for you. There's the programming guides for UCCX on cisco.com, and the get into some pretty tricky Java stuff. Maybe just there. The volume 3 gets intense! Thanks for the positive review. Don't forget to rate the posts you find helpful, with the star ratings. Thanks again, and good luck.
02-23-2012 08:09 AM
Dear Anthony,
I have some script writing issue.
1. On Option B how can I add " java.util.HashMap vip_numbers_map = new java.util.HashMap() " variables.
2. In the XML option How the IF statment to added. When I put IF it ends with Then and I cannot add anything under True/
I am really sorry to ask you this, I am not at all a programmer, just learning only.
02-23-2012 09:15 AM
No problem. Let's see if we can work through them.
02-23-2012 12:35 PM
Thank you very much, I manged to finisht script with your help, I will try this on saturday as we have week end now
02-25-2012 05:57 AM
Thank you very much Its help me a lot. It was a great support.
Regards
Toms
02-25-2012 04:13 PM
I'm glad to know you were able to get it working.
I'm also curious to know which option you feel meets your needs the best?
Sent from Cisco Technical Support iPhone App
02-25-2012 10:36 PM
I use the option B with csv in repository, because it is quite easy for updating the numbers as we have more than 100+ priority users. My ultimate goal will be placing the file in the webserver or a shared folder in the network. That is our option C.
I am learning, Thank you for the support
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: