No part of this document may be reproduced or transmitted in any form or by any means, electronic or
mechanical, for any purpose, without the express written permission of Polycom, Inc. Under the law,
reproducing includes translating into another language or format.
As between the parties, Polycom, Inc. retains title to, and ownership of, all proprietary rights with respect
to the software contained within its products. The software is protected by United States copyright laws
and international treaty provision. Therefore, you must treat the software like any other copyrighted
material (e.g. a book or sound recording).
Every effort has been made to ensure that the information in this manual is accurate. Polycom, Inc. is not
responsible for printing or clerical errors. Information in this document is subject to change without notice.
This introduction provides a brief overview of the ReadiVoice CAPI Developer’s
Guide, describes the conventions used in this manual, and explains how to get
additional information or support.
Purpose
This manual is for developers of a conferencing application. It includes
information about:
•CAPI architecture and process flow
•Writing new conferencing applications using CAPI
•Migrating MAPI applications to the new CAPI
•CAPI events
CAPI applications interact with the ReadiVoice system. To write applications
using CAPI, you need to understand a ReadiVoice CAPI system, its access
type options, its conferencing features and options, and how provisioners,
operators, and other users use the system. We recommend that you review the
information in the following documents:
•Read
•Re
•Re
•Re
iVoice Provisioning Guide
adiVoice Operator Guide
adiVoice Subscriber Guide
adiVoice Administration and Maintenance Guide
Proprietary & Confidential xi
Page 12
ReadiVoice CAPI Developer’s Guide
Document Conventions
This document uses the following typographical conventions.
TypefaceUsage
boldNames of fields, screens, windows, dialog boxes,
italicsNew terms, book titles, or emphasis; for example:
and other user interface elements; for example:
1Type the number into the Phone Number
field and click Dial.
2Click Cancel to close the dialog box.
According to the VERITAS Cluster Server User
Guide, crash tolerant applications are sometimes referred to as cluster friendly applications.
code
code, bold
code, bold & italics
Computer output, command references within text,
and filenames; for example:
Performs the initial configuration and reads the
.vcsrc
file
Command line entries, for example:
>>
Type
cp ../default_group.ini
group.ini
Command line variables, for example:
>>
Type
groupnn.ini
.
cp ../default_group.ini
replacing
nn
with the
subscriber group number.
SMALLCAPSSpecific keys on the keyboard, for example:
>>
Move the cursor by pressing TAB or
SHIFT+TAB.
xiiProprietary & Confidential
Page 13
Customer Support
Recognizing that technology alone cannot solve today’s complex challenges,
Polycom Global Services provides the industry’s best technical support staff
and programs to let you concentrate on the task at hand. ReadiVoice CAPI
users can select from a variety of support solutions to obtain the level of
support that best meets their needs.
Before contacting your Polycom Global Services representative for technical
assistance, gather as much information as possible about your situation. Any
information you can provide helps us assess the problem and develop an
appropriate solution.
Polycom Global Services Telephone and Email
If you have comments or questions about ReadiVoice CAPI or if you need
technical assistance, contact:
About this Manual
•Polycom Global Services in U.S.A
•Denver metro or outside U.S.A.
•Email:techsupport@polycom.com
Polycom Global Services on the Web
For more information about Polycom Global Services, go to
http://www.polycom.com and select the Support Solutions link under the
Global Services category.
Polycom Technical Publications Department
If you have comments or questions about this or any other ReadiVoice CAPI
documentation, contact:
Polycom Technical Publications Department
1765 West 121st Avenue
Westminster, CO 80234-2301U.S.A.
Email:TechPubs@polycom.com
800-827-7782
303-223-5223
Proprietary & Confidential xiii
Page 14
ReadiVoice CAPI Developer’s Guide
xivProprietary & Confidential
Page 15
Introducing CAPI
CAPI allows you to write applications to access the conferencing functions of
the ReadiVoice system. ReadiVoice is the industry-leading, on-demand
conferencing system. It provides an easy-to-use, reliable, scalable, and
full-featured conferencing solution.
This chapter contains the following high-level overview information.
•“CAPI Functional Overview” on page 1
1
•“CAPI Technical Overview” on page 2
•“Overview of CAPI Enhancements in This Release” on page 4
•“Getting Started” on page 4
The subsequent chapters in this guide provide technical detail on developing
and migrating applications.
CAPI Functional Overview
Note: For more information on ReadiVoice features, refer to the ReadiVoice
documentation suite. The following in particular are recommended:
•ReadiVoice CAPI Provisioning Guide
•ReadiVoice CAPI Operator Guide
•ReadiVoice CAPI Subscriber Guide
•ReadiVoice CAPI Administration and Maintenance Guide
ReadiVoice lets subscribers launch and control conferences at any time, using
touchtone or web interface. It isn’t necessary to make reservations ahead of
time or restrict time limits. The features users need to set up and control
conferences is provided in the conferencing application you write using CAPI,
and in the ReadiVoice system that the application connects to. Your CAPI
application can be run as an applet in a browser with a Java 1.4 or higher
plugin, or can be run as a standalone application with a compatible JVM.
Proprietary & Confidential 1
Page 16
ReadiVoice CAPI Developer’s Guide
CAPI Technical Overview
If you’re not familiar with conferencing applications or ReadiVoice, refer to
the ReadiVoice documentation suite, focusing on the Provisioning Guide and
Subscriber Guide.
ReadiVoice and CAPI Application Architecture
The CAPI tools in this product let you write a client application that interacts
with a ReadiVoice system. A ReadiVoice system has three main parts: the
conferencing client application, the CACS that is the core of the conferencing
system, and the bridges and ports where the conferences take place.
A CAPI client application connects to the CACS, which interacts with and
controls the behavior of the bridges.
You can send two types of messages from the client application to the CACS.
•Synchronous communication, or pull, means a request is sent and the
response is sent back immediately on the same connection.
•Asynchronous communication, or push, means a request is sent and either
a response is not required, or a response is sent later after the information
requested has been obtained, on another connection.
CAPI provides two types so that you can use synchronous communication
when you need it for a stateless protocol, or asynchronous communication for
a more robust set of features.
The overall architecture is shown in Figure 1-1. Synchronous pull mode
communication takes place over the top connection; asynchronous push mode
communication takes place going from client to server over the top connection,
with the response coming back over the bottom connection.
Figure 1-1ReadiVoice system architecture
2Proprietary & Confidential
Page 17
CAPI SDK Components
The heart of CAPI is a set of events that provide functionality. The CAPI
product, however, has far more than just the schema. Polycom provides a set
of tools to make development far quicker and easier—and more reliable—than
simply writing all your code from scratch.
CAPI provides this in the form of a robust set of teleconferencing events in an
XML schema, Java versions of those events already generated for you, plus
Java code that takes care of the complex networking tasks for you such as
networking connections and other tasks.
Note: This guide assumes that you will be writing your application in Java,
using the provided utility and communication files. If you will not be, refer to
use the schema and the detailed event documentation to develop your
application.
Code Files
The new CAPI SDK contains the following components.
Introducing CAPI
•An XML schema defining conferencing events, composing the XML layer
of the API.
•Four types of Java files, built on top of the XML layer, composing the Java
layer of the API.
— Core communication files, which interact with CACS and the core
utility files.
— Core utility files, which interact with the core communication files.
— Castor utility files, which interact with the event files and implement
the core utility files.
— Castor event files, generated from the CAPI schema using the Castor
program. (To learn more about Castor, see www.castor.org.)
Documentation
CAPI also provides a complete set of technical documentation.
•This guide includes procedures for common tasks like logging into the
system, creating a conference, and dialing participants, with sequence
diagrams and explanations of key points.
•Javadocs for the CAPI Java files.
•Simple example application.
Proprietary & Confidential 3
Page 18
ReadiVoice CAPI Developer’s Guide
Overview of CAPI Enhancements in This Release
CAPI is the latest release of Polycom’s powerful teleconferencing API. Key
enhancements include the following:
•CAPI encapsulates the server components from the conferencing
application, making it easier to write and maintain CAPI applications
•CAPI is XML-based, allowing developers to write applications in a variety
of programming languages. Java utility files and event files are provided,
as well.
•A new login type, Application, is available. The Application is like a
super-moderator, and can monitor several conferences at once. One
capability of the Application is the ability to receive notifications of all
conferences being created and ended.
•A conference can have multiple subscriber and participant logins.
•Log4j and Apache Common Logging have been used to provide logging
functionality.
Getting Started
•CAPI uses XML for all transport. Use of XML allows for better
backward-compatibility between different versions of ReadiVoice.
Note: A MAPI application is compatible with the new release of
ReadiVoice. However, a CAPI application is not compatible with the
previous version of ReadiVoice.
•An ACM event set is provided to allow CAPI applications to interface with
external applications.
•Asynchronous and synchronous functionality is available. Asynchronous
event notifications for conference and participants allow for instant
notification for any change in participant or conference state. Notification
that requires that some information be generated and returned is sent
asynchronously through a second connection.
If you’re new to CAPI, continue to Chapter 2, “Developing CAPI
Applications.” This chapter, combined with the technical reference resources
of the Javadocs and Appendix A, provide what you need to know to write a
conferencing application.
If you’re migrating from MAPI to CAPI, read both Chapter 2, “Developing
CAPI Applications.” and Chapter 3, “Migrating Applications to CAPI.” Use
the technical reference resources of the Javadocs and Appendix A, as well.
4Proprietary & Confidential
Page 19
Developing CAPI Applications
Use this chapter and the technical information it references to learn how to
write a conferencing application using CAPI.
This chapter includes the following information:
•“Writing Your CAPI Application” on page 5
•“Installing CAPI Code and Documentation” on page 6
2
•“Accessing the Documentation and Code” on page 7
•“Understanding CAPI Architecture” on page 8
•“Understanding CAPI Communication: Synchronous and
Asynchronous” on page 9
•“Understanding How Ports Are Used” on page 10
•“Understanding Connections, Sessions, and Logins” on page 12
•“CAPI SDK Components” on page 20
•“Programming Guidelines” on page 28
•“Commonly Used Conferencing Procedures” on page 37
•“Sample Moderator Application” on page 63
Note: If you’re migrating from MAPI to CAPI, use this chapter as well as
Chapter 3, “Migrating Applications to CAPI.”
Writing Your CAPI Application
The following list outlines the steps we recommend for learning how to write
CAPI applications.
1Be sure you’re familiar with conferencing applications. If you aren’t,
review the “CAPI Functional Overview” on page 1 as well as the
additional recommended reading.
2Install ReadiVoice and CAPI according to the instructions in “Installing
CAPI Code and Documentation” on page 6.
Proprietary & Confidential 5
Page 20
ReadiVoice CAPI Developer’s Guide
3Familiarize yourself with the documentation and code provided with
CAPI. See “Accessing the Documentation and Code” on page 7.
4Review the events and programming information in “CAPI SDK
Components” on page 20, and the technical information in Appendix A
and in the Javadocs, to learn how CAPI events and Java utility files work.
5Read the “Programming Guidelines” on page 28 to learn how to write
your application.
6Review the “Sample Moderator Application” on page 63
7Write your own basic application using the sample as a guideline, to
ensure that core features like connections and creating a conference are
working.
8Add features to the basic application using the Java files and events
provided. Consult the instructions in “Commonly Used Conferencing
Procedures” on page 37, the event migration reference in Appendix A,
and the Javadocs.
Installing CAPI Code and Documentation
Follow the instructions in this section to install the necessary files.
System Requirements
Software
CAPI requires the software listed in this section. Most of the required software
is included with the SDK; Java is not.
Not included in the SDK:
Java 1.4 or higher.
Included in the SDK:
•Castor 0.9.5.3
•Apache Commons Lang 2.0
•Apache Commons Logging 1.0.4
•JUnit 3.8.1
•Log4J 1.2.9
•LogKit 1.2
•XercesImp 1.0
•Xml APIs 1.0
6Proprietary & Confidential
Page 21
CAPI Installation
Developing CAPI Applications
ReadiVoice
For ReadiVoice system requirements, see the ReadiVoice installation
instructions.
You can simply copy the provided files to any directory on your system. The
directory structure is as follows:
rvsdk
mapi
capi\rv2550q
\api
\sharedjlib
\simplemoderator
On Solaris, you can also run the install file within the provide CAPI files. That
rvsdk
install program will install the
directory into
/opt
.
Setup
Follow the instructions in the ReadiVoice documentation to set up your
system. This includes setting up system components such as the Apache web
server, configuring the .
recording, and many additional setup tasks.
odprocrc
file for values needed for conference
Accessing the Documentation and Code
Before you get started, we recommend that you bookmark the CAPI
documentation and code components. All documentation and code
components can be accessed from the main CAPI page.
Documentation
The documentation includes:
•Developer’s Guide – This developer’s guide is provided in PDF. You can
view it online and navigate using the bookmarks at the side, or print part
or all of it.
•Javadocs – The Javadocs are provided in standard HTML format.
Proprietary & Confidential 7
Page 22
ReadiVoice CAPI Developer’s Guide
Code
All documentation and code components can be accessed from the main CAPI
page.
Understanding CAPI Architecture
A CAPI application interacts with the ReadiVoice system. The ReadiVoice
documentation provides extensive information about the system; however,
we’ve provided a high-level view of it here, and subsequently how ReadiVoice
relates to CAPI.
Note: We’re presenting a view of the whole architecture to ensure that you
know all the processes involved. However, when you write CAPI
applications, you don’t need to deal directly with bridge or port IDs, or
understand how the ODPROC or MPLEX processes work. CAPI is set up to
encapsulate the back-end processing details so that the programmer only
needs to work with the API itself.
A ReadiVoice CAPI system includes:
•CACS – A Conference Allocation and Control System (CACS) server. A
CACS is the key component of a conferencing system. The CACS is where
customer and conference data is stored. The CACS allows customers to be
routed to conferences. When a conference is created, the CACS sends the
bridge a conference start package including the conference ID.
Subcomponents or modules include:
— ODPROC – ODPROC stands for on-demand processing. It is the key
component of the CACS, and is the master shell process for
ReadiVoice. It runs on a SUN server.
ODPROC is a multi-threaded process that handles every aspect of
operations conferencing over the bridge. Each of its threads handles a
different aspect of conferencing. There is a BIS (bridge interface
server, one for each bridge) that communicates with the bridge, a call
routing thread that handles the logistics of choosing a bridge,
reserving ports, etc. as well as several others. Events are received,
processed, and sent by ODPROC. If ODPROC is not running, the
system can’t start new processes.
ODPROC knows where the host computer is, where the conference
data is stored, and other configuration information.
— CSC – CSC is a module within the CACS. In previous versions you
needed to deal with multiple components within CACS; in CAPI
communication from the conferencing application only goes to CSC,
which then manages communication with the other CACS modules.
8Proprietary & Confidential
Page 23
Developing CAPI Applications
•Apache – An Apache Web server handles the IP connections between
CACS and the conferencing application you write with CAPI.
•Bridges – Each system includes a bridge. You can have multiple bridges,
each of which provides several ports. Each port on the bridge is equivalent
to one phone call, or one person. ODPROC interacts with the bridges.
Conferences take place on a bridge, with a group of ports.
The overall architecture is shown in Figure 2-1.
Figure 2-1CAPI architecture
Figure 2-1 shows two lines of communication, one for synchronous and one
for asynchronous. They’re also known as pull and push mode, respectively.
The first, pull, is for quick responses on the same connection. The second,
push, is for asynchronous responses on a different connection, typically
returning the results of a requested action.
“Understanding CAPI Communication: Synchronous and Asynchronous” on
page 9 explains more about how the system components communicate using
the synchronous and asynchronous communication shown in the diagram.
Understanding CAPI Communication: Synchronous and
Asynchronous
CAPI lets you send requests in two modes: pull (synchronous) and push
(asynchronous). The difference is whether the requested action is simply
acknowledged as having been sent (pull), or whether a response is
immediately sent back (pull) satisfying the request.
•Pull mode – The event request is sent, and the response, ACK for success
and NACK for failure, is sent back immediately over the same connection
on the same ports.
Proprietary & Confidential 9
Page 24
ReadiVoice CAPI Developer’s Guide
•Push mode – The event is sent and the reply, such as
CONF_INFO_CHANGED or NACK for failure, is sent back over another
connection on two different ports later when the action or information
requested has been created.
Information about to create the second connection and ports to send it
back through is specified when the first connection from the client to the
CACS is created.
Note: In pull mode the instant reply is sent back over the same connection; in
push mode a second connection is created for the asynchronous reply.
However, when “a connection” is discussed in CAPI documentation, both are
considered one connection.
Understanding How Ports Are Used
Ports for pull mode and push mode are handled differently, as noted in
Figure 2-1 on page 9.
Pull Mode and Ports
Push Mode and Ports
Sending Port on the Client
The port from which an event is sent is up to you. Typically when you write
the conferencing application, you’ll request a socket, which will give you a
port automatically.
Receiving Port on the Server
The event is received by default on port 80 on the CACS.
Four ports are used for push (asynchronous) mode:
•The sending port on the client
•The receiving port on the server
•The sending port on the server, for the asynchronous response
•The receiving port on the client, for the asynchronous response
10Proprietary & Confidential
Page 25
Developing CAPI Applications
Sending Port on the Client
This is the same as pull mode. The port from which an event is sent is up to
you. Typically when you write the conferencing application, you’ll request a
socket, which will give you a port automatically.
Receiving Port on the Server
This is the same as pull mode. The event is received by default on port 80 on
the CACS.
Sending Port on the Server
The asynchronous response to the event is sent on a port determined by the
server; you set this up through ReadiVoice.
Receiving Port on the Client
Ports and Firewalls
The asynchronous response to the event is received on the port you specify
when you send the event in the first place. You can specify any port you want;
if you specify 0 (zero), the system will just select a locally available port. This
port is sent with the event request.
The asynchronous connection back to the client is created based on the session
ID. This lets the response come back to the right client, using the right
connection, to the expected port.
When you pass the port value, you can specify 0 (zero), which will then choose
a locally available port. See “Setting the Port for Asynchronous Responses on
the Client” on page 53 or “Sample Moderator Application” on page 63 for
sample code.
You need to ensure that CAPI communication can get through your firewalls.
Typically the pull mode requests to port 80 will get through a firewall without
any trouble. Using pull mode doesn’t pose any issues regarding firewalls;
push mode does involve complications. If you’re using firewalls between the
client and CACS, you’ll need to make some configuration adjustments to
accommodate push mode’s second connection back to the client.
Proprietary & Confidential 11
Page 26
ReadiVoice CAPI Developer’s Guide
Figure 2-2 shows a possible firewall configuration, where the client is behind
one firewall and the CACS is behind another.
Figure 2-2Firewalls and CAPI architecture
For push mode in particular, you need to ensure that the asynchronous
responses on the two additional ports can get through to the client.
Be sure that the data isn’t filtered or modified in any way as it goes through
the firewalls.
If you want to minimize the number of ports to let communication through,
see “Considerations for Number of Connections to Use” on page 18.
Understanding Connections, Sessions, and Logins
This section describes what they are, how they work, and how to put them to
use in your CAPI application.
•Overview of Connections, Sessions, and Logins
•High-Level Overview of the Conferencing Process
•Relationships Among Connections, Sessions, and Logins
Overview of Connections, Sessions, and Logins
Note: To maintain open connections and sessions, see “Maintaining Open
Sessions and Connections” on page 33.
•An HTTP connection is the networking conduit that enables
communication between a port on the client and a port on the server. You
specify in the connection creation code whether you’re using push or pull
mode.
12Proprietary & Confidential
Page 27
Developing CAPI Applications
When you’re in push mode, there are actually two connections, one from
the client to the server, and one back from the server to the client.
However, they work together, and the code that creates the first one
specifies how to create the second one, so are functionally one connection
between the client and CACS.
•A session is a CAPI process that takes place over the connection. Events are
sent through a session.
When your sessions are running over a push mode connection, you get a
session ID. This ID is stored in a cookie on the client and is used to let the
CACS know where to send the reply value back to. The session ID is how
the requests and responses for one session stay separate from other
sessions.
Multiple sessions can run simultaneously over the same connection.
(Event requests and responses running over the same connection are
handled sequentially by the CACS.)
•A login represents a set of capabilities that will function within the session.
A login creates a session. There is a Moderator login and an Application
login, which is like a super-Moderator. There is also a Participant login,
though participants don’t control connections.
A Moderator login can manage the sessions for one conference at a time.
An Application login can manage the sessions for several conferences at a
time.
Application, Moderator, and Participant Logins
Three types of logins are available for a CAPI conference. A login sets the type
of capabilities that will be used within a session.
A session determines what types of capabilities can be used and, implicitly,
what type of user or users will be in the conference.
A session and a login function together; a login creates a session.
There are three types of logins: Application, Moderator, and Participant.
However, there is both a Push Moderator and a Pull Moderator, so the
effective total is four.
•Participant – A participating user with few capabilities. Use the
LOGIN_PART event.
The Participant type is extremely limited in what it can do. It can join the
conference, and mute its own phone, but very little else.
The Participant type is sometimes also referred to as One-Click, since it’s
the type of session that implements the one-click feature. With this feature
you can send a URL to a Participant, who can click to join the conference.
•Push Moderator – A subscriber with extensive capabilities within its own
conference, for use in push mode. Use the LOGIN_PUSH_MODERATOR
event.
Proprietary & Confidential 13
Page 28
ReadiVoice CAPI Developer’s Guide
Moderators have extensive control over a single conference. However,
they can’t affect any other conference.
•Pull Moderator – A subscriber with extensive capabilities within its own
conference, for use in pull mode. Use the LOGIN_MODERATOR event.
•Application – A “super-Moderator” that has all the capabilities of a
Moderator, plus the ability to affect multiple conferences. Use the
LOGIN_APPLICATION event. Application is a push mode login.
The Application type is new in this release. It provides extended
capabilities beyond what a Moderator can do. Its key features are:
— Monitoring multiple conferences at once
— Receiving notifications of when multiple conferences start and stop
— Running ACM applications
High-Level Overview of the Conferencing Process
The following steps are for a simple implementation of a conference.
1The CAPI application on the client opens an HTTP connection to the
CACS.
2The CAPI application creates a session and logs into the CACS. The login
can be by an Application or Moderator login type.
3The CAPI application creates a conference for that session; the conference
runs on the CACS.
4The CAPI application sends event requests to the conference on the
CACS, and receives responses back, within the conference’s session.
A session ID is used to ensure that requests and responses for a session are
tracked correctly.
5When the conference is over, the login controlling the conference ends the
conference, ends the session, and logs out of the connection to the CACS.
Relationships Among Connections, Sessions, and Logins
You might think that for each request/response, or for each conference, you
would create one connection and one session. You have more flexibility than
that, however, combined with a few restrictions.
Note: The Application login is for push mode only, and there is a Moderator
for push and for pull mode.
14Proprietary & Confidential
Page 29
Developing CAPI Applications
Basic Relationships
•There is a one-to-many relationship between the connection to the server
and the sessions that can go across it
•There is a one-to-many relationship between the Moderator login and
sessions
•There is a one-to-many relationship between the Application login and
sessions
•There are no restrictions on the number of sessions and the corresponding
number of conferences; there is a many-to-many relationship between the
two.
Login and Session Combinations
•Multiple logins can control multiple sessions at the same time. Possible
implementations of this include:
— One Application login can control all sessions
— One Application login can control one or more sessions, while one
Moderator login can control a session
— One Application login can control one or more sessions, while one
Moderator login can control a session, and another Moderator can
control another session
— Two Application logins can control one or more sessions each, while
one Moderator login can control a session, and another Moderator can
control another session
Login, Session, and Connection Combinations
All of these possible combinations from the previous section can be grouped
over connections in nearly any way you decide.
•All sessions can run over the same connection (for push, the same set of
connections, one client -> server and the returning connection server ->
client)
•Some sessions can run over one connection and the rest can run over
another. The only restriction is that all of the sessions run by a particular
login must take place on the same connection; an Application login can’t
control some sessions on one connection and other sessions on another
connection.
•Each session can take place on a separate connection.
•Each session can manage multiple conferences (if session was created by
an Application login) or many sessions can manage one conference
•Each login’s sessions can have separate connections.
Proprietary & Confidential 15
Page 30
ReadiVoice CAPI Developer’s Guide
•Multiple Applications, Moderators, and Participants can access a
conference at the same time
Illustrations of Connection, Session, Conference, and Login
Configurations
The following illustrations show possible approaches to connections, sessions,
and logins.
Conferences
Conferences
Conferences
Connection
Session
One login controlling sessions for one conference
over one connection
Connection
Session
Session
Two logins controlling sessions for one
conference each over one connection
Connection
Session
Session
Application login controlling sessions for multiple
conferences over one connection
Login
ClientCACS
Login
ClientCACS
Application Login
ClientCACS
Conferences
Connection
Application Login
Session
Session
Moderator Login
Session
Moderator login controlling sessions for one conference
and Application login controlling sessions for multiple
conferences over same connection
Figure 2-3Possible approaches to connections and sessions
16Proprietary & Confidential
ClientCACS
Page 31
Developing CAPI Applications
Conferences
Conferences
Conferences
Connection
Session
Application login controlling one session and two
conferences
Connection
Session
Session
Login controlling a conference using multiple sessions
Connection
Session
Session
Session
Session
Application Login
ClientCACS
L og in
ClientCACS
A p p l i c a t i o n L o g i n
Conferences
Application login controlling multiple conferences with
multiple sessions for each conference
Connection
ClientCACS
Application Login
Session
Session
Moderator Login
Session
Moderator login controlling sessions for one conference
and Application login controlling sessions for multiple
conferences over same connection
Figure 2-4More possible approaches to connections and sessions
ClientCACS
The next illustration shows combinations that aren’t permitted.
Proprietary & Confidential 17
Page 32
ReadiVoice CAPI Developer’s Guide
Conferences
Conferences
Conferences
Session
Connection
Session
Connection
Login’s sessions over different connections
Connection
Session
Connection
Session for one conference over two connections
Connection
Session
Session
Moderator login controlling two conferences
Login
ClientCACS
Login
ClientCACS
Moderator Login
ClientCACS
Figure 2-5Unpermitted approaches to connections and sessions
Benefits and Drawbacks
The choices shown in “Relationships Among Connections, Sessions, and
Logins” on page 14 boil down to a few choices:
•Using multiple connections or fewer
•Using the Application login or the Moderator (or both)
Considerations for Number of Connections to Use
•Number of ports kept open – You read in “Understanding How Ports Are
Used” on page 10 that a pull event involves two ports and a push event
involves four ports. You also read in “Ports and Firewalls” on page 11 that
you need to ensure for push mode in particular that responses can get back
to the client through your firewall. The more connections you have, the
more traffic you need to let through the firewall and the higher the risk
that unwanted traffic will get through. This means that if you want to
minimize the open ports in your firewalls, use one or very few
connections.
18Proprietary & Confidential
Page 33
Developing CAPI Applications
•Performance – The fewer connections you use, the slower performance
will be in general. The events are serialized. Additionally, the events are
processed by the server one at a time within the connection, in the order
received. The server can deal with multiple events from multiple
connections at the same time, but events within a connection are dealt with
sequentially.
•Simplicity – Using just one connection for all sessions is simpler.
Considerations for Logins
An Application login has the ability to manage multiple conferences, and to
use the CAPI ACM tools to interface with other applications. If these features
are important to you, use the Application login.
Proprietary & Confidential 19
Page 34
ReadiVoice CAPI Developer’s Guide
CAPI SDK Components
Review this section to learn about the CAPI events, and the CAPI Java utility
files and event files.
Understanding the CAPI Events
An event contains information describing some behavior or functionality of
the conferencing application or CACS. All control and functionality of CAPI is
accomplished by either sending an event to the CACS, or receiving one back
from the CACS.
For example, to dial a participant or subscriber, you would send a
DIAL_CALL event (or class object) to the CACS with the proper data
(participant’s name, phone number, etc.). The CACS would then send back to
the conferencing application a DIAL_STARTED and
DIALOUT-CONNECTED event when the person picks up the phone. The
reply events contain information such as the conference ID and participant ID
used when completing the requested task.
Note: For more information on callflows, refer to the “Voice Prompts and Call
Flows” appendix of the ReadiVoice Administration and Maintenance Guide.
Push and Pull Mode
Each event can function in either push or pull mode. Pull mode sends back
ACK or NACK responses for success or failure; push mode has a wider variety
of responses. In addition to the replies to the original event, other events can
be affected as well. These are noted where appropriate in this document.
Events Can Be Run By Certain Login Types
Not all events can be run by all login types: many can be run by Moderators
and Applications but not Participants, for instance. The legal login types for
each event are listed in the event reference guide.
Responses Versus Notifications
When you send an event, you can get back a reply. You can also receive
notifications. Here’s the difference between them.
•In pull mode, you only receive replies. You send an event, and
immediately a reply, such as an event containing the requested value, or
ACK or NACK, comes back.
•In push mode, you can also receive replies. You might send a request to
register to be notified every time a conference starts and stops, for
instance.
20Proprietary & Confidential
Page 35
Developing CAPI Applications
— The reply to this would tell you that the request was received and
you’re registered.
— The notifications, later, would tell you that a conference has started or
that one has stopped.
Using the Event Reference Section
The event reference section of this document contains extensive technical
information about how to use each event. Be sure to use it as you write your
application.
In the event reference section, pay particular attention the responses for each
event, for pull mode and for push mode. Some responses are standard ACK
for success and NACK for failure; others send alternate or additional
information. Note that NACK is the failure not of the event to get the
requested response, but the failure of the event request to be correctly
processed.
For instance, if you send a request for an operator (SET_OP_REQ) when an
operator isn’t available, you might expect a NACK (failure) response. In pull
mode, this is the case. The response is a failure to get the operator because one
isn’t available, and this is expressed not with NACK but with the
OP_REQ_CANCELED event as a response.
The OP_REQ_CANCELED event response has three possible enum values.
When no operator is available, the event response enum would be
CR_NO_OP_AVAILABLE.
Valid enum values are:
•CR_CALLERS_ACTION
•CR_NO_OP_AVAILABLE
•MAX_CANCELATION_REASON
Understanding the CAPI Java Files
The Javadocs were installed with CAPI. Use them to learn more about how
and when to use each class, interface, and package.
You can access Javadocs using the main CAPI components navigation page.
Use this section to learn more about the Java files provided with CAPI, and
how to use them with events.
Note: This documentation assumes that you are writing your application
using all of the provided Java files, including the Java event files generated by
Castor from the schema.
Proprietary & Confidential 21
Page 36
ReadiVoice CAPI Developer’s Guide
CAPI Java Files
The new CAPI SDK contains the following components.
•An XML schema defining conferencing events, composing the XML layer
of the API.
•Four sets of Java files, built on top of the XML layer, composing the Java
layer of the API.
— Core communication files, which interact with CACS and the core
utility files.
— Core utility files, which interact with the core communication files.
— Castor utility files, which interact with the event files and implement
the core utility files.
— Castor event files, generated from the CAPI schema using the Castor
program. (To learn more about Castor, see
Figure 2-6 shows the different Java CAPI SDK components, and how they
relate to each other and the conferencing software you write. A partial list of
the Java classes in each category is included.
www.castor.org
.)
22Proprietary & Confidential
Page 37
Developing CAPI Applications
Figure 2-6CAPI SDK architecture with sample class names
Proprietary & Confidential 23
Page 38
ReadiVoice CAPI Developer’s Guide
CAPI Java File Quick Reference
Table 2-1 provides a quick reference. For technical details, see the Javadocs.
Table 2-1Files provided with CAPI
CategoryFilenamesDescription
Core
Communication
AsyncRecieverConnection.javaAn implementation of Connection that uses a trivial
protocol. Provides for reading asynchronous data
off a unidirectional connection (does not provide a
way to write to that connection). Internal read is
unbuffered. Trivial protocol is to read 1 integer of
data specifying the size of the rest of the data
packet, then to read that much more off the
connection.
BasicConnection.javaImplements Connection class, which provides basic
communication methods that operate on events.
Assumes HTTP protocol and XML data payloads.
BasicCookie.javaImplements the Cookie interface. Usually used to
set a cookie on a connection.
BasicListener.javaListener class provides infrastructure for
infrastructure for asynchronous/synchronous
(pull/push) connections. Contains a ServerSocket
that will accept new connections.
handle communications with the CACS utilizing the
RV Simple XML protocol, and HTTP. If given a
Listener, four threads are created: one for reading
HTTP events, one for writing HTTP events, one to
listen for asynchronous server connections, and
one to read from any asynchronous server
connections. If not created with a listener only the
HTTP reader and writer threads are created.
Connection.javaForms the base for all types of socket based CAPI
connections to servers. If not set, will use internal
SocketFactory to create a socket if needed, or a
factory may be set using the appropriate interface
methods.
Cookie.javaCookieInterface provides interface for cookie
processing. This interface should be overridden to
provide desired functionality.
CookieInterface.javaCookieInterface provides the interface for cookie
processing. This interface should be overridden to
provide desired functionality.
24Proprietary & Confidential
Page 39
Developing CAPI Applications
Table 2-1Files provided with CAPI
CategoryFilenamesDescription
HttpConnection.javaAn implementation of Connection} that uses the
HTTP protocol. Internally uses a BufferedReader
for reading data off the connection, and provides for
writing data to that connection.
Listener.javaA utility interface for network components that listen
for new connections
MessageBus.javaA utility interface for main communications.
MessageSender.javaA utility interface for sending CAPI events.
Core UtilityACMSender.javaA utility interface for sending ACM-related events to
the CACS. No passed parameter for any method
may be null or < 0 unless otherwise specified.
AddressBookSender.javaA utility class interface for sending address book
related events to the CACS. No passed parameter
for any method may be null or < 0 unless otherwise
specified.
CapiUnmarshaller.javaHandlerInterface provides interface for handling
incoming events. This interface should be
overridden to provide desired functionality.
MarshallerException.javaHigher-level exception wrapper for any exception
thrown during data marshalling. This higher-level
exception shields the application from having to
deal with the marshalling specific implementations'
exceptions.
UnmarshallerException.javaHigher-level exception wrapper for any exception
thrown during data un-marshalling. This
higher-level exception shields the application from
having to deal with the un-marshalling specific
implementations' exceptions.
UnmarshallerInterface.javaHandlerInterface provides interface for handling
incoming events. This interface should be
overridden to provide desired functionality.
Castor UtilitiesCastorAcmSender.javaImplements ACMSender. A utility class for sending
ACM-related events.
CastorAddressBookSender.javaImplements AddressBookSender. A utility class for
sending address book-related events to the CACS.
CastorMessageHandlerBase.javaImplements java.util.Observer. The Castor event
specific base for handling all events. Handle
methods must be overridden by the application to
implement an action to take when a specific event
is received.
Proprietary & Confidential 25
Page 40
ReadiVoice CAPI Developer’s Guide
Table 2-1Files provided with CAPI
CategoryFilenamesDescription
CastorSender.javaImplements MessageSender. The Castor specific
utility to send events.
CastorUnmarshaller.javaExtends Observable, implements
UnmarshallerInterface. The Castor speci f ic
implementation to unmarshall data into events.
Castor EventsAll events from schema. See event reference section.
Connecting the CAPI Events and the Java Utility Files
Typically, you’ll use the procedures in “Commonly Used Conferencing
Procedures” on page 37, and the event reference section, to figure out which
events you need to use. From there, though, you need to determine which Java
files to use to implement those features. Use these tips to make the connection
between events and Java files.
Where to Find Event Methods
The methods that send events are in classes and interfaces with Sender in the
name. The methods that read, or handle, events, are in classes and interfaces
with Handler in the name.
You can also look at “Sample Moderator Application” on page 63 to see how
the code sends and reads events.
Sender methods from the CastorSender,java file
public void appRegisterConfsActivity(java.lang.String
•
passBack, java.lang.String sessionId)
Corresponds to the APP_REGISTER_CONFS_ACTIVITY event.
•
public void dialCall(java.lang.String passBack,
java.lang.String sessionId, int confId, java.lang.String
callTo, boolean promptToConnect, java.lang.String name,
java.lang.String partTypeStr, java.lang.String callflowStr,
boolean delayConf)
Corresponds to the DIAL_CALL event.
•
public void loginParticipant(java.lang.String passBack,
java.lang.String accessNumber, java.lang.String accessCode)
Corresponds to the LOGIN_PART event.
Handler methods, from the CastorMessageHandlerBase.java file:
•
public void handle(RVAPIACK message)
Corresponds to the ACK event.
•
public void handle(RVAPIANNOUNCEMENT_CHANGED message)
26Proprietary & Confidential
Page 41
Developing CAPI Applications
Corresponds to the ANNOUNCEMENT_CHANGED event.
•
public void handle(RVAPICALL_DISCONNECTED message)
Corresponds to the CALL_DISCONNECTED event.
Names of Java Files Castor Generates for Each Event
In addition to the Java utility files written for CAPI, a Java file is automatically
generated from the schema for each event by the Castor program. The name of
each automatically generated Java file is based on the event name in the event
reference guide, but with some differences. These differences are part of how
Castor works and ensure uniqueness for the generated code.
•The names of events are all caps with underscores. Some examples are
CONF_INFO_CHANGED, SUBSCR_INFO, and
CALL_DISCONNECTED.
•However, the Castor program attaches the namespace to the front of each
generated class and type. Thus when you directly reference the event files
generated by Castor, you would need to use the name Castor assigns to the
Java files: RVAPICONF_INFO_CHANGED, RVAPISUBSCR_INFO, and
RVAPICALL_DISCONNECTED. Here’s an example:
public void handle( RVAPICONF_INFO_CHANGED message )
Table 2-2 covers the naming changes that Castor makes when it creates the
Castor Events files.
Table 2-2Event naming conventions
Item typeSchema nameCastor Java class nameDirectoryComments
This section contains important information about designing and writing your
CAPI application.
How the ODPROC and the CSC Work Together
This section explains what happens when ODPROC resyncs with the CSC. It’s
important that you know how this works to be prepard for the events that are
called and sent.
Note: See “Understanding CAPI Architecture” on page 8 for information on
the ODPROC and the CSC.
•Bridge logout – When a bridge logs out (or ODPROC is restarted), each
push mode session that has an active conference on the bridge should
receive the BRIDGE_STATUS_CHANGED event with the BS_DOWN
value. This will also occur, the same way, for Application sessions that
were registered to receive notifications of conference starts and stops.
•Bridge login – When a bridge logs in (after a logout or ODPROC restart),
each push mode session that had an active conference on the bridge before
the logout should receive the BRIDGE_STATUS_CHANGED event with
BS_UP value. This will also occur, the same way, for Application sessions
that were registered to receive notifications of conference starts and stops.
•Bridge login – When a bridge logs in (after a logout or ODPROC restart)
push mode sessions receive CONF_INFO_CHANGED for its conference if
it is still active. This will also occur, the same way, for Application sessions
that were registered to receive notifications of conference starts and stops..
If the Application session is not registered for the subscription, it receives
the CONF_STARTED event.
•Nothing is received for conferences that went away while the bridge was
out.
•No participant events are received in any case.
In genera,l sessions interested in a conference are notified that the conference
is active, and they must ask for more information if they need that.
Application Design and Configuration
Review this section before writing your application and adhere to specified
information.
Choosing a Programming Language
Note: This document assumes in general that you are programming in Java
using the provided Java files.
28Proprietary & Confidential
Page 43
Developing CAPI Applications
We recommend that you use Java and the Java files provided with CAPI.
Java 1.4 or higher is required.
See the Javadocs and “Understanding the CAPI Java Files” on page 21 to learn
more about using the Java files provides with CAPI.
If you are programming in another language, you will need to use the schema
as the basis for your program. If the existing extension architecture is not
suitable for your needs, you can use only the schema. For instance, you can use
the schema as a foundation for building a translation server application that
translates events between the CACS Java API and other languages or
platforms.
You can use any language with a socket utility so that you can open the Web
server port of the CACS. You can use C++, Perl, Java, or Visual Basic, among
others. All events must comply with HTTP 1.1.
Object Model Layer
We recommend that you set up an object-model layer between your code and
the code provided by CAPI. This was provided in MAPI, and is likely to be
provided in the future by CAPI, but is not currently available.
Storing Configuration Information
The GUI.INI file and the Config object were used in MAPI to store information
like ports, server IP addresses, and so on. In CAPI, the file and object are no
longer used. You are responsible, for CAPI applications, for determining how
to store this information; however, you have the flexibility to select the
approach you prefer.
Configuration information you might store depends on your system.
However, we recommend that you ensure that the following are easily
available to your application:
•IP addresses and ports on CACS
•Frequency of the heartbeat you send to keep connections open (see
“Maintaining Open Sessions and Connections” on page 33)
•IDs for ACM applications like PINS
Programming Fundamentals
Review this section before writing your application and adhere to specified
guidelines.
Proprietary & Confidential 29
Page 44
ReadiVoice CAPI Developer’s Guide
Using ACM
ACM is an interface to external applications. It’s a way to develop and
implement functionality and features to callflow and inside a conference, that
aren’t in the standard ReadiVoice or CAPI release.
Essentially, a participant is taken from the normal callflow/conference and
temporarily handed over to an ACM application such as PINS. Once the ACM
application has finished with the participant or participants, and no other
ACM applications want to take control, they’re placed back in the conference
or into the callflow at the point they were taken.
To use ACM, use the events and Java files for ACM. Event and file names are
ACM
all preceded by
ACM Basics
To use an ACM application, first register its existence. Use the
ACM_REGISTER event.
•The application’s identity number must match with that in the database of
ACM applications for the system.
.
•A heartbeat (quick data packet) must be sent from the ACM application
every few seconds. Failure to do so will result in the unregistration of the
application. The timeout period before the application is unregistered is
specified in the .
Maintenance Guide for information on configuring the .
•If an ACM application is unregistered callers will be totally unaware of its
existence, even if the subscriber has selected the option to use it.
ACM applications have a priority number associated with them (set in the data
base). This number tells the ACM manager in what order to pass control of the
channel. This allows ACM applications can be chained together, which is
easier and allows more customization.
Two Types of ACM Applications
The two types of ACM applications are Call Flow and In Conference.
•Call Flow ACMs occur in the call flow just before a caller records their
name for roll-call (if that option is enabled) and is placed in the conference.
This is the only point designated for ACM applications to take over (if
any). As such, Call Flow ACM applications will only work when a
participant dials in and is proceeding through the call flow menus.
•In Conference ACMs happen after participants are in a conference. Unlike
the Call Flow ACMs, these are not automatic, and must be initiated by a
Moderator.
odprocrc
file. Refer to the ReadiVoice Administration and
odprocrc
file.
Examples of preconference ACM applications include the following:
•ACM PINs. Using PINS includes these steps:
— Prompt subscriber and participants for PIN
30Proprietary & Confidential
Page 45
Developing CAPI Applications
— ACM application verifies PIN
— PIN written to CDR
•ACM Billing ID. Using Billing ID includes these steps:
— Prompt subscriber for billing code
— Use for bill back to a specific client
— Digits are collected and passed to CDR
For ACM sample code, see “Using ACM to Interface With External
Applications” on page 59 or “Sample Moderator Application” on page 63.
Using Push and Pull Mode
As stated in “Understanding CAPI Communication: Synchronous and
Asynchronous” on page 9, CAPI lets you send requests in two modes: push
(asynchronous) and pull (synchronous). You can specify that any given
session will be in push or pull mode.
Event Return Values for Push and Pull
•The responses to an event for push mode, for success or failure, are listed
in the event reference section. For instance, the
REMOVE_CONTACT_GROUP event returns
CONTACT_GROUP_REMOVED for success and NACK for failure.
•The responses to an event for pull mode vary. For the same event,
REMOVE_CONTACT_GROUP, the responses are ACK for success and
NACK for failure. ACK simply indicates that the request was received.
ACK and NACK are common responses for pull mode. However,
sometimes information will be sent back for the success response. For the
event REQ_CONTACT_GROUP_LIST, which simply asks for information
instead of for a task to be performed, the response for pull mode is
CONTACT_GROUP_LIST for success and NACK for failure. (Push mode
has the same responses.)
If information can simply be retrieved to fulfill a request, pull mode will return
the requested value for success. If a task needs to be performed to fulfill the
request, pull mode will return an ACK for success. Both pull and push return
NACK for failure.
Choosing Push Versus Pull
Push is a more robust, powerful approach. Pull is used when you are working
with a stateless protocol such as HTTP. Push does require you to manage
firewalls to ensure that the response coming back on the second connection
can get through. Generally, push is the better choice unless you have specific
issues with state or firewalls.
Proprietary & Confidential 31
Page 46
ReadiVoice CAPI Developer’s Guide
Specifying Push or Pull
The type of connection you create with the CACS specifies whether you’re
using push or pull. For push, you need to create a listener and need to specify
the client port that the connection for the response should come back to. For
pull, you don’t need either of these components.
The code for creating a connection is in “Connecting to the CACS” on page 41
and “Sample Moderator Application” on page 63.
For pull, use a Pull Moderator to manage the conference; for push, use a Push
Moderator or Application.
Note: You can create a pull connection and then log in with a Push Moderator,
or vice versa; the type of login determines the session type rather than the
original connection. However, your application won’t work correctly with this
approach.
Push and Firewalls
The second connection that push mode uses can require specific firewall
configuration. See “Ports and Firewalls” on page 11.
Using the Login Types
A session determines what types of capabilities can be used and, implicitly,
what type of user or users will be in the conference.
A session and a login function together; a login creates a session.
Login Types
There are three types of logins: Application, Moderator, and Participant.
However, there is both a Push Moderator and a Pull Moderator, so the
effective total is four.
•Participant – A participating user with few capabilities. Use the
LOGIN_PART event. Participant is a pull mode session.
The Participant type is extremely limited in what it can do. It can join the
conference, and mute its own phone, but very little else.
The Participant type is also referred to as One-Click, since it’s the type of
session that implements the one-click feature. With this feature you can
send a URL to a Participant, who can click to join the conference.
•Push Moderator – A subscriber with extensive capabilities within its own
conference, for use in push mode. Use the LOGIN_PUSH_MODERATOR
event.
Moderators have extensive control over a single conference. However,
they can’t affect any other conference.
•Pull Moderator – A subscriber with extensive capabilities within its own
conference, for use in pull mode. Use the LOGIN_MODERATOR event.
32Proprietary & Confidential
Page 47
Developing CAPI Applications
•Application – A “super-Moderator” that has all the capabilities of a
Moderator, plus the ability to affect multiple conferences. Use the
LOGIN_APPLICATION event. Application is a push mode session.
The Application session type is new in this release. It provides extended
capabilities beyond what a Moderator can do. Its key features are:
— Monitoring multiple conferences at once
— Receiving notifications of when multiple conferences start and stop
— Running ACM applications
Session Type and Session ID
Sessions not only specify the capabilities, and thus the events, that can be used
for a specified part of the application, but the session ID is used in push mode
to let the server know where to send the response back to, on the asynchronous
connection.
When you create a push session, you get a session ID. This ID is stored in a
cookie on the client and is used to let the CACS know where to send the reply
value back to.
Programming Tips
Creating a Connection
The code for creating a connection is included in the sample CAPI Moderator
application, in the SimplePushModerator.java file. See “Creating a
Connection” on page 33 or “Sample Moderator Application” on page 63.
Maintaining Open Sessions and Connections
A session takes place over a connection. Both need to stay open to make sure
the conferencing application works.
•A connection will timeout by default after four minutes without a session
over it. This timeout is not configurable.
•A session will timeout by default after two minutes without any traffic.
(You can change this value by editing the .
session open, you need to have some traffic over it. The simplest way to
ensure traffic over the session is to use the SESSION_HEARTBEAT event.
A code example is shown in “Maintaining an Open Session” on page 43.
This section contains more specific, task-related tips to follow when you write
your application.
odprocrc
file.) To keep the
Proprietary & Confidential 33
Page 48
ReadiVoice CAPI Developer’s Guide
Notes on Conference, Participant, and Subscriber IDs
Conference and Participant IDs Must Be Saved and Sent
MAPI contained an object model, so the conference and participant IDs were
saved in the conference object and sender objects. That layer does not exist
currently in CAPI, so you need to be sure to save the values, and pass them in
when needed.
Here’s an example of the subscriberId and conferenceId.
/*
* We need to save these for future communications.
*/
private int subscriberId = -1;
private int conferenceId = -1;
Conference and Subscriber IDs
In the previous release, there was inconsistent use of SubscrID and ConfId, the
subscription ID and the conference ID. They are two different items; however
for now, they are typically assigned the same number. In CAPI, they are used
consistently as follows:
•SubscrID – Used before a conference has been created, to identify a
subscriber
•ConfID – Used as soon as a conference has been created, to identify a
physical conference
It is important to implement these as different items, even though they are
currently assigned the same number in the Readivoice implementation.
Database Conference Information Updates
CSC is a module within CACS that manages conferences. The information it
manages is divided into two types: database conference information, generally
static settings used to set up the conference, and runtime information, more
dynamic information exchanged during the conference.
When you change one, the same information in the other is not necessarily
changed. You could change an attribute for the current conference session, but
the same information in the database would remain the same. Typically there
are two events to change a piece of information, one to change it in the
conference session and one to change it in the database.
Prerequisites: Connection and Conference, and Session and
Conference IDs
Before you run most tasks, such as dialing a participant, you need to make sure
that you’ve created a connection and started a conference.
34Proprietary & Confidential
Page 49
Developing CAPI Applications
You also need to be sure that you have saved and can read in the values for the
session ID, conference ID, and subscriber ID.
Verifying Events Have Occurred
Sending a request and receiving an acknowledgment are not sufficient to
ensure the action requested by an event was carried out. We recommend that
you verify each event is both acknowledged and carried out. For example, if
you send a request to start a conference:
•Verify that you receive an ACK, which indicates the system has received
the request, found no problems, and will attempt processing of the
request.
•Poll using REQ_SUBSCR_INFO to verify that ConfRunning is true (which
means that the conference ID returned is valid).
Multiple Requests of Same Event and the Passback parameter
To send multiple requests of the same event, you can change the passback
number of each request to make it easy to correlate each acknowledgment
(ACK) response with its request. ACK contains a passback field parameter, so
when an ACK comes back you can verify that it has the same field you sent.
Here’s an example. Dialing participants uses the DIAL_CALL event, and the
corresponding
dialCall
method is as follows, and the first parameter is
method. The Javadocs show that the syntax for the
passBack
.
public void dialCall(java.lang.String passBack, java.lang.String
sessionId, int confId, java.lang.String callTo, boolean
promptToConnect, java.lang.String name, java.lang.String
partTypeStr, java.lang.String callflowStr, boolean delayConf)
The following example uses the passback number when dialing to
differentiate dialing the first participant and the second participant. When an
ACK response is sent back for each request, it will contain the value
Dial1Passback
try
{
if ( dialCount < 1 )
{
log.info("Dialing part one");
The implementation of the conference security code (when
SET_CONF_SECURITY_CODE is sent after JOIN_CONF is sent) has been
updated. CAPI implementation changes the order and requires that
SET_CONF_SECURITY_CODE be sent before JOIN_CONF. This approach
means that SET_CONF_SECURITY_CODE is optional.
Response to Malformed XML and HTTP
Malformed XML and HTTP code is responded to when possible. When it is too
malformed to respond to, it is silently ignored.
Dial String Requirements
Input for the dial string (usually a telephone number) can include parentheses
and hyphens. For example, (303) 555-1212 would be accepted. CAPI strips the
extra non-numeric characters out automatically; it also translates alphabetic
characters to telephone numbers so that, for example, A,B, and C are
translated to the number 2, based on the standard telephone keypad.
However, you must make sure the following requirements are implemented
by programming the user interface or post-processing:
36Proprietary & Confidential
Page 51
•Telephone extensions – Extension must be preceded by a sufficient
delay—specified by commas. For example, (303) 555-1212,,,,2000 would
successfully dial extension 2000 if it existed.
•Delay – Any required delays to allow for the switch to route the call must
be added by programming the user interface or post-processing. To add
delay, commas (,) need to be inserted into the dial string. Each comma
creates a one-second delay. Usually four commas (,,,,) are sufficient.
Commonly Used Conferencing Procedures
Note: This section contains a limited list of the more commonly used
procedures. To write any procedure in CAPI, you can use the event reference
section to find an event that performs the task. Read the descriptions and other
information to determine how to use it.
Additional Sources of Information
Developing CAPI Applications
Procedure Sequence
For more information on how the features in this section work, refer to the
ReadiVoice documentation suite. The following in particular are
recommended:
•ReadiVoice CAPI Provisioning Guide
•ReadiVoice CAPI Operator Guide
•ReadiVoice CAPI Subscriber Guide
•ReadiVoice CAPI Administration and Maintenance Guide
When you start a conference, you need to perform certain steps in a certain
order. For instance, you need to create a connection to the CACS, then log into
it, then create a conference, then dial participants, and so on.
The procedures in this section are presented in the order in which they should
be used.
1Perform “Initial Procedures” on page 40 in the order in which they are
listed.
2Perform “Conference Procedures” on page 46 only after you’ve
completed the initial procedures.
If a procedure logically needs to take place when a conference is already
running, be sure you’ve first performed “Starting a Conference” on
page 46. Some tasks don’t need a conference running first; you wouldn’t
need to be in a conference for “Registering the Application Login for
Conference Start and Stop Notification” on page 47, for instance. A
Proprietary & Confidential 37
Page 52
ReadiVoice CAPI Developer’s Guide
Moderator also could simply log in, make some changes to settings, and
log out, without creating a conference. However, if you were to perform
“Dialing Participants” on page 48, you’d need to have a conference
running already so that there was a conference for them to join.
3Perform “Conference-End Procedures” on page 60 to end a conference.
38Proprietary & Confidential
Page 53
Procedure Notes
Developing CAPI Applications
A typical order for a set of tasks in a simple application is:
1Create a connection
2Log in
3Start a conference
4Dial participants
5Log out
6End the conference
This section covers important information about what data is provided,
prerequisites, and other tips.
Content of Procedures in This Section
The appropriate information for each event depends on whether it’s an
administrative procedure like creating a connection, or a simpler CAPI
procedure that uses a straightforward event and response. We’ve provided
one or the other for each procedure, and both where possible.
Please refer to the “Sample Moderator Application” on page 63, as well, to see
working CAPI sample code.
Push Mode Versus Pull Mode
CAPI has two modes, push and pull. (See “Understanding CAPI
Communication: Synchronous and Asynchronous” on page 9 and “Using
Push and Pull Mode” on page 31.) The responses you’ll get for sending an
event in push mode are different from the ones in pull mode. We’ve written
these procedures for push mode, since push mode is more robust and
somewhat more complex, and summarized the differences here. If you want
to write a procedure in pull mode, read the push procedure, then make
changes as necessary for the different response values listed in the event
reference guide.
Application Login Prerequisites
For any procedures involving the Application login, be sure that the
Application ID and password are set up in ReadiVoice. Refer to the
ReadiVoice subscriber guide for more information.
Application login is for push mode, so be sure to create a push mode
connection to the server.
Proprietary & Confidential 39
Page 54
ReadiVoice CAPI Developer’s Guide
Initial Procedures
This section includes procedures you perform in order to get the conference
started.
Setting up Logging
Apache Log4J and Apache Commons logging are available, and included in
the SDK.
Sample Code
Here’s an example of setting up logging. Refer to “Sample Moderator
Application” on page 63 to see the sample code in context.
You need to create a connection to the CACS before you can do anything else
in the application. You specify in the connection code whether the connection
will be push or pull. The connection is a simple
HttpConnection
also need to create a listener, and specify the client port that the asynchronous
connection will come back to.
Note: This is a required step.
Sample Code
Refer to “Sample Moderator Application” on page 63 to see the sample code
in context.
public SimplePushModerator( String remoteHost, int remotePort, String localAsyncHost,
int localAsyncPort )
{
Validate.notEmpty(remoteHost);
Validate.isTrue(remotePort > 0);
Validate.notEmpty(localAsyncHost);
Validate.isTrue(0 <= localAsyncPort);
; for push you
// The following listener code is used only for push connections.
try
{
/*
* This is the listener for asynchronous event communication. When the server
* contacts for asynchronous communication on the specified port, this object
* will create a connection for the MessageBus.
*/
listener = new BasicListener(localAsyncPort);
// The following cookie code is used only for push connections.
/*
* The server uses the cookie to find out the details on how to establish
* the asynchronous connection with us.
*/
Cookie cookie = new BasicCookie(localAsyncHost, listener.getLocalPort());
// The rest of the code is used for both push and pull connections.
Proprietary & Confidential 41
Page 56
ReadiVoice CAPI Developer’s Guide
/*
* We need to establish a basic HTTP connection to send commands and queries.
* In push-mode, responses will come back over the asynchronous connection.
*/
httpConnection = new HttpConnection("SimpleModHttp", remoteHost, remotePort, true,
Connection.DEFAULT_URL, cookie);
/*
* This is a handler for all events from the server/CACS.
*/
handler = new SimplePushModeratorHandler(this);
/*
* This objects handles conversion of the raw data off a connection into
* POJO representations of the CAPI events.
*/
unmarshaller = new CastorUnmarshaller(handler);
/*
* Once the CAPIUnmarshaller, the command sending HTTP connection, and the
* asynchronus connection listening service are set up, we give them to a
* MessageBus so it can use them to finish any further connection setup, and
* begin those communications as needed.
*/
messageBus = new BasicMessageBus(unmarshaller, httpConnection, listener);
/*
* This is the utility class that provides methods for sending the CAPI events
* to the server/CACS. These methods will handle marshalling of the passed
* arguments into the POJO representations of those events. It will then
* marshall those POJO representations into raw data and use the
* provided MessageBus to send to the server/CACS.
*/
sender = new CastorSender(messageBus);
shouldRun = true;
/*
* Start the main thread
*/
start();
}
catch( IOException e )
{
log.fatal("Error in setup, exiting", e);
shutdown();
}
}
42Proprietary & Confidential
Page 57
Developing CAPI Applications
Maintaining an Open Session
Once you’ve created a connection and a session, you need to have traffic going
to keep both open. The session will timeout by default after two minutes
without traffic; the connection will timeout after four minutes without a
session.
Event
SESSION_HEARTBEAT
Any event can be used to maintain the connection by requesting and receiving
information regularly; however, SESSION_HEARTBEAT was created for that
purpose.
Response
Pull: N/A
Push: SESSION_HEARTBEAT_ACK
Prerequisites
“Creating a Connection” on page 33.
Sample Code
Refer to “Sample Moderator Application” on page 63 to see the sample code
in context.
/*
* Application is responsible for sending heartbeats. This counter
* is just used to limit the number of heartbeats to reduce network traffic.
*/
private static final int HEART_BEAT_COUNTER_DEFAULT = 30;
private int heartBeatCounter = HEART_BEAT_COUNTER_DEFAULT;
Pull: MODERATOR_SESSION_INFO for success, NACK for failure.
Push: MODERATOR_SESSION_INFO for success, NACK for failure.
Response to LOGIN_PART
Pull: N/A
Push: PART_SESSION_INFO for success, NACK for failure.
Prerequisites
“Connecting to the CACS” on page 41, “Maintaining an Open Session” on
page 43.
Be sure you create a push mode connection if you’ll use the Application or
Push Moderator login, and a pull mode connection if you’ll use the Pull
Moderator login.
44Proprietary & Confidential
Page 59
Developing CAPI Applications
Notes
Use the Pull Moderator login for push mode; use the Application or Push
Moderator login for push mode.
You need to log into CACS before you can run any conferencing tasks. Use an
Application or Moderator login since the Participant has very few capabilities.
The Application Login is new in this release of CAPI. Use the Application
login to monitor multiple concurrent conferences, or for ACM functionality.
Note: This is a required step.
Sample Code
See “Sample Moderator Application” on page 63 to see the sample code in
context.
/**
* Sends a push mode Moderator login.
*/
public synchronized void login()
{
log.debug("log in");
}
catch( MarshallerException e )
{
log.fatal("Marshal error in login, exiting", e);
shutdown();
}
}
46Proprietary & Confidential
Page 61
Developing CAPI Applications
Saving Conference and Subscriber ID
MAPI contained an object model, so the conference and participant IDs were
saved in the conference object and sender objects. That layer does not exist
currently in CAPI, so you need to be sure to save the values once you’ve
created the conference, and pass them in when needed. (The conference ID is
passed back when you create a conference; take that value and save it.)
Sample Code
Here’s an example of the subscriberId and conferenceId. Refer to “Sample
Moderator Application” on page 63 to see the code in context.
/*
* We need to save these for future communications.
*/
private int subscriberId = -1;
private int confenceId = -1;
Registering the Application Login for Conference Start and Stop
Notification
The Application login was created as the mechanism for several new features
in CAPI; the primary one is to receive conference start and stop notification for
multiple concurrent conferences.
Event
APP_REGISTER_CONFS_ACTIVITY to begin getting notifications.
APP_UNREGISTER_CONFS_ACTIVITY to stop getting notifications.
Response
Registering: CONF_STARTED for success, NACK for failure.
Unregistering: No response.
Prerequisites
“Initial Procedures” on page 40 and “Application Login Prerequisites” on
page 39.
Notes
The response to this procedure is CONF_STARTED to indicate that the
registration was received and performed successfully. After that, when a
conference starts or stops, CONF_STARTED or CONF_ENDED will be sent as
a notification.
This procedure is different from an Application simply registering for a
conference, using the APP_REGISTER_CONF and
APP_UNREGISTER_CONF events.
Proprietary & Confidential 47
Page 62
ReadiVoice CAPI Developer’s Guide
The Application login isn’t associated with a particular conference, since its
primary functions are to monitor multiple conferences, and ACM
applications.
Application is a push login, so this procedure can be used only in push mode.
See “Application, Moderator, and Participant Logins” on page 13 for more
information about Application.
Setting Conference Security
Setting security is optional in CAPI.
Event
SET_CONF_SECURITY_CODE
Response
Pull: ACK for success, NACK for failure.
Push: CONF_SECURITY_CODE_CHANGED success, NACK for failure.
Prerequisites
The implementation of the conference security code (when
SET_CONF_SECURITY_CODE is sent after JOIN_CONF is sent) has been
updated. CAPI implementation changes the order and requires that
SET_CONF_SECURITY_CODE be sent before JOIN_CONF.
See also “Procedure Sequence” on page 37.
Notes
Security needs to be implemented before you have participants join a
conference. When you implement security first, the participants who then join
the conference will be prompted for the security code. If you run security after
they have joined, then they’re already in the conference so won’t be prompted
to enter the security code.
Security applies to anyone dialing in, and to some users dialing out. If the
dialout is set to the Default, then it is assumed that the person dialing out is a
Moderator, is the one setting up the security, and therefore doesn’t need to be
asked for the security code. For the ONE_CLICK dialout, however,
participants will be asked for the security code.
Dialing Participants
Note: For more information on callflows, refer to “Voice Prompts and Call
Flows” appendix of the ReadiVoice Administration and Maintenance Guide.
48Proprietary & Confidential
Page 63
Developing CAPI Applications
Dialing participants so that they can join the conference is one of the core tasks
in a conferencing application. CAPI provides a variety of ways to dial
participants:
•Standard dialing – Participants are placed into callflows as if they had
dialed into the system. They type in a conference code, record their name,
and so on.
One of the options with standard dialing is to dial out to a recording
device in addition to the participants; the device records the conference.
•One-click dialing – Participants are placed into a conference as if they had
dialed into the system. In a One-Click Conference, participants have a link
or icon, such as in an e-mail invitation, on which they can click. The
ReadiVoice system identifies the conference from the link’s URL and
returns a Web page asking for the participant’s phone number. When the
system gets this number, it calls and puts the connection in conference (or
on music hold, if the subscriber isn’t present and Quick Start is off). The
subscriber can use the same link, since the Web page provides a checkbox
to indicate subscriber and a field for entering the subscriber password.
•Blast dialing – A group of participants are dialed at once; this is a good
way to contact a large group of conference participants. When participants
pick up the phone, they are automatically joined to the conference.
•Instant dialing – Participants are placed directly into conference without
prompts. A participant is dialed and when he or she picks up the phone,
is instantly joined to the conference.
Event
DIAL_CALL
•Standard dialing – Use the CF_DEFAULT enum for the CallFlow
parameter
•Blast dialing – Use the CF_BLAST enum for the CallFlow parameter
•One-click dialing – Use the CF_ONECLICK enum for the CallFlow
parameter
•Instant-join dialing – Use the CF_INSTANT enum for the CallFlow
parameter
•Dialing out to a recorder – Use the CF_DEFAULT enum for the CallFlow
parameter, set the Part_Type to PT_RECORDER.
Response
Pull: ACK for success, NACK for failure.
Push: DIAL_STARTED or DIALOUT-CONNECTED for success; NACK for
failure.
Prerequisites
See “Procedure Sequence” on page 37.
Proprietary & Confidential 49
Page 64
ReadiVoice CAPI Developer’s Guide
General Notes
Anytime a participant’s status changes, such as when they join a conference,
the PART_INFO_CHANGED message is sent. When a participant joins the
conference, the message’s value is PIR_CONNECTED_TO_CONF, the
participant’s new state. If you want to track the number of participants in the
conference, you can read the PART_INFO_CHANGED message value and
increment the number of people in the conference.
Notes on Conference Recording
Refer to the ReadiVoice Administration and Maintenance Guide for information on
setting up a system for conference recording. You need to set up values in the
odprocrc
.
value is used by default unless you pass a different phone number when you
send the DIAL_CALL event.
Notes on Joining Participants for Different Callflow Types
There are four types of enums for the callflow type of the CALL_FLOW event.
The simple part of handling the code is to specify the correct enum type, as in
this example:
The main difference is more complex, and involves how you handle the code.
Depending on the call flow type, you need to send a JOIN_PART_TO_CONF
event for that participant to put them into conference.
•If you want the user to complete an action to join the conference, such as
clicking a button, send JOIN_PART_TO_CONF event for that participant
once they complete the action. This applies to the standard callflow for
which you use the CF_DEFAULT enum.
•If you want the user to be automatically included in the conference, use the
auto-joining call flow types: blast, one-click, and instant. For these, you
don’t need to send a join event since that functionality is already built into
the listed events.
Whether you send the join event explicitly, or whether the join happens
automatically because of the callflow, the response is
PART_INFO_CHANGED containing one of several enum values. If the
participant joins the conference, the value is PIR_CONNECTED_TO_CONF,
the participant’s new state.
Sample Code for Blast Dial
See “Sample Moderator Application” on page 63 to see the sample code in
context.
50Proprietary & Confidential
Page 65
Developing CAPI Applications
/**
* Dials up to two participants. Session must be active (logged in), and the
* conference started. Each call to this function will dial a participant
* until the maximum/desired number of dial attempts have been made, then it
* will just log an error and return.
*/
public synchronized void dialPart()
{
if ( !shouldRun )
{
return;
}
Validate.isTrue(loggedIn);
Validate.notEmpty(sessionId);
Validate.isTrue(confStarted);
Validate.notEmpty(phoneNum1);
Validate.notEmpty(phoneNum2);
try
{
if ( dialCount < 1 )
{
log.info("Dialing part one");
Once a user is connected, send a join to bring them into the conference.
Reply
Pull: ACK for success, NACK for failure.
Push: CALL_CONNECTED_TO_CHANGED, PART_INFO_CHANGED with
PIR_CONNECTED_TO_CONF for success, NACK for failure.
Prerequisites
See “Procedure Sequence” on page 37.
Notes
You need to use this event when you use standard dialing; using
CF_DEFAULT value of the DIAL_CALL event’s CallFlow parameter. When
you use blast, instant, or one-click dialing, the conference join is “built into”
that type of callflow so the conference join doesn’t need to be done explicitly.
Using the Waiting Room
A user is placed into the waiting room when the waiting room is active and the
conference is locked. (If the waiting room is not active, the user will be
disconnected rather than put in the waiting room.)
The waiting room allows a Moderator to keep participants in a separate
location after they have dialed in, but before they have joined the conference.
For more information, refer to the ReadiVoice Subscriber Guide and to Appendix
A of the Readivoice Administration and Maintenance Guide.
Event
Once a participant is in the waiting room, you can use the following events:
•ONE_TO_ONE – Puts the specified participant in a direct, or
“point-to-point” conversation with the conference moderator. You can
also use this event to take the participant out of the conversation and put
him or her back in the waiting room. For the Connect parameter, use True
to connect and False to put back in the waiting room.
•JOIN_PART_TO_CONF – Puts the specified participant in the conference.
•DISCONNECT_CALL – Disconnects the specified participant.
ONE_TO_ONE Response
Pull: ACK for success, NACK for failure.
52Proprietary & Confidential
Page 67
Developing CAPI Applications
Push: CALL_STATUS_CHANGED or CALL_CONNECTED_TO_CHANGED
for success, NACK for failure.
JOIN_PART_TO_CONF Response
Pull: ACK for success, NACK for failure.
Push: CALL_CONNECTED_TO_CHANGED, PART_INFO_CHANGED with
PIR_CONNECTED_TO_CONF for success, NACK for failure.
DISCONNECT_CALL Response
Pull: SUBSCR_INFO for success.
Push: N/A
Prerequisites
See “Procedure Sequence” on page 37.
Setting the Port for Asynchronous Responses on the Client
Four ports are used for push (asynchronous) mode:
•The sending port on the client
•The receiving port on the server
•The sending port on the server, for the asynchronous response
•The receiving port on the client, for the asynchronous response
The ports used are selected automatically or set to port 80 (receiving port on
the server). See “Understanding CAPI Communication: Synchronous and
Asynchronous” on page 9. You can specify the receiving port on the client for
the asynchronous response.
You can specify any port you like; a simple approach is to pass the value 0
when you send the event, and the system will in turn pick a locally available
port on the client.
The port is used per connection; you can have several sessions over the same
connection.
Sample Code
See “Sample Moderator Application” on page 63 to see the sample code in
context.
The following code example shows how to set the port to 0; note the lines in
bold. There are two sections of code.
Proprietary & Confidential 53
Page 68
ReadiVoice CAPI Developer’s Guide
public SimplePushModerator( String remoteHost, int remotePort, String localAsyncHost,
int localAsyncPort )
try
{
/*
* This is the listener for asynchronous event communication. When the server
* contacts for asynchronous communication on the specified port, this object
* will create a connection for the MessageBus.
*/
listener = new BasicListener(localAsyncPort);
/*
* The server uses the cookie to find out the details on how to establish
* the asynchronous connection with us.
*/
Cookie cookie = new BasicCookie(localAsyncHost, listener.getLocalPort());
/*
* We need to establish a basic HTTP connection to send commands and queries.
* In push-mode, responses will come back over the asynchronous connection.
*/
httpConnection = new HttpConnection("SimpleModHttp", remoteHost, remotePort, true,
Connection.DEFAULT_URL, cookie);
/*
* This is a handler for all events from the server/CACS.
*/
handler = new SimplePushModeratorHandler(this);
/*
* This objects handles conversion of the raw data off a connection into
* POJO representations of the CAPI events.
*/
unmarshaller = new CastorUnmarshaller(handler);
/*
* Once the CAPIUnmarshaller, the command sending HTTP connection, and the
* asynchronous connection listening service are set up, we give them to a
* MessageBus so it can use them to finish any further connection setup, and
* begin those communications as needed.
*/
messageBus = new BasicMessageBus(unmarshaller, httpConnection, listener);
54Proprietary & Confidential
Page 69
Developing CAPI Applications
/*
* This is the utility class that provides methods for sending the CAPI events
* to the server/CACS. These methods will handle marshalling of the passed
* arguments into the POJO representations of thoes events. It will then
* marshall those POJO representations into raw data and use the
* provided MessageBus to send to the server/CACS.
*/
sender = new CastorSender(messageBus);
shouldRun = true;
/*
* Start the main thread
*/
start();
}
catch( IOException e )
{
log.fatal("Error in setup, exiting", e);
shutdown();
}
}
... // handler class
public static void main( String[] args )
{
String cacsIp = "192.168.56.104";
int cacsPort = 80;
String localAsyncIp = "10.33.48.231";
int localAsyncPort = 0;
String logLevel = "ALL";
try
{
/*
* Set up the Log4J system
*/
RollingFileAppender appender = new RollingFileAppender(new TTCCLayout(),
"SimplePushModerator.log", true);
PatternLayout pl = new PatternLayout();
pl.setConversionPattern("%d{ISO8601} %-5p [%t]: %m%n");
appender.setLayout(pl);
BasicConfigurator.configure(appender);
}
Proprietary & Confidential 55
Page 70
ReadiVoice CAPI Developer’s Guide
catch( IOException e )
{
BasicConfigurator.configure();
}
Logger logger = Logger.getLogger("com");
logger.setLevel(Level.toLevel(logLevel));
/*
* Create a SimplePushModerator. It should take care of the rest.
*/
SimplePushModerator moderator = new SimplePushModerator(cacsIp, cacsPort, localAsyncIp,
localAsyncPort);
{
log.fatal("Marshal error in login, exiting", e);
shutdown();
}
}
Reading Events
To read events using the Java utility classes, you can use the methods in the
CastorMessageHandlerBase class.
Event
Any event you want to read; see code example and sample application.
Prerequisites
See “Procedure Sequence” on page 37.
Notes
The CastorMessageHandlerBase.java utility file and
SimplePushModeratorHandler.java sample file have extensive examples of
reading events.
Sample Code
See “Sample Moderator Application” on page 63 to see the sample code in
context.
Proprietary & Confidential 57
Page 72
ReadiVoice CAPI Developer’s Guide
public void handle( RVAPICONF_INFO_CHANGED message )
{
log.debug("Conf Info Changed...");
/*
* If this event is telling us that a conference has started inform the
* moderator accordingly
*/
if( message.getCiReason().getContent().getType() == RVAPISIMPLE_CI_REASON.CIR_CONF_STARTED_TYPE )
{
if( !moderator.isConfStarted() )
{
moderator.setConferenceId(message.getConfId().getContent());
moderator.setConfStarted(true);
}
}
}
Identifying Talkers
Identify the people talking in a specified conference.
Event
REGISTER_TALKER_UPDATE and UNREGISTER_TALKER_UPDATE
Response
Pull: N/A (only available to Push Moderator and Application login)
Push: TALKER_UPDATE event containing the participant IDs of the three
lines (the three talkers)
Prerequisites
See “Procedure Sequence” on page 37.
You can register or unregister for talker updates anytime after a conference has
started (you need the conference ID) and before the conference has ended.
Notes
REGISTER_TALKER_UPDATE is a request to register a specified conference
for Talker Update information. The response is the TALKER_UPDATE event
containing the talker information.
Sample Code
Refer to “Sample Moderator Application” on page 63 to see the code in
context.
58Proprietary & Confidential
Page 73
Developing CAPI Applications
/*
* You can register or unregister for talker updates anytime after a
* conference has started (you need the conference ID)and before the
* conference has ended.
*/
if ( confStarted && !talkerRegisterSent )
{
registerTalkers();
}
Using ACM to Interface With External Applications
ACM lets CAPI applications interface with external applications. Use the
Application login. See also “Using ACM” on page 30.
Event
ACM events in the event reference section.
Prerequisites
See “Procedure Sequence” on page 37.
Notes
The message passed through the sample code in
acmSender.acmQuery
depends
entirely on the type of messages that the ACM application understands. You
need to ensure that that message is understandable by the ACM application,
and handle any response that it sends.
Sample Code
The following example requests information from an ACM application.
Refer to “Sample Moderator Application” on page 63 to see the code in context.
/**
* Requests Acm data from an ACM application.
* @param acmAppId the application ID to request data from
* @param chanHndl the ID used to identify which channel's data to get
*/
public synchronized void getAcmData( int acmAppId, int chanHndl )
{
Validate.isTrue(loggedIn);
Validate.notEmpty(sessionId);
try
{
/*
* The ACM application ID needs to be known in order to query for data.
Proprietary & Confidential 59
Page 74
ReadiVoice CAPI Developer’s Guide
* This is the value that is configured in the RV ACM system
* administration. The query and response string formats and content
* are not specified in the API (CAPI) and thus must be the result of
* some kind of agreement between the two applications. This is because
* the server (CACS) only provides a convenience communication mechanism
* between Moderator and ACM applications, so that the two applications
* don't have to communicate directly. This request/response proxy
* feature is only there for convenience, and does not preclude well
* designed applications from direct communication outside of the CACS
* and CAPI framework.
*/
acmSender.acmQuery("SimpModPassback", sessionId, acmAppId,
ACM_QUERY_STRING_CHANHNDL + chanHndl + ","
+ ACM_QUERY_STRING_CONFID + conferenceId);
}
catch (MarshallerException e)
{
log.fatal("Marshal error in talker registration, exiting", e);
shutdown();
}
}
Conference-End Procedures
Use these procedures when you’re ready to end a conference.
Ending a Conference
A conference will end automatically when there are no participants. Here’s
how to end it explicitly.
Event
END_CONF
Response
Pull: ACK for success, NACK for failure.
Push: CONF_ENDED for success, NACK for failure.
Prerequisites
See “Procedure Sequence” on page 37.
Sample Code
Refer to “Sample Moderator Application” on page 63 to see the sample code
in context.
60Proprietary & Confidential
Page 75
Developing CAPI Applications
public synchronized void shutdown()
{
log.info("shutting down");
Logging out is the last step to complete when a conference is over.
Event
LOGOUT
Response
Pull: N/A
Push: N/A
Prerequisites
See “Procedure Sequence” on page 37.
Sample Code
Refer to “Sample Moderator Application” on page 63 to see the sample code
in context.
if( loggedIn )
{
try
{
/*
* This is not specifically needed since the server will kill
* the logout eventually, but it is good to send if possible.
*/
sender.logout("SimpModPassback", sessionId);
Proprietary & Confidential 61
Page 76
ReadiVoice CAPI Developer’s Guide
}
catch( MarshallerException e )
{
e.printStackTrace();
System.exit(1);
}
}
This section presents the CAPI sample application, which you can use as a
starting point for writing your own application.
The sample application contains two classes.
•
SimplePushModerator
thread of the sample application. This class sets up an asynchronous
push-mode Moderator communication system. With a
SimplePushModeratorHandler
application), it will log in, start a conference if one is not already started,
blast-dial two participants, and wait for the conference to end before
exiting.