Cisco Unified Communication Tools

CUPI For Users Java Wrapper Library

Version   1.0.1 BETA VERSION
Last Update   7/18/2013
Statistics   Requires Connection server capable of serving up CUPI functionality.  The library was built against Connection 10.0, however most functions will work for older versions as well. 
Compatibility   Unity Connection 8.5.1 or later for all functionality.
Support   NOT TAC supported
Related CUPI For Users .NET Wrapper Library provides access to user settings and messages for .NET applications.

Connection Notification SDK for .NET  provides access to getting events on mailbox status updates at the server level

REST for Admins .NET SDK. wraps much of the administrator API (CUPI) interface, much of the CUMI (for messages) and CUTI (for using the phone as a recording device) is also included. 

CUPI For Users is designed to allow for applications that need to get at user's voice mail settings (greetings, voice names, private lists, transfer options) and voice messages using the credentials of an individual user (i.e. the user authenticates as themselves). 

Developers Guide

PDF Version

Training Videos

Getting started with the Connection CUPI For Users Library:  Adding the library to your project, attaching to Connection, getting version information, fetching user, greeting, private list and other data as well as reviewing messages. CUPI For Users Java library intro - 40 Minutes

The library itself can be fetched using a SubVersion client pointed to the public repository here:

https://xp-dev.com/svn/JavaRestSdk

Username:  javaguest

Passwrd:     ecsbulab

Usage Samples

The following are some highlights of the types of things you can do with the CUPI for Users wrapper library - the project code has more extensive examples and the developers guide above covers more scenarios in more detail.

Logging into Connection

//Create connection server object.
ConnectionServer server = null;
try{
    server = new ConnectionServer("test.cisco.com", "user", "UserPassword");
}
catch(Exception ex){
    //error handling code
}

//Validate connection version
if (!server.isVersionAtLeast(9,1,0))
{
    log.info("Version of 9.1.0 or later is required, current version is " + server.getVersion());
    return;
}
else{
    log.info("Version is fine::" + server.getVersion());
}

Getting Logged In User Info

  //Fetch user information
User user = User.getUser(server);
if(user.getWebCallResult().isSuccess()){
    user.dumpAllProperties("-->");
}
else{
    log.info("Failed::" + user.getWebCallResult());
}

Get and Set User Voice Name

WebCallResult res = user.getVoiceName("C:/test/server_file.wav");

WebCallResult res = user.updateVoiceName("C:/test/local_file.wav");

Reset User PIN and Password

WebCallResult res = user.resetPin(“123456”);

WebCallResult res = user.resetPassword(“oldpassword”, “newpassword”);

Fetch and Disable Alternate Transfer Option

TransferOption opt = user.get TransferOption (TransferOptionType.ALTERNATE.value()); if(opt.getWebCallResult().isSuccess()){
    opt.dumpAllProperties("-->");
}
else{
    opt.getWebCallResult().dumpAllProperties("-->");
}

//Disable transfer option
WebCallResult res = opt.disable();

Showing All Alternate Extensions

//Fetch all alternate devices for the user using member function in user construct
AlternateDevices devices = user.getAlternateDevices();

//Traverse through the fetched devices
List<AlternateDevice> deviceList = devices.getAlternateDevice();
for(AlternateDevice device : deviceList){
    log.info(device);
}

Adding and Removing an Alternate Extension

WebCallResult res = user.createAlternateDevice("12345", null);
String objectId = res.getObjectId();

//Create and fetch details of an alternate device simultaneously
AlternateDevice device = user.createAndFetchAlternateDevice("4358595", null);

//Delete the device
WebCallResult result = AlternateDevice.deleteAlternateDevice(server, objectId);

Enabling and Disabling a Greeting

Greeting g = user.getGreeting(GreetingType.ALTERNATE.value()); if(g.getWebCallResult().isSuccess()){
    g.dumpAllProperties("-->");
}
else{
    g.getWebCallResult().dumpAllProperties("-->");
}

//Disable greeting
WebCallResult res = g.disable();

//Update greeting recording using a local file
WebCallResult res = greeting.updateRecording(LanguageCodes.EnglishUnitedStates.value(), “C:/greeting_recording_server.wav”);

Updating a Greeting for a User from a Local WAV File

 //get just the alternate greeting
Greeting oGreeting;
res = Greeting.GetGreeting(oServer, GreetingTypes.Alternate.ToString(), out oGreeting);

//you can pass the language code directly as 1033 (for US English) or you can use the
//LanguageCodes class and cast it to an int to make your code a little more readable

res=oGreeting.SetGreetingWavFile((int) LanguageCodes.EnglishUnitedStates, @"c:\MyNewGreeting.wav");

Fetching and Listing Messages

//Fetch unread-urgent voice messages for the user in descending order of arrival time, means starting with the newest.
MessageOptions opt = new MessageOptions();
opt.setPriority(PriorityType.URGENT);
opt.setRead(false);
opt.setType(MessageType.VOICE);
opt.setSortType(MessageSortType.SORT_NEW_FIRST);
int maxMessagesPerPage = 5;
int pageNumber = 1;
Messages msgList = user.getMessages(FolderType.INBOX.value(), maxMessagesPerPage, pageNumber, opt);

//Page through results showing message details for each message

boolean isNext = false;
int pageNumber = 1;
int messagesPerPage = 2;
do{
    Messages list = user.getMessages(FolderType.INBOX.value(), messagesPerPage, pageNumber);
    WebCallResult res = list.getWebCallResult();
    PagingData data = res.getPagingdata();
    if(data.getNextPage() != -1){
        isNext = true;
        pageNumber = data.getNextPage();
    }
    else{
        isNext = false;
    }
    System.out.println("Displaying messages::(" + data.getStartIndex() + " - " + data.getEndIndex() + ") of " + data.getTotalRecords());
    for(Message msg : list.getMessage()){
        System.out.println(msg);
    }
    System.out.println();
}while(isNext);

//Produces output that would look like this:

Displaying messages::(1 - 2) of 6
[Subject=Test Mail] [From=test] [Duration=15.34s] [Type=VOICE]
[Subject=Test Mail_1] [From=test] [Duration=15.34s] [Type=VOICE]

Displaying messages::(3 - 4) of 6
[Subject=Test Mail_2] [From=test] [Duration=15.34s] [Type=VOICE]
[Subject=Test Mail_3] [From=test] [Duration=15.34s] [Type=VOICE]

Displaying messages::(5 - 6) of 6
[Subject=Test Mail_4] [From=test] [Duration=15.34s] [Type=VOICE]
[Subject=Test Mail_5] [From=test] [Duration=15.34s] [Type=VOICE]