Cisco Unity Connection Messaging Interface (CUMI) API -- Using the CUMI API for Sending Notifications

From DocWiki

Revision as of 07:00, 1 March 2012 by Anilve (Talk | contribs)
Jump to: navigation, search
Back to: CUMI API Overview

Contents


About Notifications

CUMI supports Comet notifications for message operations on the Inbox and Deleted Items folders.


Getting Started

These are the basic steps to get up and running with Comet:

1. Start Jetty: Activate the Connection Jetty service by browsing to the Cisco Unity Connection Serviceability page and selecting Services. Find Connection Jetty in the list and select the Activate button.

2. Request Notifications: Clients need to request notifications so that the Connection server knows it should start publishing Comet events for the current authenticated user:

 $.ajax({ 
 type: "POST", 
 contentType: "application/xml; charset=utf-8", 
 url: "/vmrest/mailbox?method=requestnotification", 
 data: "{}", 
 dataType: "text", 
 success: function(subscriptionId) { 
 gSubscriptionId = subscriptionId; 
 alert("Requested events for mailbox, subscriptionId=" + subscriptionId); 
 } 
 });

This returns a subscriptionId that must be used to get Comet notifications for this user (rather than the userID, for security reasons).

3. Subscribe for events: this is just standard Comet now, but there are a few details to know such as the port and URL to use. Jetty runs on port 7080, and cometd is running at /vmevents/cometd. Here's sample code to initialize and subscribe (in JQuery):

 $.comet.init("http://connection-server:7080/vmevents/cometd"); 
 $.comet.subscribe("/vmrest/mailbox/" + gSubscriptionId, function(e) 
 { 
 alert("Event: " + e.data.EventType ); 
 });


Comet Event Structure

Each Comet event has the following attributes:

DisplayName Display Name of Mailbox
SubscriptionId Subscription ID
USN Message USN
EventTime Time of event
EventType Type of event
MailboxId Mailbox ID
MessageInfo Array of message info objects (see below)


EventType will be one of the following:

EventType Description
NEW_MESSAGE This event is sent when a new message arrives.
OPENED_MESSAGE This event is sent when a message is "touched" (not necessarily marked as read, but accessed by the user in some way).
SAVED_MESSAGE This message is sent when a message is marked read.
UNREAD_MESSAGE This event is sent when a message is marked as unread.
DELETED_MESSAGE This event is sent when a message is deleted.


MessageInfo is an array of one or more objects with the following attributes:

  • MessageId
  • CallerAni
  • MsgType
  • Priority
  • ReceiveTime
  • Sender


Example Comet Event

 { 
 "MessageInfo": [ { 
 "CallerAni": "null", 
 "Sender": "null", 
 "MessageId": "72204bd7-e5c3-446e-adb6-ae5f80db26fb", 
 "ReceiveTime": "04:15:40 PM 10/30/2008", 
 "Priority": "Normal-Priority", 
 "MsgType": "Voice" 
 }], 
 "USN": 2265, 
 "EventTime": "11:15:40 PM 10/30/2008", 
 "SubscriptionId": "00bdcfd3-159a-48d3-ac7b-2f3b4f83db6c", 
 "MailboxId": "abell", 
 "EventType": "SAVED_MESSAGE", 
 "DisplayName": "Alexander Bell"
 }



Back to: CUMI API Overview

Rating: 0.0/5 (0 votes cast)

Personal tools