Table of Contents Index NMS Glossary Previous Page Next Page Version


Chapter 4

Developing NaturalConference Applications


4.1 Introduction
4.1.1 Preparing the Hardware Environment
4.2 Setting up the CT Access Environment
4.2.1 Initializing CT Access for NaturalConference
4.2.2 Creating Event Queues and CT Access Contexts
4.2.3 Linking with NaturalConference
4.3 Opening a Conferencing Resource
4.4 Placing a Call
4.5 Creating Conferences
4.6 Adding a Member to a Conference
4.6.1 Establishing the Connection
Using Point to Point Switching
4.7 Accessing Conference Information and Attributes
4.8 Accessing Member Information and Attributes
4.9 Playing a Tone
4.10 NaturalConference Events
4.11 Closing a Conference
4.11.1 Conference and Call Completion
4.12 Disconnecting the Call
4.13 Closing CT Access Services

4.1 Introduction Top of Page

A NaturalConference application uses CT Access to control the PSTN interface. CT Access provides:

Figure 7 shows how CT Access and NaturalConference are used in a basic NaturalConference application:

chap42.gif

Figure 7. NaturalConference API Sequence


This chapter explains how to use CT Access and NaturalConference to create and manage conferences.
For more information about...

Refer to...

Functions

Chapter 6

Events

Appendix A

Parameters

Appendix B

4.1.1 Preparing the Hardware EnvironmentTop of Page

You must initialize and load the board(s) before you can run a CT Access or NaturalConference application. Use the board configuration utility to perform hardware configuration and initialization. For more information, see your board-specific installation and developer's manual.

4.2 Setting up the CT Access EnvironmentTop of Page

You must set up the CT Access environment before using the NaturalConference functions. Perform the following steps to set up the CT Access environment:

The following sections describe these steps.

4.2.1 Initializing CT Access for NaturalConferenceTop of Page

To use NaturalConference, you must specify the service name CNF either in the

If specified during ctaInitialize, the function's parameters could look like the following:

CTA_SERVICE_NAME service_names[] = {{"cnf", "cnfmgr"},
            {"swi", "swimgr"}
};
ret = ctaInitialize(service_names,sizeof(service_names)
/sizeof(CTA_SERVICE_NAME),NULL);
Note: If ctaInitialize's parameter specifies a list of CT Access services which do not explicitly include the CNF/CNFMGR pair, the application will not be able to use NaturalConference.
The content of the [ctasys] section is used only when the ctaInitialize parameter specifies the list of manager/service pairs as NULL. The following lines illustrate how that part of the [ctasys] section should look:

[ctasys]
Service = cnf, cnfmgr
Service = swi, swimgr

4.2.2 Creating Event Queues and CT Access ContextsTop of Page

Once CT Access is initialized, the application must create a queue and specify a manager to be used with that queue, and create CT Access contexts. Use the following functions:
To...

Use this function...

Description

Create an event queue

ctaCreateQueue

Accepts manager lists or uses the default manager list from the [ctasys] section.

Create CT Access contexts (ctahd)

ctaCreateContext

Specify the previously created queue as the queue for receiving the event related to the context.

You can choose to either create one queue per context or one queue for all contexts. A conference is attached to a queue by means of a resource handle (cnfresourcehd) opened by ctahd. The application itself must choose whether to receive events from conferences on the same or different queues. In order to receive events from different conferences on different queues, the application must create one ctahd and one cnfresourcehd for each conference.

The following diagrams show the different programming models of queue/conference attachment.

Figure 8 shows the basic model where one ctahd is created for all conferences in the system. This model does not allow the management of conferences on separate threads.

chap40.gif.

Figure 8. All Conferences On a Single resourcehd/ctahd/ctahqueue


Figure 9 illustrates the most flexible model, where a unique ctahd is created on a separate queue for each resource handle upon which a conference is created. This model allows for the management of conferences on separate threads.

chap41.gif

Figure 9. One Conference per resourcehd/ctahd/ctahqueue


A CT Access context obtains access rights for NaturalConference (not for creating conferences) when calling ctaOpenServices on a specified ctahd. The code that performs this should look like the following:

CTA_SERVICE_DESC service_descs[] =
{
{
{"cnf", "cnfmgr"}, /* name of the NaturalConference service    */
{0},               /* svcaddr -> reserved                      */
{0},               /* svcargs -> not used by NaturalConference */
{0}          /* mvipaddr -> not used by NaturalConference*/
}
};
ret = ctaOpenServices( ctahd, service_descs,
sizeof(service_descs)/sizeof(CTA_SERVICE_DESC) );
To open NaturalConference on a context, initialize a service_descs structure with the name field containing cnf and cnfmgr.

4.2.3 Linking with NaturalConferenceTop of Page

When building a new CT Access application that uses NaturalConference, link to cnfapi.lib (under UNIX, libcnfapi.so). The cnfmgr.dll (under UNIX, libcnfmgr.so) is dynamically loaded at runtime.

See the CT Access Service Writer's Manual for more details about service implementation.

4.3 Opening a Conferencing ResourceTop of Page

Opening the CNF service with ctaOpenServices allows the ctahd access to the NaturalConference API. The next step is to open a conferencing resource and obtain a resource handle (cnfresourcehd) to perform actions on the resource.

The following table lists the functions to use when opening a conference resource:
To...

Use this function...

Description

Retrieve a list of resource numbers defined in the system

cnfGetResourceList with appropriate parameters

Returns the resource numbers defined in the NaturalConference configuration file (cnf.cfg).

Note: By modifying the cnf.cfg you can increase or reduce the number of resources without having to recompile the program.

Obtain a conferencing resource handle (cnfresourcehd)

cnfOpenResource
using the resource number obtained with cnfGetResourceList.

Returns a resource handle (cnfresourcehd). This conferencing resource handle has a reference to the ctahd used when opening the resource. Each time you access the conference and member objects, use the cnfresourcehd instead of the ctahd.

Note: Wait for the CNFEVN_OPEN_RESOURCE_DONE event before using the cnfresourcehd. This event verifies that the cnfresourcehd was allocated (especially important when using the Server mode of CT Access).

Retrieve information associated with a conferencing resource

cnfGetResourceInfo with the returned cnfresourcehd

Returns a CNF_RESOURCE_INFO structure containing information such as the capabilities of the resource, the maximum number of members the resource can accept, and the number of members available for a new conference.

CNF_RESOURCE_INFO also gives you information about the board type and board number where the resource is located as defined in the cnf.cfg. Use this information to open a switching handle (swihd) associated with this resource. For example, the swihd is invoked when connecting a member of a conference to the trunk interfaces (see Section 4.6.1).

4.4 Placing a CallTop of Page

To place a call, invoke nccPlaceCall (from the NCC service) or adiPlaceCall (from the ADI service). Manage the call placement event sequence until the call is connected and an NCCEVN_CALL_CONNECTED or ADIEVN_CALL_CONNECTED event is generated. Refer to the Natural Call Control Service Developer's Reference Manual or the ADI Service Developer's Manual for complete details on call control.

4.5 Creating ConferencesTop of Page

After opening a conferencing resource and reviewing the resource capabilities, you can create a new conference. The following table lists the functions to use when creating a new conference:
To...

Use this function...

Description

Create a new conference

cnfCreateConference with the cnfresourcehd and appropriate parameters

Returns a conference identifier (confid ) to use when accessing the conference object.

To guarantee that you will be able to add a certain number of members to the conference, or if you know in advance how many members will participate in this conference, you can allocate a certain number of members when calling cnfCreateConference. You can also open a conference and allocate no members. You may be able to add members on the fly if the conferencing resource has room.

When calling cnfCreateConference you can use fewer capabilities than the resource supports, enabling you to add more members to the conference. For more information, see Section 3.2, Managing Resources.

Verify changes at the resource level after creating the conference

cnfGetResourceInfo

Returns a CNF_RESOURCE_INFO structure containing information such as the capabilities of the resource, the maximum number of members the resource can accept, and the number of members available for a new conference.

Note: After calling cnfCreateConference the number of conferences increases and the number of available members decreases.

Retrieve conference information

cnfGetConferenceInfo

Returns a CNF_ CONFERENCE _INFO structure containing information specified at conference creation (user value) and the number of members currently allocated to the conference.

Redefine the number of members allocated to a conference

cnfResizeConference with appropriate parameters

Allows you to increase or reduce the number of members that are allocated to the conference.

Retrieve a list of conferences

cnfGetConferenceList with appropriate parameters

Returns the confidlist.

By performing a loop using the returned confidlist, you can get information about each conference and retrieve the user value. For example:

for (confindex = 0; confindex < numconfid; confindex++)
{
error = cnfGetConferenceInfo(cnfresourcehd,
confidlist[confindex], &conferenceinfo,
sizeof(CNF_CONFERENCE_INFO));
.
. . }

4.6 Adding a Member to a ConferenceTop of Page

To add a member to a conference, follow these steps:

  1. Tell the conference a new member is joining and get the member's identifier.

    
    
  2. Retrieve the member's information to get the stream and timeslot corresponding to the member.

    
    
  3. Perform the switching command to physically establish a connection between the member's telephone line and the conference bridge.

    
    
  4. Set up one or more member attributes and activate the member in the conference.

The following table lists the functions to use when adding a member to a conference:
To...

Use this function...

Description

Add a member to a conference

cnfJoinConference with appropriate parameters

If the call succeeds, the member identifier (memberid) is returned and can be used by the application for any function call requiring a memberid.

Retrieve member information

cnfGetMemberInfo using a valid memberid

Returns a CNF_MEMBER_INFO structure containing the parameters passed at creation time (user value) as well as the switching related information, such as the input MVIP-95 local stream (even value) and the timeslot number associated with this member. To get the ouput MVIP-95 local stream, increment the input local stream by one. For more information, see Section 4.6.1, Establishing the Connection.

Retrieve the list of members currently attending the conference

cnfGetMemberList using a valid conference identifier

Returns the memberidlist.

You can get information about each member by performing a loop using the retrieved memberidlist. For example:

for (memberindex = 0; memberindex < nummemberid; memberindex ++)
 {
error = cnfGetMemberInfo(cnfresourcehd, memberidlist[memberindex],
         &memberinfo, sizeof(CNF_MEMBER_INFO));
.
.
.
}

4.6.1 Establishing the ConnectionTop of Page

After you add a member to a conference, set up the connection between the member's telephone line and the conference bridge. Streams 32 and 33 are reserved for NaturalConference. Use showcx95 to determine the number of timeslots available for conferencing.

The following table lists the number of reserved timeslots for each board type. Not all timeslots are used. The timeslot range does not have to be consecutive.
Board Type

Number of Reserved Timeslots

AG2000

256

AG4000 and AG4000C

3072

The following example code connects a member to the trunk interfaces (MVIP-95 local streams 0 and 1):

error = cnfGetMemberInfo(cnfresourcehd, memberid, &memberinfo,
                         sizeof(CNF_MEMBER_INFO));

/* Allocate SWI_TERMINUS input structure using memberinfo.stream and memberinfo.timeslot. */
SWI_TERMINUS input = { MVIP95_LOCAL_BUS, memberinfo.stream,
memberinfo.timeslot };
/* Allocate SWI_TERMINUS output structure for the trunk interface (stream 1) */ SWI_TERMINUS output = { MVIP95_LOCAL_BUS, 1, trunk.timeslot }; /* Full duplex connection */ error = swiMakeConnection(swihd, &input, &output, 1); input.stream += 1; output.stream -= 1; error = swiMakeConnection(swihd, &output, &input, 1);
Refer to the Switching Service Developer's Reference Manual for more information about switching.

Using Point to Point SwitchingTop of Page

To use the Point-to-Point Switching (PPX) service to establish the connection between the trunk streams and the member's conference seat, update ppx.cfg with local streams 32 and 33. For example:

            Inputs
                 LOCAL:0..14(2):0..23   # Trunk (0..29 for E1)
                 LOCAL:16..18(2):0..127 # DSP
             LOCAL:32:0..3071 # Conferencing stream
             End Inputs
             Outputs
                 LOCAL:1..15(2):0..23   # Trunk (0..29 for E1)
                 LOCAL:17..19(2):0..127 # DSP
             LOCAL:33:0..3071 # Conferencing stream             
             End Outputs

Refer to the Point-to-Point Switching Service Developer's Reference Manual for more information.

4.7 Accessing Conference Information and AttributesTop of Page

Conferences are created with both parameters and attributes. Conference parameters contain information about a given conference, and cannot change over the life of the conference. Attributes, on the other hand, denote certain special characteristics that a given conference possesses, and change frequently during the life of the conference.

You retrieve conference parameters and other information together in a corresponding CNF_CONFERENCE_INFO structure, while you access attributes individually.

You can assign the following types of attributes to a conference:
Attribute

Description

Loudest speaker

The number of loudest speakers used for generating the conference output signal. In the interest of quality, the number of mixed member voices is minimized for output signal generation. The Loudest Speakers attribute allows an application to adjust this number according to its needs.

Event mask

The bitmask describing the event the application is to receive for the conference.

Active talkers

The number of talking members factored in while generating the CNFEVN_ACTIVE_TALKERS_CHANGE event. This attribute allows an application to tune the way the CNFEVN_ACTIVE_TALKERS_CHANGE event is generated.

Active talkers timer

The minimum time (in multiples of 20ms) between the generation of two CNFEVN_ACTIVE_TALKERS_CHANGE events.

For a detailed description of conference attributes, see cnfGetConferenceAttribute.

The following table lists the functions for accessing conference information and attributes:
To...

Use this function...

Description

Retrieve conference information

cnfGetConferenceInfo

Returns a CNF_CONFERENCE_INFO structure containing all the information an application needs about a given conference.

Retrieve a conference attribute

cnfGetConferenceAttribute

Returns the value of the specified conference attribute.

Set a conference attribute

cnfSetConferenceAttribute

Sets the specified conference attribute.

4.8 Accessing Member Information and AttributesTop of Page

Information and attributes associated with member objects differ in the same way they do for conferencing objects. Members are created with both parameters and attributes. While member parameters cannot change over the life of the conference, member attributes change frequently during the life of the conference.

You retrieve member parameters and other information together in a corresponding CNF_MEMBER_INFO structure, while you access attributes individually.

You can assign the following types of attributes to conference members:
Attribute

Description

Gain control

The value of the input or output gain currently applied.

Talking and listening control

Indicates if the member is a talker or a listener in a conference.

Talker privileges

Indicates if the member is considered a privileged talker.

DTMF clamping

Indicates if the DTMF clamping capability is currently activated for this member.

Tone clamping

Indicates if the tone clamping capability is currently activated for this member.

Echo cancellation

Indicates if the echo cancellation capability is currently activated for this member.

Self echo

Indicates if the voice received from this member on its input is mixed and returned to that member on its output.

G.711 law

The current G.711 law applied in the member's input or output.

For a detailed description of the member attributes, see cnfGetMemberAttribute.

The following table lists the functions for accessing member information and attributes:
To...

Use this function...

Description

Retrieve member information

cnfGetMemberInfo

Returns a CNF_MEMBER_INFO structure containing all the information an application needs about a given member object.

Retrieve a member attribute

cnfGetMemberAttribute

Returns the value of the specified member attribute.

Set a member attribute

cnfSetMemberAttribute

Sets the specified member attribute.

Retrieve several member attributes

cnfGetMemberAttributeList

Retrieves multiple member attributes with one function invocation.

Set several member attributes

cnfSetMemberAttributeList

Sets multiple member attributes with one function invocation.

4.9 Playing a ToneTop of Page

NaturalConference provides the capability of playing a tone to all members of a conference. Use cnfStartTone to indicate that a new member is joining or leaving the conference. When cnfStartTone is invoked, members stop hearing each other and hear only the tone.

Tone attributes are stored in the CNF_TONE_PARMS structure. You can also set default parameters for the tone attributes. For more information on tone attributes, see cnfStartTone.

The following table lists the functions to use to play a tone:
To...

Use this function...

Description

Play a tone

cnfStartTone

The program plays a sequence of user-defined tones. When the specified number of iterations (defined in CNF_TONE_PARMS) is complete, NaturalConference generates a CNFEVN_TONE_DONE event if the event_mask was set to CNF_EVNMSK_TONE_DONE before cnfStartTone was called.

Abort tone generation or stop an infinite duration tone

cnfStopTone

The program immediately terminates active tone generation and generates a CNFEVN_TONE_DONE event if the event_mask was set to CNF_EVNMSK_TONE_DONE before cnfStartTone was called.

4.10 NaturalConference EventsTop of Page

NaturalConference uses the same event reporting mechanism as CT Access. ctaWaitEvent returns the CTA_EVENT structure informing the application about which event occurred on which CTA context. The structure includes information specific to the event.

Some events are generated only by setting the appropriate bit in the CNF.CONFERENCE_ ATTR event_mask parameter (refer to Appendix B) or by modifying the CONF_ATTR_EVENT_MASK attribute using cnfSetConferenceAttribute.

NaturalConference generates the following events:
Event

Description

CNFEVN_ACTIVE_TALKERS_CHANGE

One or more of the active talkers changed.

CNFEVN_CLOSE_RESOURCE_DONE

The cnfresourcehd was released.

CNFEVN_OPEN_RESOURCE_DONE

The cnfresourcehd was allocated.

CNFEVN_TONE_DONE

Tone generation completed or was stopped.

When receiving the CNFEVN_ACTIVE_TALKERS_CHANGE event, you can retrieve the actual list of members that are active talkers by calling cnfGetActiveTalkersList. If the space available for retrieving the list of members is large enough, the number of memberid fields filled by the function and returned in nummemberids is the number of members speaking, as defined by the attribute CONF_ATTR_ACTIVE_TALKERS value currently set for that conference. The returned list contains the member that is the active talker when the function is called. The active talker lists are not queued in NaturalConference.

4.11 Closing a ConferenceTop of Page

To close a conference, follow these steps:

  1. Remove all conference members by calling cnfLeaveConference.

    
    
  2. Close the conference by calling cnfCloseConference.

    
    
  3. Close the conferencing resource by calling cnfCloseResource.

4.11.1 Conference and Call CompletionTop of Page

Although a conference merges voices coming from different calls, there is no direct relationship between individual calls and conference members. The application features and scenarios drive the way calls and members are created and destroyed.

A call can be added or removed from the same or different conferences without having to be released.

When a call is disconnected, the application should force the corresponding member to leave the conference as soon as possible.

The following table lists the functions to use when closing a conference:
To...

Use this function...

Description

Remove a member from a conference

cnfLeaveConference

Removes the member from the conference and destroys the member identifier.

Close a conference

cnfCloseConference

Closes the conference and allows the system resources that were occupied by that conference to be used by other (new or existing) conferences located on the same resource.

Note: Closing a conference with members still joined does not have a negative impact on NaturalConference behavior. If a conference still contains members when it is closed, these members will be forced to leave in an automatic internal process equivalent to invoking cnfLeaveConference on each member. After the conference is empty, it will be destroyed.

Close a conference resource

cnfCloseResource

Closes the resource, allowing the system resources to be used by another application.

When you close a resource, all conferences using that cnfresourcehd are closed by an automatic internal process equivalent to calling cnfCloseConference on each running conference. Conferences using a different cnfresourcehd are not affected.

Note: Wait for the CNFEVN_CLOSE_RESOURCE_DONE event before making any other calls to the NaturalConference API (especially important when using the Server mode of CT Access). This event verifies that the resource was released.

4.12 Disconnecting the CallTop of Page

After a conference completes, the application must release the call. From the NCC service, use nccDisconnectCall, wait for the NCCEVN_CALL_DISCONNECTED event, then use nccReleaseCall. From the ADI service, use adiReleaseCall to release the call.

Refer to the Natural Call Control Service Developer's Reference Manual or the ADI Service Developer's Manual for complete details on call control.

4.13 Closing CT Access ServicesTop of Page

CT Access supports opening and closing services on a CTA context as needed during an application's execution. An application can free system resources it no longer needs to optimize performance.

Use ctaCloseServices to close the NaturalConference service. ctaCloseServices does not release the call, nor does it close the NCC or ADI service unless specified.



Table of Contents Index NMS Glossary Previous Page Next Page Version


Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2000, Natural MicroSystems, Inc. All rights reserved.