view360_call

A comprehensive Flutter package for VoIP calling, integrating SIP, WebRTC, and CallKit. This package provides ready-to-use services for managing calls and specialized UI components like call screens and dialpads.

Features

  • SIP Registration: Easy-to-use manager for SIP registration and state handling.
  • WebRTC Calling: High-quality audio/video calling support.
  • CallKit Integration: Native incoming call UI support via flutter_callkit_incoming (System UI for calls).
  • Pre-built UI:
    • CallPage: A fully functional in-call screen with Mute, Hold, Speaker, and DTMF controls.
    • DialPad: A customizable dialpad component.
  • Call Management:
    • Handle incoming/outgoing calls types.
    • Mute/Unmute, Hold/Unhold, Speaker toggle.
    • Call duration tracking.

Getting Started

Add the package to your pubspec.yaml:

dependencies:
  view360_call:
    path: ../ # or git url

Platform Configuration

Since this package relies on flutter_webrtc and flutter_callkit_incoming, you need to configure permissions.

Android (src/main/AndroidManifest.xml)

Add the following permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

iOS (ios/Runner/Info.plist)

Add the following keys:

<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to the microphone for VoIP calls.</string>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera for video calls.</string>
<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
    <string>voip</string>
    <string>fetch</string>
    <string>remote-notification</string>
</array>

Usage

1. Initialize SipManager

The SipManager singleton handles your SIP connection.

import 'package:view360_call/view360_call.dart';

final sipManager = SipManager();

// Register callbacks
sipManager.onRegistrationStateChanged = (state) {
  print('Registration State: ${state.state}');
};

sipManager.addCallStateListener((state, call) {
  print('Call State: ${state.state}');
});

2. Register User

sipManager.registerToSip(
  wsUrl: 'wss://your-sip-server.com',
  uri: 'sip:user@domain.com',
  user: 'user',
  password: 'password',
  displayName: 'John Doe',
);

3. Making a Call

Use the uaHelper from SipManager to initiate calls.

sipManager.uaHelper.call('sip:target@domain.com');

4. Making the Call Page

When a call is established or incoming, you can navigate to the CallPage.

// Inside your call state listener
sipManager.addCallStateListener((state, call) {
  if (state.state == CallStateEnum.CONFIRMED) {
      Navigator.push(
        context,
        MaterialPageRoute(
          builder: (c) => CallPage(
            call: call,
            helper: sipManager.uaHelper,
            sipManager: sipManager,
          ),
        ),
      );
  }
});

Additional Information

This package wraps complex WebRTC and SIP logic into a more manageable API for Flutter developers, specifically tailored for integration into View360 View CX applications.

Libraries

view360_call