Setting or retrieving the acoustic echo control state

The acoustic echo control (AEC) state is a proprietary adaptive suppression algorithm that provides far end acoustic echo control for up to 400 ms of flat delay. It works in the opposite direction from the trunk, for example, the IP direction in a PSTN to IP gateway. AEC is disabled by default.

Use swiConfigLocalTimeslot to enable or disable AEC 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_AEC (0x80000021).

buffer

 

Points to the NMS_ECHO_CHANNEL_AEC_PARMS structure. Valid values are:

0 = NMS_ECHO_DISABLE_AEC

1 = NMS_ECHO_ENABLE_AEC

size

 

Size of buffer, in bytes.

The NMS_ECHO_CHANNEL_AEC_PARMS structure is:

typedef struct
{
    DWORD enable_AEC;  // 0=no AEC, 1=AEC enabled

}   NMS_ECHO_CHANNEL_AEC_PARMS;
 

For swiGetLocalTimeslotInfo, the value returned from the NMS_ECHO_CHANNEL_AEC_PARMS structure indicates whether echo cancellation acoustic echo control 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 acoustic echo control state example

The following example shows how to enable or disable AEC:

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

DWORD mySetAEC(SWIHD swihd, SWI_TERMINUS terminus, int bAECEnabled)
{
     SWI_LOCALTIMESLOT_ARGS      args;
     NMS_ECHO_CHANNEL_AEC_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_AEC;               /* nmshw.h  */
     
     if (bAECEnabled)
         parms.enable_AEC = NMS_ECHO_ENABLE_AEC;            /* nmshw.h  */
     else
         parms.enable_AEC = NMS_ECHO_ENABLE_AEC;            /* 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 acoustic echo control state example

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

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


DWORD myGetAEC(SWIHD swihd, SWI_TERMINUS terminus, int* pbAECEnabled)
{
     SWI_LOCALTIMESLOT_ARGS      args;
     NMS_ECHO_CHANNEL_AEC_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_AEC;               /* 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_AEC == NMS_ECHO_ENABLE_AEC)           /* nmshw.h  */
         *pbAECEnabled = 1;  // true
     else
         *pbAECEnabled = 0;  // false
         
     return swi;
}