# mspCreateEndpoint

Creates an MSPP endpoint.

#### Prototype

DWORD mspCreateEndpoint ( CTAHD ctahd, MSP_ENDPOINT_ADDR* addr, MSP_ENDPOINT_PARAMETER* parm, MSPHD* ephd )

Argument | Description
ctahd | Context handle used to open the MSPP service. You can create only one MSPP endpoint per context.
addr | Pointer to an MSP_ENDPOINT_ADDR structure, as shown: typedef struct tag_MSP_ENDPOINT_ADDR { DWORD Size; // Size of this structure DWORD nBoard; // Board number DWORD eEpType; // Filter ID for the type of endpoint to create. union { DS0_ENDPOINT_ADDR DS0; RTPRTCP_ENDPOINT_ADDR RtpRtcp; RTPRTCP_V6_ENDPOINT_ADDR RtpRtcpV6; T38UDP_ENDPOINT_ADDR T38Udp; TPKT_ENDPOINT_ADDR Tpkt; } EP; } MSP_ENDPOINT_ADDR; Note: When the specified context is associated with an ADI service instance, the timeslot specified in the endpoint address structure must be the same timeslot used to open the ADI service on the specified ctahd. For more information, refer to Setting up the NaturalAccess environment.
parm | Pointer to an MSP_ENDPOINT_PARAMETER structure, as shown: typedef struct tag_MSP_ENDPOINT_PARMS { DWORD size; // Size of this structure DWORD eParmType; // MSP_ENDPOINT_DS0, MSP_ENDPOINT_RTPFDX, etc union { DS0_ENDPOINT_PARMS DS0; RTPRTCP_ENDPOINT_PARMS RtpRtcp; RTPRTCP_V6_ENDPOINT_PARMS RtpRtcpV6; T38UDP_ENDPOINT_PARMS T38Udp; TPKT_ENDPOINT_PARMS Tpkt; } EP; } MSP_ENDPOINT_PARAMETER;
ephd | Pointer to an MSPP return endpoint handle.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | Function argument includes an invalid value or a required pointer argument is NULL.
CTAERR_INVALID_CTAHD | Handle is invalid.
CTAERR_INVALID_HANDLE | Invalid handle was passed as an argument to this function.
MSPERR_DRIVER_COMMAND_FAILED | SPI command failed.

#### Events

Event | Description
MSPEVN_CREATE_ENDPOINT_DONE | Generated when an MSPP endpoint is created in response to mspCreateEndpoint. 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. The event.objHd indicates the ephd of the created endpoint.

#### Details

Applications create MSPP endpoints by invoking mspCreateEndpoint and specifying the ctahd used to open the MSPP service instance. In addition, applications specify parameters in an address structure and a parameter structure that define the endpoint's configuration.

The address structure specifies the type of endpoint to create, and the source and destination addresses for transferring the data. The parameter structure configures specific features that will be available on the MSPP endpoint.

When it creates the MSPP endpoint, the MSPP service returns a unique endpoint object handle (ephd) that the application can use to configure and control the endpoint. MSPP endpoints are enabled by default. For more information, refer to Creating MSPP endpoints.

The MSPP service provides the following set of endpoints for sending and receiving data to and from a network interface:

Endpoint type | Filter ID | Provide
DS0 (PSTN) | MSP_ENDPOINT_DS0 | Entry or exit points for transferring a voice or T.38 fax data. DS0 endpoints can be connected to simplex or duplex channels.
RTP IPv4 full duplex | MSP_ENDPOINT_RTPFDX | Entry and exit points for full duplex voice over IPv4 streams (includes an RTP header within UDP packets).
RTP IPv4 simplex receive | MSP_ENDPOINT_RTPIN | Entry points for a simplex voice over IPv4 data streams (includes an RTP header within UDP packets).
RTP IPv4 simplex send | MSP_ENDPOINT_RTPOUT | Exit points for simplex voice over IPv4 data streams (includes an RTP header within UDP packets).
RTP IPv6 full duplex | MSP_ENDPOINT_RTPFDX_V6 | Entry and exit points for full duplex voice over IPv6 streams (includes an RTP header within UDP packets).
RTP IPv6 simplex receive | MSP_ENDPOINT_RTPIN_V6 | Entry and exit points for simplex voice over IPv6 data streams (includes an RTP header within UDP packets).
RTP IPv6 simplex send | MSP_ENDPOINT_RTPOUT_V6 | Exit point for simplex voice over IPv6 data streams (includes an RTP header within UDP packets).
TPKT full duplex | MSP_ENDPOINT_TPKT | Entry and exit points for duplex voice data streams in which packets are processes according to the ThroughPacket multiplexing algorithm.
T38UDP full duplex | MSP_ENDPOINT_T38FDX | Entry and exit points for full duplex T.38 fax UDP data streams (including those carrying T.38 fax data).

#### See also

mspDestroyEndpoint, mspDisableEndpoint, mspEnableEndpoint

#### Example

mspAddr.eEpType = MSP_ENDPOINT_DS0;
mspAddr.nBoard = DEFAULT_BOARDID;
mspAddr.size = sizeof(DS0_ENDPOINT_ADDR);
mspAddr.EP.DS0.nTimeslot = 1;
mspParm.eParmType = MSP_ENDPOINT_DS0;
mspParm.EP.DS0.media = MSP_VOICE;
mspParm.size = sizeof(DS0_ENDPOINT_PARMS);
ret = mspCreateEndpoint( hCta, &mspAddr, &mspParm, &hEp);
if (ret != SUCCESS)
return FAILURE;
// Wait for event
ctaWaitEvent( hCtaQueHd, &Event, CTA_WAIT_FOREVER );
// Check the reason code
if ( Event.id != MSPEVN_CREATE_ENDPOINT_DONE ||
Event.value != CTA_REASON_FINISHED )
return FAILURE;