startIvr method

Future<bool> startIvr(
  1. String flowId
)

Open an in-app IVR menu (a visual phone-tree) for flowId — e.g. a support entry point built in the dashboard. The built-in NexusIvrOverlay renders it; the caller taps keys to navigate, and the SDK auto-connects a real call when the flow routes to an agent. Returns false if the menu couldn't start.

Implementation

Future<bool> startIvr(String flowId) async {
  try {
    final res = await _post('/partner/voice/ivr/start', {'flowId': flowId});
    final sid = res?['sessionId'] as String?;
    final inst = res?['instruction'];
    if (sid == null || inst is! Map) return false;
    await _handleIvr(sid, Map<String, dynamic>.from(inst));
    return true;
  } catch (e) {
    NexusLog.warn('voice.startIvr failed: $e');
    return false;
  }
}