Setting or retrieving the nonlinear processing state

Nonlinear processing (NLP) removes residual echo by attenuating the return path when there is no far-end speech. Natural-sound, adaptive-threshold, NLP technology provides excellent voice quality while avoiding signal clipping. The NLP control allows you to enable or disable the NLP feature for a trunk port. NLP is enabled by default.

Use swiConfigLocalTimeslot to enable or disable NLP and swiGetLocalTimeslotInfo to retrieve the current setting. Set the arguments for these functions as follows:

Argument

Field

Value

swihd

 

Handle returned by swiOpenSwitch.

args

localstream

Identifies the target trunk on the local bus. Specify the number of either the transmit or receive voice stream.

Refer to CG 6060 switch models for more information.

localtimeslot

Identifies the target timeslot on the trunk. Specify the timeslot number of the target trunk port on the local bus.

Refer to CG 6060 switch models for more information.

deviceid

Device type on the local bus. The deviceid is MVIP95_T1_TRUNK_DEVICE or MVIP95_E1_TRUNK_DEVICE.

For information about the deviceid, refer to the Dialogic® NaturalAccess™ Switching Interface API Developer's Manual.

parameterid

Data item to configure or query. Set to NMS_ECHO_CHANNEL_NLP (0x80000020).

buffer

 

Points to the NMS_ECHO_CHANNEL_NLP_PARMS structure. Valid values are:

0 = NMS_ECHO_DISABLE_NLP

1 = NMS_ECHO_ENABLE_NLP

size

 

Size of buffer, in bytes.

The NMS_ECHO_CHANNEL_NLP_PARMS structure is:

typedef struct
{
    DWORD enable_NLP;  // 0=no NLP, 1=NLP enabled

}   NMS_ECHO_CHANNEL_NLP_PARMS;

For swiGetLocalTimeslotInfo, the value returned from the NMS_ECHO_CHANNEL_NLP_PARMS structure indicates whether echo cancellation nonlinear processing is enabled or disabled for the specified device.

For more information about swiConfigLocalTimeslot or swiGetLocalTimeslotInfo, refer to the Dialogic® NaturalAccess™ Switching Interface API Developer's Manual.

Setting the NLP state example

The following example shows how to enable or disable NLP:

#include "swidef.h"      /*  Switching service                        */
#include "mvip95.h"      /*  MVIP-95 definitions                      */
#include "nmshw.h"       /*  NMS hardware-specific definitions        */

DWORD mySetNLP(SWIHD swihd, SWI_TERMINUS terminus, int bNLPEnabled)
{
     SWI_LOCALTIMESLOT_ARGS      args;
     NMS_ECHO_CHANNEL_NLP_PARMS  parms;
     
     args.localstream      = terminus.stream;     /* from board switch model */
     args.localtimeslot    = terminus.timeslot;   /* from board switch model */
     args.deviceid         = MVIP95_T1_TRUNK_DEVICE;             /* mvip95.h */
     args.parameterid      = NMS_ECHO_CHANNEL_NLP;               /* nmshw.h  */
     
     if (bNLPEnabled)
         parms.enable_NLP = NMS_ECHO_ENABLE_NLP;            /* nmshw.h  */
     else
         parms.enable_NLP = NMS_ECHO_ENABLE_NLP;            /* nmshw.h  */
     
     return swiConfigLocalTimeslot (
                swihd,            /* switch handle                          */
              & args,             /* target device and config item          */
      (void*) & parms,            /* buffer (defined by parameterid)        */
                sizeof(parms));   /* buffer size in bytes                   */
             
}

Retrieving the NLP state example

The following example shows how to retrieve the echo canceler NLP setting:

#include "swidef.h"      /*  Switching service                        */
#include "mvip95.h"      /*  MVIP-95 definitions                      */
#include "nmshw.h"       /*  NMS hardware-specific definitions        */


DWORD myGetNLP(SWIHD swihd, SWI_TERMINUS terminus, int* pbNLPEnabled)
{
     SWI_LOCALTIMESLOT_ARGS      args;
     NMS_ECHO_CHANNEL_NLP_PARMS  parms;
     DWORD                         swi = SWI_SUCCESS;     

     args.localstream      = terminus.stream;     /* from board switch model */
     args.localtimeslot    = terminus.timeslot;   /* from board switch model */
     args.deviceid         = MVIP95_T1_TRUNK_DEVICE;             /* mvip95.h */
     args.parameterid      = NMS_ECHO_CHANNEL_NLP;               /* nmshw.h  */
          
     swi = swiGetLocalTimeslotInfo (
               swihd,            /* switch handle                           */
             & args,             /* target device and config item           */
     (void*) & parms,            /* buffer (defined by parameterid)         */
               sizeof(parms));   /* buffer size in bytes                    */
     
     
     if (parms.enable_NLP == NMS_ECHO_ENABLE_NLP)           /* nmshw.h  */
         *pbNLPEnabled = 1;  // true
     else
         *pbNLPEnabled = 0;  // false
         
     return swi;
}