# mspCreateChannel

Creates an MSPP media channel.

#### Prototype

DWORD mspCreateChannel ( CTAHD ctahd, MSP_CHANNEL_ADDR* addr, MSP_CHANNEL_PARAMETER* parm, MSPHD* chnhd )

Argument | Description
ctahd | Context handle used to open the MSPP service.
addr | Pointer to an MSP_CHANNEL_ADDR structure, as shown: typedef struct tag_MSP_CHANNEL_ADDR { DWORD size; /* size of this structure */ DWORD nBoard; /* Channel location (board number) */ MSP_TYPE_CHANNEL channelType; /* Type of channel to create */ DWORD FilterAttribs; /* Enables DSP Filter functions */ } MSP_CHANNEL_ADDR;
parm | Pointer to the MSP_CHANNEL_PARAMETER structure, as shown: typedef struct tag_MSP_CHANNEL_PARMS { DWORD Size; MSP_CHANNEL_TYPE channelType; union { MSP_VOICE_CHANNEL_PARMS VoiceParms; MSP_FAX_CHANNEL_PARMS FaxParms; MSP_RTP_SWITCHING_CHANNEL_PARMS RtpSwitchingParms; MSP_UNDEFINED_CHANNEL_PARMS Undefined; } ChannelParms; } MSP_CHANNEL_PARAMETER; This structure is not required for RTP switching channels. When creating record channels, applications specify channel parameters in a MSP_VOICE_CHANNEL_PARMS structure. Since record channels only contain a single jitter filter, the application only specifies jitter parameters in the structure.
chnhd | Pointer to an MSPP return channel handle.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | A function argument includes an invalid value or a required pointer argument is NULL.
CTAERR_INVALID_CTAHD | The handle is invalid.
CTAERR_INVALID_HANDLE | An invalid handle was passed as an argument to this function.
MSPERR_CHANNEL_NOT_DEFINED | The MSPP channel name specified is not defined.

#### Events

Event | Description
MSPEVN_CREATE_CHANNEL_DONE | Generated when an MSPP channel is created in response to mspCreateChannel. The event.value field can contain the following: CTA_REASON_FINISHED MSPRSN_FAILED_TO_ALLOCATE The MSPP service is unable to allocate on-board resources. For example, the necessary DSP resources may not be loaded, or the specified UDP port may not be available. The event.objHd indicates the chnhd of the created channel.

#### Details

When invoking mspCreateChannel, applications specify a context handle (ctahd), channel type, and the board number for the channel. When it creates the MSPP channel, the MSPP service returns a unique channel object handle (chnhd) that the application can use to configure and control the channel. Once you have created an MSPP channel and enabled it, you can use it to connect MSPP endpoints to create a media path for voice or fax data. For more information, refer to Creating MSPP channels.

Supported MSPP channels include:

Channel ID | Description
FaxRelayFullDuplex | Processes a full duplex data stream by modulating and demodulating T.38 fax data.
G711DecodeSimplex | Processes a simplex data stream by decoding voice data according to the G.711 algorithm.
G711EncodeSimplex | Processes a simplex data stream by encoding voice data according to the G.711 algorithm.
G711FullDuplex | Processes a full duplex data stream by encoding and decoding voice data according to the G.711 algorithm.
G711RecordChannel | Performs jitter buffering and transfers an incoming data stream from an RTP endpoint to a record filter. G.711 recorder channels contain only a jitter filter and can be used with ADI record functions when there is no need to decode the incoming data stream. G.711 recorder channels do not require DSP resources.
G723DecodeSimplex | Processes a simplex data stream by decoding voice data according to the G.723.1/A algorithm.
G723EncodeSimplex | Processes a simplex data stream by encoding voice data according to the G.723.1/A algorithm.
G723FullDuplex | Processes a full duplex data stream by encoding and decoding voice data according to the G.723.1/A algorithm.
G723RecordChannel | Performs jitter buffering and transfers an incoming data stream from an RTP endpoint to a record filter. G.723.1 recorder channels contain only a jitter filter and can be used with ADI record functions when there is no need to decode the incoming data stream. G.723.1 recorder channels do not require DSP resources.
G726DecodeSimplex | Processes a simplex data stream by decoding voice data according to the G.726 algorithm.
G726EncodeSimplex | Processes a simplex data stream by encoding voice data according to the G.726 algorithm.
G726FullDuplex | Processes a full duplex data stream by encoding and decoding voice data according to the G.726 algorithm.
G726RecordChannel | Performs jitter buffering and transfers an incoming data stream from an RTP endpoint to a record filter. G.726 recorder channels contain only a jitter filter and can be used with ADI record functions when there is no need to decode the incoming data stream. G.726 recorder channels do not require DSP resources.
G729DecodeSimplex | Processes a simplex data stream by decoding voice data according to the G.729A/B algorithm.
G729EncodeSimplex | Processes a simplex data stream by encoding voice data according to the G.729A/B algorithm.
G729FullDuplex | Processes a full duplex data stream by encoding and decoding voice data according to the G.729A/B algorithm.
G729RecordChannel | Performs jitter buffering and transfers an incoming data stream from an RTP endpoint to a record filter. G.729 recorder channels contain only a jitter filter and can be used with ADI record functions when there is no need to decode the incoming data stream. G.729 recorder channels do not require DSP resources.
RTPSwitchingSimplex | Conveys a simplex data stream between two RTP endpoints. The channel does not process the data, but merely passes the data on to the next RTP endpoint. Applications can combine two simplex switch channels to create a duplex data path.

#### See also

mspDestroyChannel, mspDisableChannel, mspEnableChannel, mspSendCommand

#### Example

mspChanAddr.nBoard = DEFAULT_BOARDID;
mspChanAddr.channelType = G711FullDuplex;
ret = mspCreateChannel( hCta, &mspChanAddr, NULL, &hChan );
if (ret != SUCCESS)
return FAILURE;
ctaWaitEvent( hCtaQueHd, &Event, CTA_WAIT_FOREVER );
// Check the reason code
if ( Event.id != MSPEVN_CREATE_CHANNEL_DONE ||
Event.value != CTA_REASON_FINISHED )
return FAILURE;