cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2126
Views
5
Helpful
10
Replies

First and Last Name - Script

How can i extract first and last name of calling user once call lands on UCCX system. Our requirement is to get First name and last name of calling user and pass it to other application. I tried to use Get User field but it says- User ID is blank.

 

10 Replies 10

tom.miller1
Level 1
Level 1

Take it that these are from internal calls where you have an End user in call manager?

 

If so you might need to do a lookup of sorts

 

dir_url String "http://xxx:8080/ccmcip/xmldirectorylist.jsp?n="  

Where xxx is your PUB 

calling_number String ""  

 

xml Document null  

 

calling_number = Get Call Contact Info (--Triggering Contact--, Calling Number)

XML = Create XML Document (URL[dir_url + calling_number])

calling_name = Get XML Document Data (xml, "//DirectoryEntry/Name")

Set Enterprise Call Info (--Trigger Contact--) Variables Used:calling_name,calling_number)

 

Hope this helps

Thanks Tom. It seems that as output, we are receiving full name but we need first name and last name in separate variable. Is there option in xml directory to use first name as variable ?

Hmm

 

Not that I can think of off the top of my head, I did some digging and I am a bit stuck to come up a solution for that requirement as well. 

 

Maybe someone else here could advise, have to admit I am curious if that is possible as well now.

You have a few issues in your logic.  First you will receive a "best match" of 32 directory entries from the CUCM directory if there is no explicit match on your directory number query.  If none of them match, your next Get XML step will fail, because it is returning a "null" response. 

Once you do have a matching response, you can parse the XML data from the array string using a Java .split().

I will try to attach the working code (not sure if the website will allow .aef attachments... but I will try.)

This is a working script, you just need to provide the inputs of your CUCM IP address and the ANI (calling number) you wish to query in the directory.

Sincerely,

Sean

2018-0820-uccxCallerName-solved.png

Hello Sean, Thanks for your help ,its worked  by  inputs of  Caller ANI (calling number) at script ..

 

seeking a help, script ANI calling number input its own to  display "name" ? 

Working NOW..

Mike_Brezicky
Cisco Employee
Cisco Employee

This is all I do - it pulls the calling name from the phone.

 

Set callingParty = {
java.lang.reflect.Field ciscoCallField = contact.getClass().getDeclaredField("ciscoCall");
ciscoCallField.setAccessible(true);
com.cisco.jtapi.extensions.CiscoCall ciscoCall = (com.cisco.jtapi.extensions.CiscoCall)ciscoCallField.get(contact);
return ciscoCall.getCurrentCallingPartyDisplayName();
}

 

Then under Select Resource, set enterprise call info and assign callingParty to a callvariable.

 

Internal calls are 100% reliable, but external of course rely on the carrier information that was sent.

...the requirement was to be able to separate the First and Last name from the directory displayed name, in separate variables. Did you see that part?

:-)

Sean Lynch
Level 7
Level 7

...I had some fun working with this, and created a script with some error handling for missing first name (last name is required for a directory entry, but first name is not--which produces a "null" error when trying to extract XML data from an empty set), multiple entries found (you will need to add your own logic for what to do when there is more than one user with the same dialed number), etc.

Use the interactive debugger to see what works for your requirements.

2018-0905-RetrieveFirstAndLastNm2.PNG

 

Enjoy!

Jrod Alley
Level 1
Level 1

I realize we are a few years removed from the last response. Hoping someone can shed some light on a variation of the above request. Our Numbers are formatted as "+1 555-555-5555" obviously the space is causing the problems with the query. Is there anyway to search for "Best Match"? thinking through the logic of the script...

Capture ANI

 Trim ANI to a variable that only includes the "555-555-5555"

Insert said variable at the end of the xmldirectory url with a wildcard variable (If one exists)

 

Anyone have any recommendations or thoughts on this?