cnfOpenResource

Opens a conference resource and obtains a conference resource handle.

Prototype

DWORD cnfOpenResource ( CTAHD ctahd, unsigned resourcenum, CNFRESOURCEHD *cnfresourcehd)

Argument

Description

ctahd

Context handle returned by ctaCreatecontext.

resourcenum

Conference resource number as declared in the NaturalConference configuration file (cnf.cfg).

cnfresourcehd

Pointer to a returned resource handle.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

cnfresourcehd is a NULL pointer.

CTAERR_BOARD_ERROR

Resource was defined in cnf.cfg, but the corresponding DSPs were not loaded by the configuration utility.

CTAERR_INVALID_CTAHD

ctahd is not a valid handle.

CNFERR_BOARD_TIMEOUT

Board timed out while waiting for a response message.

CNFERR_CANNOT_CREATE_CHANNEL

No communication channels are available for use on the specified resource.

CNFERR_RESOURCE_NOT_AVAILABLE

Resource number designated by resourcenum does not exist or is not available.

CNFERR_RESOURCE_NOT_DEFINED

Resource is not defined in the NaturalConference configuration file (cnf.cfg).


Events

Event

Description

CNFEVN_OPEN_RESOURCE_DONE

Function completed successfully and a new resource handle was allocated.


Details

cnfOpenResource opens a new conference resource handle on the resource specified by resourcenum. Many handles can be opened on the same conference resource. This handle is required for every other function in NaturalConference. Wait for CNFEVN_OPEN_RESOURCE_DONE before using the cnfresourcehd (important when using the Server mode of Natural Access).

For more information, refer to Creating conferences.

See also

cnfCloseResource, cnfGetResourceInfo

Example

extern CTAHD          ctahd;
extern CTAQUEUEHD     qhd;
               
DWORD myOpenResource(unsigned resnum)
{
      CNFRESOURCEHD newcnfresourcehd;
      DWORD error;
      CTA_EVENT evt;
      char  textbuf[80] = "";

          error = cnfOpenResource (ctahd,  resnum,  &newcnfresourcehd);
          if (error != SUCCESS)
          {
          }
          do
          {
              error = ctaWaitEvent( qhd, &evt, CTA_WAIT_FOREVER );
              if(error != SUCCESS)
              {
                  ctaGetText( ctahd, error, textbuf, sizeof( textbuf ) );
                  printf( "\rError when calling ctaWaitEvent => %s\n",
                      textbuf);
                  return(error);
              }
          } while ( evt.id != CNFEVN_OPEN_RESOURCE_DONE );