Cisco Unified Communication Tools

Code Samples

NOTE: Connection 7.1(3) and later has support for administration tasks via a REST based API.  A new developer support site for Connection was put up with the release of 7.1(3) and can be found at the Developer support forums site which has links to resources including support forums and samples related to CUPI/CUMI/CUNI or any of the REST APIs related to Connection.  If you're looking to do a custom application or integrate Connection into your own provisioning system or the like, head over to that site for help.

NEW The CUPI .NET SDK Library can help those using CUPI with .NET desktop applications get productive quickly providing a rapid framework for common tasks such as editing greetings, transfer options, voice names, setting PINs and passwords etc... full source code and training videos provided on the page.

NEW The ODBC .NET SDK Library can help those using ODBC with .NET desktop applciations get productive quickly and easily - this is the same library used by many of the tools provided on this web site. 

With the release of Unity 4.0(2) I've posted most of the example VB 6 projects that show how to administer your  Unity server programmatically directly through the SQL database running underneath Unity.  Some of these tools are offered in versions that work on 4.0(3) and later vs. 4.0(1)/4.0(2) - I've done this since 4.0(3) offers a number of new views and options that allow me to simplify the code quite a bit.  This is part of a larger effort to get a book on Unity out the door that includes, among other things, a chapter on programmatically administering Unity - some of the chapters for this book are slowly showing up over on the Downloads page.  If you're currently running 4.0(1) I strongly recommend you upgrade to 4.0(3) before delving too deep into the programmatic admin examples.  Several of the stored procedures and the off box licensing capability and the like did not work properly in 4.0(1) and are necessary for several of these examples.  Head over the the Links page for information on where to obtain 4.0(3) on line and how to get temporary testing licenses if you need them.

WARNING:  All the code samples out here are offered "as is" and include no warranty or guarantees of any kind.  You use them at your own risk.  TAC will not support you in any efforts along these lines.  We will try and help you out in the Unity forum but it must be stressed that this is not officially supported by TAC or the BU at this point.

All applications are written in VB 6 using SP5 and are designed and tested against Unity 4.0(2) and later.  We will NOT help you out trying to make these work with earlier versions of Unity so please don't ask.  I can assure you, in most cases you will come to ruin tying to do this - many improvements for such support were included in 4.0(2) which is why we're starting there.

HINT: Before you dive into the source code samples for creating, updating and deleting subscribers and all that good stuff, you would do well to read the "Unity Data Object Model" chapter on the  Downloads page (you can filter the download list by a type of "Document" to see only the docs to find it easier) and go snag the latest CUDLE tool which has a built in Unity data dictionary in it which you'll want around when you're puzzling over what various columns in different tables mean.  It also has a complete view of all the stored procedures including their raw source built in which can be very handy when working with these examples and has a built in query builder.

As long as you understand all liability rests with you and you alone, you are free to use all or parts of these code samples for whatever purpose you like.  If you have code samples of your own you'd like to post I'd be more than happy to take a look at what you have and post it if appropriate.  If you have ideas for other samples you'd like to see or improvements to existing ones, or questions about existing ones, please drop a line in the Unity forum.

Generating SA links Code

(added 2/4/2003)

Help File

Application that demonstrates how to construct URLs to jump you right to any given call handler, subscriber, interview handler, name lookup handler, location object, distribution list or restriction table in the Unity SA.  You can also jump to the Subscriber SA page on another Unity server simply by passing in the correct server name.  This can be useful for leveraging the existing SA functionality in your applications easily without having to do all the administration front end yourself.  We've used this technique in dbWalker, Audiotext Manager and Global Subscriber Manager among others.  Very handy.
SQL Sample Queries Code

(Added 2/4/2003)

Help File

Around a dozen sample queries for doing everything from showing all subscribers in a dialing domain to locating all active transfer rules for subscribers on the box to counting up all users associated with each Class of Service in the system quickly.

The source code for this one is provided for style points but really what you want to see is in the help file - the query strings themselves along with short explanations for what they're doing.

Call Handler Information Dump Code

(Updated 3/22/2003)

Help File

Walks through the process of picking out most of the useful information about a call handler you see in the SA and dumping it out to a text box for demonstration purposes.  Shows how to filter out the rows from all the tables for getting at the user input keys, transfer rules, greetings and the like.
Subscriber Information Dump Code

(Updated 3/22/2003)

Help File

Pulls out most of the useful information associated with subscribers  from the UnityDB database that's not included in the above Call Handler Information Dump.  Dealing with notification devices, MWIs, alternate extensions, COS assignments, private lists and the like are covered here.
Remove Subscriber Properties Code

(Added 2/27/2003)

Help File

This is the code for a somewhat simplified version of the "Remove Subscriber Properties" tool currently out here.  It uses the ADSI interface which provides something very similar to using ADO connection to a standard database to navigate around the containers in AD and show users, manipulate properties and the like.  Most notably it shows how to determine if an object in AD is a Unity subscriber or not and to remove those properties such that they are no longer considered a subscriber.
Creating Subscribers From Scratch In AD Code (4.0(3) and later)

(Added 11/4/2003)

Help file

Make new subscribers and leverage the SQLSyncSvr to create new AD/Exchange accounts for you without having to touch anything other than the UnityDB SQL database.  Deals with checking for available licenses, the asynchronous creation model and getting return codes to ensure your creation attempt was successful.

This version of the example code only works on Unity 4.0(3) and later.

Importing Subscribers From AD (4.0(3) and later)

(Added 11/4/2003)

Help file

Import subscribers from users defined in Active Directory - deals with the synch issues, finding users in containers and making sure your import was successful.

This version of the example code only works on Unity 4.0(3) and later.

Modifying Subscribers Code (4.0(3) and later)

(Added 11/4/2003)

Help File

Using stored procedures to update subscriber properties and dealing with synchronizing the data to the directory when necessary by leveraging the SQLSyncSvr service.

NOTE: This is for Unity 4.0(3) and later.

Deleting Subscribers Code

(Updated 11/4/2003)

Help File

Shows how to delete a subscriber without corrupting the database in the process.  Also includes a special bonus feature for you direct-API folks: shows you how to remove the directory and mail accounts associated with a subscriber when you delete the subscriber account - I get this request all the time and we can't do it in the SA for various security reasons but you can do it yourself.

NOTE: This is for Unity 4.0(2) and later

Attaching to Unity Remotely Code

(Updated 3/22/2003)

Help File

Shows how to find all Unity servers on the network and attach to the UnityDB database on one of those servers.  Also includes a technique to get at some basic Unity server data not available in SQL (version info, licensing information, back end configuration etc.). This requires the CUAL setup to have been run on your Unity 4.0(2) server to work properly.

NOTE: For you guys testing this out on 4.0(1) you'll want to upgrade to 4.0(2) and be sure to install CUAL (above) so you can get at the licensing and system  information from off box.

Bridge Log Parsing Code

(Added 2/4/2003)

Help File

Some folks wanted to extend and customize the reports offered by the Bridge Traffic Analyzer so I ripped the parsing engine out and posted the code here.  The help file contains information about the data you'll find in the raw logs and what you'll find in the two tables that end up in the Access 2000 database created by this sample application.  You can either do your own parsing or use my engine and use the resulting tables for your own reports/graphs/tables whatever.
Edit Distribution Lists Code

(Added 10/27/2003)

Help File

This example shows how to create and delete public distribution lists and add members to existing distribution lists as well as push those changes to the Exchange 5.5/2000/2003 directory (AD) back end.

NOTE: This example only works with Unity 4.0(3) and later since the stored procedures used in this example did not exist in earlier versions.  This example also only works with Exchange 5.5/2000/2003 as the back end for  Unity.

TTY WAV Maker

(added 4/1/2004)

This is a simplified version of the TTY WAV Reader (which is, itself, a simplified version of TTY Angel).  This includes all the details you'll need to take text and convert it into a WAV file that will play on just about any TTY/TDD device we've tested.  I ripped out all the Unity specific stuff, logging, the help engine, localization and all that good stuff and got it down to the bare bones.  It takes a text string you give it and converts it into a WAV file.  That's about it.  You should be able to take this and do whatever you need with it.

There's nothing proprietary in here - it's all just simple WAV file construction.  Sorry, but I can't post code that shows how to go from a TTY WAV message back to text - that includes some Cisco proprietary tone recognition logic that I can't give away.

Send Voice Mail via CDO

(added 6/29/2004

Help File

This example shows how to create a new email with a WAV attachment and then set the extended MAPI properties on the message and attachment that allow Unity (both the phone conversation and the VMO forms) to treat it as a voice mail message.