enableANS method

  1. @override
Future<int> enableANS({
  1. required bool enable,
})
override

Enables or disables Automatic Noise Suppression (ANS).

Android only - On iOS, this returns 0 without invoking native code as the PortSIP iOS SDK does not expose this method.

Returns 0 on success, -1 or error code on failure.

Implementation

@override
Future<int> enableANS({required bool enable}) async {
  // Only call native method on Android - iOS doesn't expose this in the SDK
  if (!Platform.isAndroid) {
    _logCall('enableANS (skipped on iOS)', {'enable': enable});
    return 0;
  }
  final args = {'enable': enable};
  _logCall('enableANS', args);
  try {
    final result = await methodChannel.invokeMethod<int>('enableANS', args);
    _logResponse('enableANS', result);
    return result ?? -1;
  } on PlatformException catch (e) {
    _logError('enableANS', e);
    return -1;
  }
}