# mspGetFilterHandle

Retrieves a filter ID associated with an MSPP API endpoint filter or channel filter.

### Prototype

DWORD mspGetFilterHandle ( MSPHD msphd, DWORD filtertype, DWORD *fltID)

Return value | Description
msphd | Endpoint handle (ephd) returned by mspCreateEndpoint or channel handle (chnhd) returned by mspCreateChannel.
filtertype | MSPP API filter type. Valid filter types include: MSP_ENDPOINT_RTPOUT MSP_ENDPOINT_RTPFDX MSP_ENDPOINT_RTPOUT_V6 MSP_ENDPOINT_RTPFDX_V6 MSP_JITTER_FILTER
fltID | Pointer to a filter ID location.

### Return values

Event | Description
SUCCESS |
ADIERR_INVALID_CALL_STATE | Function not valid in the current call state. For example, many functions require the call to be in ADI_CC_STATE_CONNECTED.
CTAERR_BAD_ARGUMENT | Specified is filtertype invalid.
CTAERR_INVALID_CTAHD | Invalid msphd was specified.
CTAERR_INVALID_STATE | Function is not valid in the current state.

### Details

This function retrieves a board-level filter ID (fltID) associated with an MSPP channel or endpoint. You can use the fltID to connect ADI play and record filters to MSPP filters at runtime when implementing Dialogic native play and record.

Retrieving endpoint filter handles

When an application creates an MSPP API endpoint with mspCreateChannel, the MSPP API returns an endpoint handle (ephd). Applications use mspGetFilterHandle to retrieve the fltID associated with an existing RTP IPv4 or IPv6 endpoint. When invoking mspGetFilterHandle, the application specifies the endpoint handle (ephd) and the endpoint type (filtertype). The application can use the returned fltID as the egresshd argument for the ADI API adiSetNativeInfo function.

Retrieving channel filter handles

When an application creates an MSPP API channel with mspCreateChannel, the MSPP API returns a channel handle (chnhd). Applications use mspGetFilterHandle to retrieve the jitter filter handle (fltID) associated with the jitter filter in an existing MSPP channel. When invoking mspGetFilterHandle, the application specifies the channel handle (chnhd) and the filter type (in this case MSP_JITTER_FILTER). The application can use the returned fltID as the ingresshd argument for the ADI API adiSetNativeInfo function.

For more information about implementing Dialogic native play and record functionality, refer to the Dialogic® NaturalAccess™ Fusion VoIP API Developer's Manual.

### Example

ret = ctaCreateQueue(NULL, 0, &hCtaQueueHd);
ret = ctaCreateContext( hCtaQueueHd, 0, "Play", &ctahd );
ServiceCount = 2;
ServDesc[0].name.svcname = "ADI";
ServDesc[0].name.svcmgrname = "ADIMGR";
ServDesc[0].mvipaddr.board = board;
ServDesc[0].mvipaddr.mode = 0;
ServDesc[1].name.svcname = "MSP";
ServDesc[1].name.svcmgrname = "MSPMGR";
ServDesc[1].mvipaddr.board = board;
ret = ctaOpenServices( ctahd, ServDesc, ServiceCount);
ret = WaitForSpecificEvent( CTAEVN_OPEN_SERVICES_DONE, &event );
ret = adiStartProtocol( ctahd, "nocc", NULL, NULL );
ret = WaitForSpecificEvent( ADIEVN_STARTPROTOCOL_DONE, &event );
// create mspp RTP endpoint
ret = mspCreateEndpoint( ctahd, &mspAddr, &mspParm, &ephd);
// Wait for event
ctaWaitEvent( hCtaQueueHd, &event, CTA_WAIT_FOREVER );
// Check the reason code
if ( event.id != MSPEVN_CREATE_ENDPOINT_DONE ||
event.value != CTA_REASON_FINISHED )
return FAILURE;
// get cg6xxx board handle
ret = mspGetFilterHandle(msphd, MSP_FILTER_RTPFDX_EPH,
&cg6xxx_board_filter_handle);
// get default adi play parms
ret = adiSetNativeInfo( ctahd,
NULL, /* no ingress handle, as this is a play only */
cg6xxx_board_filter_handle,
&natpr_ctl); /* cg6xxx board filter handle */
ret = adiPlayFromMemory( ctahd,
ADI_ENCODE_EDTX_AMRNB, /* audio play */
MemoryBuffer, RecordedBytes, NULL);