Sending commands to endpoint filters

Applications can control MSPP endpoints by using mspSendCommand to convey filter-specific commands to endpoint filters. When sending endpoint filter commands, the application must specify:

/* Macro used to build commands with filter definitions */

#define mspBuildCommand(filter,command) ((filter << 8) | command)

MSPEVN_SENDCOMMAND_DONE returns the modified ENDPOINT_PARMS structure in a buffer, including any entries modified by the associated filter command. Applications must wait for MSPEVN_SENDCOMMAND_DONE before sending a subsequent filter command to the same endpoint.

The commands available for each type of MSPP endpoint filter are listed in the Channel filter reference and in the mspcmd.h header file. RTP (Ipv4 and IPv6) and TPKT endpoints must be disabled before they can receive filter commands. DS0 endpoints can receive filter commands at any time.

Example: Adjusting the outgoing packet frame count

Fusion gateway applications can change the number of voice frames included in RTP packet payloads. The following sample code shows how an application uses mspSendCommand to change the frame quota for packets transferred by an RTP IPv4 full duplex endpoint:

     do
      {
        printf("Please enter a value between 1 and 6\n");
        scanf("%hd",&nFramesPerPkt);

      }while( (nFramesPerPkt > 6) || (nFramesPerPkt <0) ) ;
       pRtpAssemblerBuffer->value = H2NMS_DWORD(nFramesPerPkt);

       MspOutHd = &pVoiceChannelDbase[index]->hRtpRtcpFdxMspHd;
       CtaOutHd = &pVoiceChannelDbase[index]->hRtpRtcpFdxCtaHd;

       if( (ret = mspSendCommand(*MspOutHd, mspBuildCommand(MSP_ENDPOINT_RTPFDX, MSP_CMD_RTPFDX_CHG_QUOTA),
     pRtpAssemblerBuffer,sizeof(msp_ENDPOINT_RTPFDX_CMD) )))
        {
          printf("mspSendCommand() api failed \n");
        }
        ret = WaitForSpecificEvent(*CtaOutHd, 
     (MSPEVN_SENDCOMMAND_DONE|MSP_CMD_RTPFDX_CHG_QUOTA), &event );

        if ( ret == FAILURE)
        {
          printf("Mspp Send Command failed \n");
        }
        else if ( event.value != CTA_REASON_FINISHED )
        {
          printf("Mspp Send Command failed \n");
          ret = mspReleaseBuffer(event.objHd, event.buffer); 
          if ( ret != SUCCESS) 
            printf("Mspp release buffer failed...return code = %x\n",ret);
        }
        else
        {
          printf("Frames Per Packet changed to %d\n",nFramesPerPkt);
          ret = mspReleaseBuffer(event.objHd, event.buffer); 
          if ( ret != SUCCESS) 
            printf("Mspp release buffer failed...return code = %x\n",ret);
        }

The application uses the mspBuildCommand macro to build the filter command, and the mspSendCommand function to send this filter-specific command to the DS0 endpoint.