Cisco Unified Communication Tools |
Version | 3.0.3 |
Last Update | 1/8/2014 |
Statistics | Requires Visual Studio 2010 or later and the .NET 4.0 framework and a Connection server capable of serving up ODBC functionality. |
Compatibility | Unity Connection 7.0(1) or later. |
Support | NOT TAC supported - support is through the developer forus, the links page has details. Any tools created using ODBC are not going to be supported by TAC (i.e. they can't help you with your data schema problems or Informix driver questions - you need to go to the forum for that). |
The ODBC .NET SDK wraps the ODBC access for Unity Connection and provides simple and helpful helper methods for doing everything you'd need to with Connection via ODBC. This is the same version of the library used in many of the tools available on this site.
The SDK can now be included in your projects via NuGet. Simply search on "Cisco.UnityConnection.OdbcSdk" 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.
PDF Version (this is nicer to use given the bookmarks can be used for content navigation more easily)
Building a C# Console App with the SDK step-by-step (25 minutes)
Code from the above sample if you don't like typing:
using System;
using System.Data;
using Cisco.UnityConnection.OdbcSdk;
namespace ODBCConsoleApp
{
class Program
{
private static UnityConnectionServerOdbcSdk _cxn;
static void Main()
{
_cxn=new UnityConnectionServerOdbcSdk("ODBCCoinsoleApp");
try
{
Console.WriteLine("Logging in...");
_cxn.LoginDatabaseBlocking("10.86.129.23",
"CCMAdministrator", "ecsbulab");
}
catch (Exception ex)
{
Console.WriteLine($"Failed logging into server: {ex}");
Console.ReadLine();
return;
}
Console.WriteLine($"Logged into {_cxn.DatabaseServerName},
ver={_cxn.UnityVersionString}");
DbFetchResult res = _cxn.FillDataReaderInformix("SELECT Alias
from vw_user", out var oDataReader);
if (!res.Successful)
{
Console.WriteLine("Failed fetching user
aliases:"+res.ErrorDetails);
Console.ReadLine();
return;
}
while (oDataReader.Read())
{
Console.WriteLine($"{oDataReader[0]} roles:");
string strSql = "SELECT vw_Role.RoleName " +
"FROM vw_Role, vw_user, vw_policy " +
"WHERE vw_role.ObjectId = vw_policy.RoleObjectId " +
"AND vw_policy.UserObjectId = vw_user.objectid "
+
"AND vw_user.Alias = ?";
res = _cxn.FillDataTableBlocking(strSql, out var oTable,
false, oDataReader[0]);
if (!res.Successful)
{
Console.WriteLine("Failed fetching role
names:"+res.ErrorDetails);
}
else
{
foreach (DataRow oRow in oTable.Rows)
{
Console.WriteLine($"
{oRow[0]}");
}
}
}
oDataReader.Dispose();
Console.WriteLine();
Console.WriteLine("Complete.");
Console.ReadLine();
}
}
}
The following are some highlights of the types of things you can do with the ODBC wrapper library - the project code has more extensive examples in the CLI sample program and the unit tests included with it.
//attach to
Connection server via ODBC
UnityConnectionServerOdbcSdk server = new
UnityConnectionServerOdbcSdk ("TestApplication");
var res= server.LoginDatabaseBlocking ("192.168.0.197", "dbdude",
"labPw");
if (res.Successful == false)
{
Console.WriteLine("Failed to log in:"+res);
return;
}
Console.WriteLine("Logged into:" + server);
const string strSql = "SELECT Alias, ObjectId
FROM vw_subscriber";
IfxDataReader oReader;
res = server.FillDataReaderInformix(strSql,out oReader);
if (res.Successful == false)
{
Console.WriteLine("Fetch failed:"+res);
return;
}
while (oReader.Read())
{
Console.WriteLine("Alias="+oReader["alias"]);
}
oReader.Dispose();
//fetch a single
user's data to a table
DataTable oTable;
const string strSql = "SELECT Alias, ObjectId FROM vw_Subscriber
WHERE " +
"fn_tolower(city)=? AND isVmEnrolled=?";
res = server.FillDataTableBlocking(strSql, out oTable, false,
"seattle",true);
if (!res.Successful)
{
Console.WriteLine("Fetch failed:"+res);
return;
}
Console.WriteLine("Seattle users:");
foreach (DataRow oRow in oTable.Rows)
{
Console.WriteLine("Alias="+oRow["Alias"]);
}
const string strSql = "SELECT COUNT(*) FROM
vw_Subscriber WHERE ListInDirectory=?";
int iCount = server.GetCount(strSql,true);
Console.WriteLine("Directory list count="+iCount);
//create a new subscriber
_connectionServer.StartNewCommand("csp_SubscriberCreate");
_connectionServer.AddCommandParam("pTemplateAlias", IfxType.VarChar,
"voicemailusertemplate");
_connectionServer.AddCommandParam("pAlias",IfxType.VarChar,"jsmith" );
_connectionServer.AddCommandParam("pDtmfAccessId", IfxType.VarChar, "1234");
//call the proc execute with an output string - this calls it as a
"function" proc that
//expects a return.
string strNewObjectId;
DbFetchResult res = _connectionServer.ExecuteProc(out strNewObjectId,"pObjectId");
if (res.Successful == false)
{
Logger.Log("(error) failed to create new subscriber:"+res);
return;
}
Logger.Log("User created, new ObjectId=" + strNewObjectId);