Cisco Unified Communication Tools |
Version | 3.0.58 |
Last Update | 10/20/2016 |
Statistics | Requires Visual Studio 2010 or later and the .NET 4.5 framework and a Connection server capable of serving up CUPI, CUMI and CUTI functionality. The library was built against Connection 9.1, however most functions will work for older versions as well. |
Compatibility | Unity Connection 8.5.1 or later for all functionality. 8.6 or later is reccomended |
Support | NOT TAC supported - support is through the developer forus, the links page has details. |
Related |
REST for Users .NET SDK
provides user level access to messages and user settings CUPI For Users Java Wrapper Library provides access to user settings and messages for Java applications. Connection Notification SDK for .NET provides access to getting events on mailbox status updates at the server level |
The REST .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. Helpers for handling media uploads/downloads as well as vastly simplifying the authentication framework in Connection 10.0 and later will save you much code and time in your projects that use the Unity Connection REST interfaces for provisioning. This is the same framework used in all REST based tools founs on this site.
The SDK can now be included in your projects via NuGet. Simply search on "Cisco.UnityConnection.RestSdk" and include it in your project! In 60 seconds you can be up and attached to your Connection server and being productive. Couldn't be easier. If you prefer to include the project code "old school" in your application the SubVersion repository details can be found below.
PDF Version (this is nicer to use given the bookmarks can be used for content navigation more easily)
Getting started with the Rest SDK class library, the new way with NuGet! Adding the libary to your project, attaching to Connection, getting version information and creating a new user. | CUPI .NET NuGet Intro - 8 minutes |
Getting started with the Rest SDK class library, the old way: Adding the library to your project, attaching to Connection, getting version information, finding a user, listing various user properties. | CUPI .NET library intro - 17 mintes - |
Basic adds/changes/deletes: Add a new user, updating properties on the user, delete them in a few different ways. | CUPI CRUD with .NET Library - 26 minutes |
Using Fiddler for viewing HTTP traffic: Quick intro to using Fiddler to watch HTTP/S traffice going into and out of your development platform so you can see what's happening with the various Connection REST interfaces. | Using Fiddler - 6 minutes |
The library itself can be fetched using a SubVersion client pointed to the public repository here: https://xp-dev.com/svn/ConnectionRestSdk
This is a read only public repository - there is no login or password necessary to download it. The repository includes both the ConnectionCUPIFunctions library itself as well as a small Windows forms application used as a test harness called CUPIFastStart that you can use to explore the capabilities of the library as well as an even smaller test library called CUPIVerySimple which is a bare bones CLI application that also uses the CUPIFunctions library.
Software License Details. You can use this project in commercial and personal products free of charge so long as you are developing against a licensed Cisco Unity Connection server. The SDK, however, is not open source (i.e. you cannot commit customizations to the library you've made back into the project). If you find a problem or have a suggestion, however, I would love to hear of it and may add it to the library. Details of the Cisco Software license can be see here.
The following are some highlights of the types of things you can do with the CUPI wrapper library - the project code has more extensive examples in the CLI sample program and the unit tests included with it.
NOTE: Error handling and logging have been stripped out of these examples to keep the code clear and simple. Copy and paste these into a production application at your peril!
oServer = new
ConnectionServer("192.168.0.198", "jlindborg", "ecsbulab");
Console.WriteLine("Logged into: " + oServer.ToString());
if (oServer.Version.IsVersionAtLeast(8,6,2,0)==false)
{
Console.WriteLine("Version of Connection={0} and 8.6.2 or
later is required",oServer.Version);
}
WebCallResult res;
UserBase oUser;
res = UserBase.GetUser(out oUser, oServer,"" , "testuser");
if (res.Success==false)
{
Console.WriteLine("Error fetching testuser:"+res.ToString());
}
//dumps out the user alias, display name
and primary extension
Console.WriteLine(oUser.ToString());
//dumps out all properties on the user
object
Console.WriteLine(oUser.DumpAllProps());
oUser.ResetPin("112233");
ScheduleState oState;
oState = oUser.PrimaryCallHandler().GetScheduleSet().GetScheduleState(DateTime.Now);
//will output "ACTIVE", "INACTIVE" or "HOLIDAY" depending on what the schedule details the user is assigned
Console.Writeline("Current schedule state for user="+oState.ToString());
//will output all the schedule detail items for all schedules (both regular and holiday) that the user is associated with.
foreach
(Schedule oSchedule in
oUser.PrimaryCallHandler().GetScheduleSet().Schedules())
{
Console.WriteLine("Schedule Name="+oSchedule.DisplayName);
foreach (ScheduleDetail oDetail in
oSchedule.ScheduleDetails())
{
Console.WriteLine("Details in
schedule:");
Console.WriteLine(oDetail.DumpAllProps(" "));
}
}
List<AlternateExtension>
oAlternateExtensions;
oAlternateExtensions = oUser.AlternateExtensions()
//output all alternate extensions - what's
returned will depend on the user's COS
//settings - admin added alternate extensions may or may not be
included.
foreach (AlternateExtension oTempExt in oAlternateExtensions)
{
Console.WriteLine(oTempExt.ToString());
}
//Adding an
alternate extension can be restricted by the user's class of service
so expect that this
//call can fail.
AlternateExtension oAltExt;
res = AlternateExtension.AddAlternateExtension(_connectionServer,
oUser.ObjectId, 3, "1234",out oAltExt);
if (res.Success)
{
Console.WriteLine(oAltExt.DumpAllProps());
//delete the alternate
extension you just added.
res = oAltExt.Delete();
}
//get all
greetings for a user - this should always get all 7 greetings
List<Greeting> oGreetings;
oGreetings = oUser.PrimaryCallHandler().GetGreetings();
foreach (Greeting oTempGreeting in oGreetings)
{
//outputs the greeting type, if its
enabled and what it's set to play
Console.WriteLine(oTempGreeting.ToString());
}
//get just
the alternate greeting using the static method off the Greetings
class instead
Greeting oGreeting;
res = Greeting.GetGreeting(oServer,
oUser.PrimaryCallHandler().ObjectId, GreetingTypes.Alternate.ToString(), out oGreeting);
//this is how you would update the enabled
status of the greeting. This enables the
//alternate greeting for 24 hours
res=oGreeting.UpdateGreetingEnabledStatus(true,
DateTime.Now.AddDays(1));
//This disables the
greeting. If you try this on the standard or error greetings it will
//fail since disabling those greetings is illegal
res = oGreeting.UpdateGreetingEnabledStatus(false);
//get just
the alternate greeting
Greeting oGreeting;
res = Greeting.GetGreeting(oServer,
oUser.PrimaryCallHandler().ObjectId, GreetingTypes.Alternate.ToString(), out oGreeting);
//get the greeting streams defined for the
alternate greeting
List<GreetingStreamFile> oStreamFiles;
oStreamFiles = oGreeting.GetGreetingStreamFiles();
//if there are no custom recordings in any
language for this greeting the stream files returned
//will be null
if (oStreamFiles != null)
{
Console.WriteLine(oStreamFiles.Count.ToString());
//for each language wav
file found for the greeting, save it off as a uniquely
//names wav file using a new GUID
foreach (GreetingStreamFile oStream in
oStreamFiles)
{
res=oStream.GetGreetingWAVFile(string.Format(@"c:\tempfolder\{0}.wav",
Guid.NewGuid()));
}
}
//get just
the alternate greeting
Greeting oGreeting;
res = Greeting.GetGreeting(oServer,
oUser.PrimaryCallHandler().ObjectId,
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");
//use
telephone as media device - establish a connection to extension 1003
PhoneRecording oPhone;
oPhone = new PhoneRecording(oServer,"1003");
//record a new stream
res = oPhone.RecordStreamFile();
//play the stream we just recorded for
confirmation
res=oPhone.PlayStreamFile();
//get just the off hours greeting
Greeting oOffHoursGreeting;
res = Greeting.GetGreeting(oServer,
oUser.PrimaryCallHandler().ObjectId, GreetingTypes.OffHours.ToString(), out oOffHoursGreeting);
//set it's US English recording to the
recording we just made
res=oOffHoursGreeting.SetGreetingRecordingToStreamFile((int)LanguageCodes.EnglishUnitedStates,
oPhone.RecordingResourceId);
//get all the
user's transfer option
List<TransferOption> oTransferOptions;
oTransferOptions = oUser.PrimaryCallHandler().GetTransferOptions();
foreach (TransferOption oTempOption in oTransferOptions)
{
//outputs the transfer
type, if its enabled and what it's action is
Console.WriteLine(oTempOption.ToString());
}
//get just
the alternate transfer option
TransferOption oAltOption;
res = TransferOption.GetTransferOption(oServer,
oUser.PrimaryCallHandler().ObjectId, TransferOptionTypes.Alternate.ToString(), out oAltOption);
//update the transfer option to be enabled
indefinitely.
oAltOption.UpdateTransferOptionEnabledStatus(true);
//set the transfer option to ring the
phone for x1234 5 times and not play the "please wait while
//I transfer your call" prompt.
oAltOption.Extension = "1234";
oAltOption.PlayTransferPrompt = false;
oAltOption.TransferRings = 5;
oAltOption.Action = (int)TransferActionTypes.Transfer;
//apply the changes to the option
res = oAltOption.Update();