Native play and record test: natprtest

The Native play record test (natprtest) program verifies that the system supports creating and enabling MSPP connections and ADI ports and demonstrate NMS native play and record functionality. This sample program demonstrates NaturalAccess and Fusion functions executing in asynchronous mode.

Featured functions

NaturalAccess, Voice Message API, MSPP API, and ADI API functions.

Purpose

Use natprtest to:

Usage

natprtest [options]

where valid options include:  

Option

Description

A xxxmgr

The NaturalAccess service manager. Default: ADIMGR

-b n

The board number n. Default: 0

-C filename

Load a keyword configuration from a text file.

Keywords supported are:

  • Board=n
    Where n specifies the board number.

  • Stream=n
    Where n specifies the logical stream.

  • Slot=n
    Where n specifies the logical timeslot.

  • Mspp.localIP=xx.xx.xx.xx
    Specifies the local IP address for MSPP endpoints.

  • Mspp.remoteIP=xx.xx.xx.xx
    Specifies the remote IP address for  MSPP endpoints.

  • Mspp.LocalUdpPort=port
    Where port specifies the local UDP port for MSPP endpoints.

  • Mspp.UdpPort=port
    Where port specifies the remote UDP port for MSPP endpoints.

  • msp_channelType=chantype
    Where chantype is enumerated as defined below.

  • PayloadId=pid  
    Where pid specifies the RTP payload ID to use for MSPP endpoint egress packets.

-f filename

The file name to retrieve service names. Default: None

-F filename

The name of the NaturalAccess configuration file. Default: cta.cfg. The configuration file must specify to initialize the msp service and msgmgr service manager.

-i filename

The name of the input file. This option allows you to use a file that lists NaturalAccess test commands and data line by line, instead of entering the commands interactively.

-l

Show low-level events.

-p protocol

Protocol to run. Default is nocc.

-s [stream:]slot

The port (DSP) address. Default is 0:0.

-e localip

Local IP address for an RTP or UDP endpoint. If no RTP or UDP endpoint is created, this value is ignored. The IP address must be appropriate for the type of RTP endpoint specified (that is, an IPv4 address for an IPv4 endpoint or an IPv6 address for an IPv6 endpoint). Entering 0 indicates that the data will not be transferred to an IP network. Use for testing purposes only.

-r remoteip

Remote IP address for an RTP or UDP endpoint. If no RTP or UDP endpoint is created, this value is ignored. The IP address must be appropriate for the type of RTP endpoint specified (that is, an IPv4 address for an IPv4 endpoint or an IPv6 address for an IPv6 endpoint). Entering 0 indicates that the data will not be transferred to an IP network. Use for testing purposes only.

-c chantype

Type of MSPP channel to connect endpoints.

Valid channel types include:

1      G.711 full duplex

2      G.723 full duplex

3      G.726 full duplex

4      G.729 full duplex

5      Fax relay full duplex

6      G.711 encoder simplex

7      G.711 decoder simplex

8      G.723 encoder simplex

9      G.723 decoder simplex

10    G.726 encoder simplex

11    G.726 decoder simplex

12    G.729 encoder simplex

13    G.729 decoder simplex

14    G.728 full duplex

15    G.728 decoder simplex

16    G.728 encoder simplex

17    RTP switching simplex

-t tracemode

Enables or disables tracing.

d = Disable tracing

r = Enable tracing (default)

-v

Set the NaturalAccess compatibility level to 0.

-w

Wait before exit.

-?

Access help.

Description

natprtest is a menu-driven interactive program. Enter one- and two-letter commands to execute NaturalAccess and NCC API, ADI API, MSPP or VCE API commands. Some commands prompt for additional information, such as frequencies and amplitudes for tone generators. For more information about the service commands, refer to the service-specific reference manuals.

The following table describes the available commands:

Function

Command

Description

Help

H

Displays a table of available commands.

Quit

Q

Exits from natprtest.

Repeat command

!

Repeats the previous command.

Abort dial

AD

Calls adiStopDial.

Abort timer

AT

Calls adiStopTimer.

Accept call

CC

Calls nccAcceptCall.

Answer call

AC

Calls nccAnswerCall.

Assert signal

AS

Calls adiAssertSignal.

Attach context

AX

Calls ctaAttachContext.

Attach object

AO

Calls ctaAttachObject.

Block calls

BC

Calls nccBlockCalls.

Call progress begin

CB

Calls adiStartCallProgress.

Call progress stop

CS

Calls adiStopCallProgress.

Call status

C?

Calls nccGetCallStatus.

Change context

CH

Switches between different contexts created by natprtest with the CX or PX commands.

Close services (new)

CV

Calls ctaCloseServices.

Close services (old)

CP

Calls ctaDestroyContext.

Collect digits

CD

Calls adiCollectDigits.

Collect stop

SC

Calls adiStopCollection.

Get context information

CN

Calls ctaGetContextInfoEx.

Continuous event fetch

CE

Enables fetching of events.

Create context

CX

Calls ctaCreateContextEx.

Create persistent context

PX

Calls ctaCreateContextEx with the CTA_CONTEXT_PERSISTENT flag set.

Create void context

VX

Calls ctaCreateContext with ctaqueuehd set to NULL_CTAQUEUEHD.

Destroy context

DX

Calls ctaDestroyContext.

Digit flush

DF

Calls adiFlushDigitQueue.

Digit get

DG

Calls adiGetDigit.

Digit peek

DP

Calls adiPeekDigit.

Disable bit detector

DB

Calls adiStopSignalDetector.

Disable DTMF detector

DD

Calls adiStopDTMFDetector.

Disable energy detector

DE

Calls adiStopEnergyDetector.

Disable MF detector

DM

Calls adiStopMFDetector.

Disable tone detector

DT

Calls adiStopToneDetector.

Disconnect call

DC

Calls nccDisconnectCall.

Detach object

DO

Calls ctaDetachObject.

Enable bit detector

EB

Calls adiStartSignalDetector.

Encoding information

EI

Calls vceGetEncodingInfo.

Set native play and record information

SN

Calls adiSetNativeInfo.

Enable DTMF detector

ED

Calls adiStartDTMF.

Enable energy detector

EE

Calls adiStartEnergyDetector.

Enable MF detector

EM

Calls adiStartMFDetector.

Enable tone detector

ET

Calls adiStartToneDetector.

Enumerate contexts

EC

Lists contexts created by natprtest with the CX, PX, or VX commands.

Find file

FF

Calls ctaFindFile.

Format event

FE

Calls ctaFormatEventEx.

FSK abort receive

FA

Calls adiStopReceivingFSK.

FSK receive

FR

Calls adiStartReceivingFSK.

FSK send

FS

Calls adiStartSendingFSK.

Generate DTMFs

GD

Calls adiStartDTMF.

Generate net tone

GN

Calls adiStartTones.

Generate wink

GW

Calls adiStartPulse.

Generation stop

GS

Calls adiStopTones.

Generate user tone

GT

Calls adiStartTones.

Get call status

L?

Calls nccGetLineStatus.

Get context list

CL

Calls ctaQueryServerContexts.

Get event source

GM

Calls ctaGetEventSources.

Get object descriptor

DH

Calls ctaGetObjDescriptor.

Get one event

GE

Enables fetching of one event.

Get parameter ID

PI

Calls ctaGetParmID.

Get server version

RV

Calls ctaGetVersionEx.

Get service version

SV

Calls ctaGetServiceVersionEx.

Hold call

OC

Calls nccHoldCall.

Loopback event

LE

Calls ctaQueueEvent.

Modify play gain

MG

Calls vceSetPlayGain.

Modify play speed

MS

Calls vceSetPlaySpeed.

Open services (new)

OV

Calls ctaOpenServices.

Open services (old)

OP

Calls ctaCreateContext and ctaOpenServices.

Place call

PC

Calls nccPlaceCall.

Play file

PF

Calls vceOpenFile and vcePlayMessage.

Play memory

PM

Calls vcePlayMessage.

Play/receive status

P?

Call vceGetContextInfo.

Play/receive stop

PS

Calls vceStop.

Play/record status

R?

Calls vceGetContextInfo.

Play/record stop

RS

Calls vceStop.

Query capability

CQ

Calls nccQueryCapability.

Query services

ES

Calls ctaQueryServices.

Record file

RF

Calls vceCreateFile and vceRecordMessage.

Record memory

RM

Calls vceCreateMemory, vceEraseMessage, and vceRecordMessage.

Refresh parameters

RP

Calls ctaRefreshParms.

Reject call

JC

Calls nccRejectCall.

Release call

RC

Calls nccReleaseCall.

Retrieve call

RR

Calls nccRetrieveCall.

Send digits

ND

Calls nccSendDigits.

Server shutdown

SH

Calls ctaShutdown.

Set call handle

IH

Specifies active and held call handles.

Set default server

SS

Calls ctaSetDefaultServer.

Set event handler

EH

Calls ctaSetErrorHandler.

Set event source

SM

Calls ctaSetEventSources.

Set parameters

PD

Calls ctaGetParmByName and ctaGetParmInfo.

Set server trace

TR

Calls ctaSetGlobalTraceMask.

Set timeslot

TS

Specifies a timeslot to open the NCC service.

Show state

X

Calls adiGetContextInfo and nccGetLineStatus.

Signal bit query

SQ

Calls adiQuerySignalState.

Start dial

SD

Calls adiStartDial.

Start protocol

SP

Calls nccStartProtocol or adiStartProtocol.

Start timer

ST

Calls adiStartTimer.

Stop event fetch

SE

Disables continuous fetch of events.

Stop protocol

UP

Calls nccStopProtocol or adiStopProtocol.

Supervised transfer

VT

Calls nccTransferCall.

Toggle pattern

TP

Calls adiAssertSignal.

Trace

W

Calls ctaSetTraceLevel.

Unblock calls

UC

Calls nccUnblockCalls.

View parameters

VD

Calls ctaGetParmID and ctaGetParmInfoEx.

Open MSPP port

MO

Calls ctaCreateContext and ctaOpenServices for the MSPP service.

Close MSPP port

MC

Calls ctaDestroyContext.

Create RTP Endpoint

MR

Calls mspCreateEndpoint with MSP_ENDPOINT_RTPFDX endpoint type.

Create DS0 endpoint

MX

Calls mspCreateEndpoint with MSP_ENDPOINT_DS0 endpoint type.

Create MSPP channel

MH

Calls mspCreateChannel.

Connect MSPP channel

MN

Calls mspConnect.

Enable MSPP channel

MA

Calls mspEnableChannel.

Disable MSPP channel

MB

Calls mspDisableChannel.

Get MSPP filter handle

MF

Calls mspGetFilterHandle.

Set marker string

MM

Prompts for a string prefix for the next command response in the log file.

You can enter commands while asynchronous functions execute, allowing you to execute multiple asynchronous functions concurrently or to stop functions. For example, you can run a tone detector (ET) and record voice (RF) simultaneously. Abort any of these functions by entering the respective stop command (DT and RS for tone and record). You can view NaturalAccess parameters (VD) or modify NaturalAccess parameters (PD). If ctdaemon is running, shared system global defaults are copied to the context. Otherwise, the local compiled defaults are copied. The commands prompt you to view or modify context parameters or global defaults.

natprtest writes trace messages to ctdaemon if ctdaemon is running. Use ctdaemon or ctaSetTraceLevel (W command) to set the global or local trace mask. To loop back an application event, use ctaQueueEvent (LE command).

Programming notes

natprtest includes functions for retrieving commands from the keyboard and executing them. These functions include:

Function

Description

PerformFunc

Executes the keyboard commands and initiates Natural Access, NCC service, or ADI API functions.

Main

Processes options, creates NaturalAccess event queue, and goes into ctaWaitEvent loop.

MyPlayAccess

Voice play callback.

MyRecAccess

Voice record callback.

MyEventHandler

Displays the event and performs post-event processing (for example, closes files, prints extra information).