# Configuring Fusion NbUP Endpoint

Complete the following steps to instantiate and use an NbUP endpoint for audio only or 3G-324M over IP applications:

1. Create the NbUP endpoint using mspCreateEndpoint. After this step, the endpoint is created and all RTP related parameters are configured. No NbUP packets can be sent or received at this state.

2. Configure the NbUP protocol parameters using mspSendCommand. After this step, the NbUP endpoint is ready to start NbUP initialization.

3. Start the NbUP initialization using mspSendCommand. This step is only necessary if the endpoint was not configured to start automatically.

4. Completion of the NbUP initialization along with some other mid-session events are indicated as MSPP unsolicited events.

## Create the NbUP endpoint using mspCreateEndpoint

NbUP endpoints are special purpose RTP endpoints and can use the same parameters to create NbUP endpoints. Set the endpoint type in the MSP_ENDPOINT_ADDR structure to MSP_ENDPOINT_RTPFDX_NBUP instead of MSP_ENDPOINT_RTPFDX.

For more information, refer to the Dialogic® NaturalAccess™ Media Stream Protocol Processing API Developer’s Manual.

## Configure the NbUP protocol parameters using mspSendCommand

Use the mspSendCommand function to configure NbUP endpoints. Use the MSP_CMD_RTPFDX_NBUP_CONFIG command code and the parameters are sent through msp_ENDPOINT_RTPFDX_NBUP_CONFIG structure, as shown:

typedef struct {
U32 nbupmodemask; //The working mode of NBUP
#define NBUP_AUTO_START 0x1 // Bit 1 (1 – Start immediately, 0 – Don’t Start)
#define NBUP_INITMODE_MASTER 0x2 // Bit 2 (1 – Master Mode, 0 – Slave Mode)
#define NBUP_NO_ERROR_DETECTION 0x4 // Bit 3 (1 – PDU type 1, 0 – PDU Type 0)
U32 inittimerduration; // initialization phase duration
U32 initnbretry; // number of retry upon initialization failure
U32 codectype; // codec type
#define NBUP_CODEC_PCMU 10 // G.711 Mu-law
#define NBUP_CODEC_PCMA 11 // G.711 A-Law
#define NBUP_CODEC_AMR_475 32 // AMR 4.75 kbps
#define NBUP_CODEC_AMR_515 33 // AMR 5.15 kbps
#define NBUP_CODEC_AMR_59 34 // AMR 5.90 kbps
#define NBUP_CODEC_AMR_67 35 // AMR 6.70 kbps
#define NBUP_CODEC_AMR_74 36 // AMR 7.40 kbps
#define NBUP_CODEC_AMR_795 37 // AMR 7.95 kbps
#define NBUP_CODEC_AMR_102 38 // AMR 10.2 kbps
#define NBUP_CODEC_AMR_122 39 // AMR 12.2 kbps
#define NBUP_CODEC_H223 40 // H.223 Media
U32 payloadid; // payload id for NbUP packets
U32 frameduration; //The frame duration (5msec or 20msec)
#define NBUP_FD_5MSEC 5 //NbUp Frane Duration 5msec
#define NBUP_FD_20MSEC 20 //NbUp Frane Duration 20msec
} msp_ENDPOINT_RTPFDX_NBUP_CONFIG;

msp_ENDPOINT_RTPFDX_NBUP_CONFIG nbupcfg = {0};
nbupcfg.nbupmodemask = NBUP_INITMODE_MASTER|NBUP_NO_ERROR_DETECTION;
nbupcfg.inittimerduration = 5000; // 5 secs
nbupcfg.init_nbretry = 3; // 3 retries
nbupcfg.codectype = NBUP_CODEC_PCMU; // G.711 MU-LAW
nbupcfg.payloadid = 96;
nbupcfg.frameduration = NBUP_FD_5MSEC; // 5ms packets
if ( (ret = mspSendCommand( hRtpRtcpFdxMspHd,
mspBuildCommand(MSP_ENDPOINT_RTPFDX_NBUP,
MSP_CMD_RTPFDX_NBUP_CONFIG ),
&nbupcfg,
sizeof(msp_ENDPOINT_RTPFDX_NBUP_CONFIG )) != SUCCESS ))
{
printf("mspSendCommand Api failed for Configuring NBUP..error 0x%x\n", ret);
}

### msp_ENDPOINT_RTPFDX_NBUP_CONFIG

The following table describes the msp_ENDPOINT_RTPFDX_NBUP_CONFIG structure:

Field | Default | Description
nbupmodemask | 0x0 | Bit Mask indicating the working mode for NbUP endpoint. Each bit enables/disables a particular feature as given below: Bit 1 – Auto Start (0 – Don’t Start, 1 – Start Immediately) Bit 2 – Master / Slave Mode (0 – Slave Mode, 1 – Master Mode) Bit 3 – NbUP PDU type used for media transfer (0 – PDU Type 0; with Payload CRC, 1 – PDU Type 1, without Payload CRC) Bit 4 – 32 - Reserved
inittimerduration | 1000 ms | Initialization phase timer value. In master mode, the endpoint waits for this period to receive a positive or negative acknowledgement (ACK/NACK) before re-transmitting the INIT message. In slave mode, the endpoint waits for inittimerduration*( initnbretry + 1) to receive an INIT message from remote end before timing out.
initnbretry | 3 | In master mode, the endpoint attempts these many retries in case of initialization timeout before ending the session.
codectype | 10 | Type of media to transfer. Also indicates the payload ID to pass onto the decoder in the connected MSPP channel.
payloadid | 96 | Payload ID of the RTP packets to be sent and received. These packets contain NbUP data as their payload. On the sending side, the endpoint replaces the payload ID set by the encoder in the connected MSPP channel, with this value.
frameduration | 5 ms | Duration of the media put into each NbUP / RTP packet. For G.711 or H.223, the duration can be configured as either 5 ms (40 bytes payload) or 20 ms (160 bytes payload). For AMR, the duration is always 20 ms. This field also overrides the value of RTP framequota.

## Start the NbUP initialization using mspSendCommand

Use the mspSendCommand function with command code MSP_CMD_RTPFDX_NBUP_START to start the NbUP Initialization phase, unless the endpoint was configured to start automatically after configuration through NBUP_AUTO_START.

if (ret = mspSendCommand( hRtpRtcpFdxMspHd,
mspBuildCommand(MSP_ENDPOINT_RTPFDX_NBUP, MSP_CMD_RTPFDX_NBUP_START ),
NULL, 0) != SUCCESS )
{
printf("could not start NBUP negotiation - error 0x%x\n", ret);
}

## Stopping the NbUP Session

Use the MSP_CMD_RTPFDX_NBUP_STOP command to stop the current NbUP session. Any session must be stopped to re-configure the endpoint with a new set of NbUP parameters.

if (ret = mspSendCommand( hRtpRtcpFdxMspHd,
mspBuildCommand(MSP_ENDPOINT_RTPFDX_NBUP, MSP_CMD_RTPFDX_NBUP_STOP ),
NULL, 0) != SUCCESS )
{
printf("could not stop NBUP session- error 0x%x\n", ret);
}