Tag Archives: Unity

Command-line mailbox downloader for Cisco Unity Connection

Starting in version 8 of Cisco Unity Connection, it is simple to write scripts to manipulate various aspects of Unity Connection, including user attributes (password/PIN, for example), messages, call handlers, and more, thanks to a new REST API. There are interfaces to both administrative and end-user functions. And not only scripts, but custom web portals or other web integrations. No SOAP and AXL required!

See Cisco’s DocWiki for the details: http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_APIs
And read the rest of this entry for a simple PHP script that connects to a user’s mailbox, dumps all the contents to a local folder, writes out a table of contents and gzips the whole thing up.
#!/usr/bin/php <?php if ($argc !== 3) {   fwrite(STDERR, "Usage: n");   fwrite(STDERR, "  php $argv[0] <mailbox> <password>n");   exit(1); } /* Web connection setup */ $baseURL = "https://YOUR-UCONN-SERVER-HERE:8443"; $auth = base64_encode("$argv[1]:$argv[2]"); $opts = array( 'http' => array ('method' => 'GET',                                 'timeout' => 4,                                 'header' => "Authorization: Basic $auth"),                'ssl' =>  array ('allow_self_signed' => TRUE)              ); $context = stream_context_create($opts); /* Get the user's folders list and counts */ $foldersURL = "$baseURL/vmrest/mailbox/folders"; if (!($result = file_get_contents($foldersURL, false, $context))) {   fwrite(STDERR, "Could not connect to Unity Connection for mailbox folders list.n");   exit(1); } $folders = simplexml_load_string($result); /* Now get contents of each mailbox that has messages */ $currtime = datestring(time()); $outputdir = $argv[1] . "_$currtime"; if (!mkdir($outputdir)) {   fwrite(STDERR, "Couldn't create directory $outputdirn");   exit(1); } $INDEX = fopen("$outputdir/index.txt", 'w'); $mainheader = "Mailbox of $argv[1] downloaded at $currtime"; fwrite($INDEX, "$mainheadern" . sprintf("%'=" . strlen($mainheader) . "snn", "")); foreach ($folders as $folder) {   if ($folder->MessageCount > 0) {     $folderheader = "Folder: $folder->DisplayName";     fwrite($INDEX, "$folderheadern" . sprintf("%'-" . strlen($folderheader) . "snn", ""));     $messagedir = $outputdir . "/" . $folder->DisplayName;     mkdir($messagedir);     $result = file_get_contents($baseURL . $folder->URI . "/messages", false, $context);     $xml = simplexml_load_string($result);     $counter = 1;     foreach ($xml->Message as $message) {       fwrite($INDEX, "$counter. Message from ". ($message->CallerId->CallerName == ""?"(no name listed)":$message->CallerId->CallerName));       fwrite($INDEX, " at " . ($message->CallerId->CallerNumber == ""?"(no number listed)":$message->CallerId->CallerNumber));       fwrite($INDEX, "n");       fwrite($INDEX, "Listened: " . $message->Read . "n");       fwrite($INDEX, "Length: " . $message->Duration/1000 . " secondsn");       fwrite($INDEX, "Timestamp:" . datestring($message->ArrivalTime/1000) . "n");       fwrite($INDEX, "Filename: ");       $filename = datestring($message->ArrivalTime/1000) . "_from_" . $message->CallerId->CallerNumber . ".wav";       fwrite($INDEX, "$filenamenn");       $innerResult = file_get_contents($baseURL . $message->URI, false, $context);       $messageContainer = simplexml_load_string($innerResult);       $audio = file_get_contents($baseURL . $messageContainer->Attachments->Attachment->URI, false, $context);       if (!file_put_contents("$messagedir/$filename", $audio, LOCK_EX))         fwrite(STDERR, "Error writing audio to file: $filenamen");       $counter++;     }     fwrite($INDEX, "n");   } } fclose($INDEX); $tarresult = system("tar czf $outputdir.tar.gz $outputdir"); if ($tarresult !== FALSE) {   system("rm -rf $outputdir"); } else {   fwrite(STDERR, "Unable to create tar.gz file, but the folder is still there.n"); } fwrite(STDERR, "Mailbox dump completed successfully.n"); exit(0); function datestring ($unixtime) {   return date('Y-m-d_H-i-s', $unixtime); } ?>

What may drive opening the Unity Connection web interface

At this week’s meeting of the PSU VoIP tech folks, we had a short review of the Unity Connection upgrade from a couple weeks ago and discussed getting to the next version, 8.x, where we will have the ability (though not the scripting and configuration, yet) to open the web interface to end users.

I think the primary feature of interest to end users on the web interface will be the visual voicemail, called Unity Connection Inbox. But what may drive getting the web interface up and running, at first, will be the ability for end users to change their own PIN.

Very roughly speaking, from some stats I received a few weeks ago, our NOC gets about 1,000 voicemail PIN resets a year. They account for 18% of all voice-related tickets and 11,000 minutes of staff time.

With the web interface, voicemail users could log in with other credentials they know and use daily–their single sign-on access accounts–and reset their voicemail PIN. The concept is simple but the implementation, at least in our environment, may not be.

PSU voicemail upgrade – Unity Connection 7

This Friday, the University Park VoIP voicemail system, currently Cisco Unity 4.0.5, will be upgraded–migrated, actually–to Unity Connection 7. A number of us received training on this last fall, and we are eager to move ahead to the new system.

In terms of features, this is a one-for-one migration–no features lost, and no features added at the time of the upgrade. We have been running Unity in voice-mail-only (VMO) mode, where an Exchange mail system acts as the voice mail storage facility and nothing more–no e-mail integration, web access, or other Exchange features. Connection is designed for the VMO-type deployment, so while the feature set remains the same, we are gaining a lot with this upgrade, administratively:

  • no more Exchange
  • no more domain management to support an isolated Exchange
  • no more Microsoft patching for the above
  • two messaging servers rather than two (Unity) + two (DC) + two (Exchange) = six
  • Cisco Linux platform, including the better Disaster Recovery System (DRS) and upgrade/patch deployment

And lastly, this gets PSU un-stuck from 2004 and able to move ahead more easily as new versions or features come along.

Coworkers Chris (who needs to update his blog) and Sean are the ones making this happen. Huge thanks, guys.

Going beyond the straight migration of this weekend, what’s next? I wrote about some end-user web features we saw in training:

End-user Web Features
  • Unity assistant – per-user settings manager, like Communications Manager User Options site
  • Unity inbox – view, listen to, forward, reply, etc. to voice messages. Play messages through the web browser or download to PC.

I believe that with some reconfiguration on the back end having to do with the way accounts are keyed (need some affiliation with the PSU access account ID), a proxy written similar to what we did with Call Manager 6, and some gentle but consistent pressure from users for such useful features, we could enable the two listed above. And in time, and depending on where University e-mail is headed presently, we may even be able to deposit voicemail in people’s e-mail boxes. (NOTE: this is my wishlist and not a statement that these things are planned or that I am even working on them… but I’d like to.)

Training: Unity Connection 7.x day 2

Directory Integration Options

  • Stand-alone (no integration)
  • Communications Manager’s directory (uses AXL)
  • MS Active Directory
  • Unofficially… looks like it could be connected to other LDAP directories
  • LDAP can be used for authentication

Monitoring:  SNMP; nothing new there really.

Backup/Restore:  no more awful Exchange backups, of course.  Selective restore available if we wanted to restore individual users.
COBRAS migrates from Unity to Unity Connection:  users, settings, mailbox contents, handlers.  Cisco is continually improving this migration tool.  Export from Unity is simple; importing that data to Connection may involve a lot of resolution conflict.  Start with a clean Unity system for less importing pain.  
End-user Web Features
  • Unity assistant – per-user settings manager, like Communications Manager User Options site
  • Unity inbox – view, listen to, forward, reply, etc. to voice messages.  Play messages through the web browser or download to PC.  
  • Call transfer rules – set up your own auto-attendant.  Looks like a support nightmare.

For the ITS VoIP and voicemail offering, we could potentially proxy these web features like we currently do Communications Manager User Options.  The first two features in the list above could be really useful.  

Training: Implementing Cisco Unity Connection 7.x

Day 1 of 4. What’s Cisco Unity Connection all about?

  • Unity for those who don’t want MS Exchange integration
  • Cisco’s current (Linux-based) platform.  No Windows components for Connection 7.x
  • Hot redundancy/load balancing rather than failover
  • Modern features:  e-mail delivery of VM, visual voicemail, more
  • Calling search space/partitioning allows functional segmenting of the voice mail system

Licensing

  • Workspace licensing.  Per-phone cost is “slightly more” (instructor’s words) than just phone licensing (a la carte) for use on Comms. Manager.  Avoiding WSL will probably cost more in the long run.

PBX Integration

  • CUCM (Skinny), SIP trunk to any SIP system, PIMG for Avaya/Nortel systems
  • Multiple integrations to same Unity system.  Several phone systems could participate in same Unity–CUCM, OpenSER, Avaya, CUCM over SIP trunk…

Installation


  • Identical to current Communications Manager installation
  • Connection is pre-configured to start most services by default, unlike CUCM which has most turned off by default
  • Use Realtime Monitoring Tool for server/cluster analysis, diagnostics, troubleshooting, stats

Administration looks like a familiar mix of Communications Manager 6.x screens and Unity 4.x screens.  Finishing off the day by setting up the lab.

What happened last week?

I picked a good week to go on vacation.

VoIP users–specifically, Unity voicemail subscribers–at Penn State received e-mail notices from Saturday the 18th through Tuesday the 21st that voicemail services were unavailable. Here’s some more technical information as to what happened.

Unity uses Microsoft Exchange as its back-end message store. PSU’s configuration of Unity is voice-mail-only (VMO), meaning that the Exchange part of the system is completely hidden from and inaccessible to the user. (A more popular configuration of Cisco Unity is unified messaging (UM), where Unity is integrated with a company’s Exchange mail system; users see both e-mail and voicemail (as attached sound files) in their Outlook inbox, and can also manipulate both voicemail and e-mail through the telephone interface.) When the Exchange message store goes offline, callers can still leave voicemail, but it doesn’t get delivered to a subscriber’s voicemail box until Exchange is up and running again. Last weekend, one of the two Exchange servers that serve Unity experienced a full mailstore disk, leading to some corruption of the Exchange database which, I’m told, took a while to repair. Subscribers whose boxes were on that particular server wouldn’t have had access to them during the repair time. But one of the great features of Unity is that it stored those new incoming messages until that Exchange server was back up, at which time all the new messages were delivered. No messages were lost.