Setting or retrieving the echo cancellation bypass state

The bypass control allows you to enable or disable the hardware echo cancellation feature for a trunk port. Use swiConfigLocalTimeslot to set the echo canceler bypass state and swiGetLocalTimeslotInfo to retrieve the echo canceler bypass state. 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 hardware dependent. For example, 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_BYPASS (0x80000007).

buffer

 

Points to the NMS_ECHO_CHANNEL_BYPASS_PARMS structure. Valid values are:

0 = NMS_ECHO_BYPASS_DISABLE

1 = NMS_ECHO_BYPASS_ENABLE

size

 

Size of buffer, in bytes.

The NMS_ECHO_CHANNEL_BYPASS_PARMS structure is:

typedef  struct
{
     DWORD bypass;  /*  NMS_ECHO_BYPASS_DISABLE or  NMS_ECHO_BYPASS_ENABLE */

}    NMS_ECHO_CHANNEL_BYPASS_PARMS;

The value returned from the NMS_ECHO_CHANNEL_BYPASS_PARMS structure indicates whether the echo cancellation bypass state is enabled or disabled for the specified device.

For information about the echo cancellation bypass feature, refer to Using echo cancellation control. For more information about swiConfigLocalTimeslot or swiGetLocalTimeslotInfo, refer to the Dialogic® NaturalAccess™ Switching Interface API Developer's Manual.

Setting the bypass state example

The following example shows how to set the echo canceler bypass state:

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

DWORD  mySetBypass(SWIHD  swihd,  SWI_TERMINUS terminus,  int  bBypassEnabled)
{
      SWI_LOCALTIMESLOT_ARGS         args;
      NMS_ECHO_CHANNEL_BYPASS_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_BYPASS;            /*  nmshw.h  */
     
     if ( bBypassEnabled)
         parms.bypass =  NMS_ECHO_BYPASS_ENABLE;            /*  nmshw.h  */
     else
         parms.bypass =  NMS_ECHO_BYPASS_DISABLE;           /*  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 bypass state example

The following example shows how to retrieve the echo canceler bypass state:

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


DWORD  myGetBypass(SWIHD  swihd,  SWI_TERMINUS terminus,  int*  pbBypassEnabled)
{
      SWI_LOCALTIMESLOT_ARGS         args;
      NMS_ECHO_CHANNEL_BYPASS_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_BYPASS;            /* 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.bypass == NMS_ECHO_BYPASS_ENABLE)           /* nmshw.h  */
         *pbBypassEnabled = 1;  // true
     else
         *pbBypassEnabled = 0;  // false
         
     return swi;
             
}