# Native play and record test: natprdemo

natprdemo demonstrates:

- Initializing NaturalAccess and creating multiple contexts.

- Creating an MSPP channel with RTP and DS0 endpoints.

- Using ADI API and Voice message API functions to play and record RTP media streams without transcoding, and collecting RFC2833 digits on the MSPP channel.

- Passing RFC 2833 digits to the ADI digit collection function.

#### Usage

natprdemo -R remoteIPaddress -r remoteportnum options

where

- remoteIPaddress is the IPv4 address of the remote device,

- remoteportnum is the UDP port of the remote device,

- options include the following:

Option | Description
-b boardnum | Board number. Default is 0.
-e recordencoder | Type of encoding for record. Default is 46 (EDTX mu-law). Valid values include: 46 = EDTX mu-law 47 = EDTX A-law 48 = EDTX G.726 ADPCM 49 = EDTX G.729a 50 = EDTX G.723 153 = EDTX AMR
-p playencoder | Type of encoding for play. Default is 10. Valid values include: 10 = mu-law11 = A-law 20 = 32 bit G.726 ADPCM 46 = EDTX mu-law 47 = EDTX A-law 48 = EDTX G.726 ADPCM 49 = EDTX G.729a 50 = EDTX G.723 153 = EDTX AMR
-f filename | Name of the file to which you want to direct recorded data. Default is temp.vox.
-L localIPaddress | IPv4 address of the local computer. Default is 127.0.0.1.
-l localportnum | UDP port to use on the local computer. Default is the same port number as the remote port.
-q | Quiet mode. This option suppresses most console messages.
-s timeslot | IVR timeslot number. Default is 0.
-d value | Decode Record stream flag. Valid values include: 1 = Use decoder 0 = Do not use decoder You must enable the decoder (the default setting)if you are implementing silence detection.

#### Description

natprdemo uses the MSPP API and NaturalAccess to implement an interactive voice response (IVR) application for IP telephone calls. It establishes a two-way voice path from the local computer to a remote IP address and port. The demonstration program does not set up the call or obtain the remote address. In an actual application, call setup is handled by a separate protocol such as the session initiation protocol (SIP).

This program demonstrates synchronous programming on a single port. After each command, natprdemo retrieves events continuously until the expected event returns.

#### Procedure

Run natprdemo by using a telephone connected to a full duplex G.711 RTP stream at a known IP address and port (for example, a gateway that uses a CG board).

To run natprdemo:

Step | Action
1 | Navigate to the \nms\fusion\samples\natprdemo directory in Windows or the /opt/nms/fusion/samples/natprdemo directory in Linux.
2 | Enter the following command: natprdemo -R remoteIPaddress -r remoteportnum
3 | From the telephone, listen for the greeting. After playing the greeting, natprdemo displays a menu of options.
4 | From the telephone, press 1.
5 | Record a brief voice message.
6 | Press 2.
7 | Verify that the recorded message plays back.
8 | Close natprdemo by pressing 3.