app_call_button 0.0.22 copy "app_call_button: ^0.0.22" to clipboard
app_call_button: ^0.0.22 copied to clipboard

A Flutter plugin that provides in-app call functionality using SIP and WebRTC for both Android and iOS.

APP CALL BUTTON BY TRIANH SOLUTIONS #

App Call Button enables real-time Flutter calling with a simple APIβ€”bundling SIP, WebRTC audio, call states, auto-reconnect, and audio routing without complex setup.
Key features:
- Mic on/off
- peaker mode
- DTMF dialing
- Auto network detection
- Audio routing & device switching
- Call state tracking via streams/callbacks
Fast, reliable, and developer-friendly for support tools, internal communication, or VoIP apps.
Feedback & issues: πŸ‘‰ https://trianh.vn/
Platform Support:
Android iOS
βœ… βœ…

Add app*call_button as a dependency in your _pubspec.yaml* file.

To use this library, please follow the configuration instructions provided below.

iOS Setup #

Add the following entries to your Info.plist file located at <project root>/ios/Runner/Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>App Name requires microphone access to make calls.</string>
<key>NSCameraUsageDescription</key>
<string>App Name requires camera access to make video calls.</string>

Android Setup #

Ensure the following permission is present in your Android Manifest file, located in

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

If you need to use a Bluetooth device, please add:

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />

When to call register() #

Call **once** when SIP config is ready (after login/API fetch), 
typically in `initState()` of your main/home screen:
@override
void initState() {
  super.initState();
  AppSipController.instance.register(
    sipServer: "your.sip.server",
    wsServer: "wss://your.sip.server/ws",
    authUsername: "1001",
    username: "1001",
    password: "123456",
    callTo: "sip:1002@your.sip.server",
    callToAlias: "Support",
  );
}

Note: When calling AppSipController.instance.register();, if no configuration is provided, the default configuration provided by us will be used.

When integrating this in a Flutter app, you would typically call this method in the MaterialApp builder: #

MaterialApp(
  builder: (context, child) {
        return FlutterOverlayManager.I.builder((context) => child!);
  },  // Wraps the app to manage overlays
  home: YourHomePage(),
);
Usage

Flow: #

1.Add the App Call Buttons library.
2.Call the register function on app launch.
- βœ… If registration succeeds β†’ enable the call button.
- ❌ If it fails β†’ show a β€œcannot call” message.
3.Add a call button β†’ tap to trigger Model.
4.After tapping Call β†’ navigate to the on-call screen (TAS default/customizable).

Import package and use: #

1. Import βœ…
import 'package:app_call_button/app_call_button.dart';

2. Controller βœ…
final sip = AppSipController.instance;

3. showCallOverlay βœ…
sip.showCallOverlay();

4. hideCallOverlay βœ…
sip.hideCallOverlay();

5. register βœ…
sip.register(
  sipServer: "your.sip.server",
  wsServer: "wss://your.sip.server/ws",
  authUsername: "1001",
  username: "1001",
  password: "123456",
  callTo: "sip:1002@your.sip.server",
  callToAlias: "Support Hotline",
  keyboard: true,
);

6. unRegister βœ…
sip.unRegister();

7. makeCall βœ…
sip.makeCall("sip:1002@your.sip.server");

8. endCall βœ…
sip.endCall();

9. sendDtmf βœ…
sip.sendDtmf("5");

10. mute/unmute mic βœ…
sip.muteMicrophone();
sip.unmuteMicrophone();

11. start/stop stream βœ…
sip.startLocalStream();
sip.stopLocalStream();

12. voice call mode βœ…
sip.enableVoiceCallMode();
sip.disableVoiceCallMode();

13. mic on/off βœ…
sip.enableMicrophone();
sip.disableMicrophone();

How to get SIP / Call data from AppSipController #

AppSipController provides ValueNotifiers for real-time updates on  call state, duration, and SIP configuration.
-----------------------------------
1. SIP Config
-----------------------------------
ValueListenableBuilder(
  valueListenable: AppSipController.instance.sipData,
  builder: (context, sip, _) {
    // Access SIP info: sip.callTo, sip.username, etc.
  },
);
-----------------------------------
2. Current Call
-----------------------------------
ValueListenableBuilder(
  valueListenable: AppSipController.instance.currentCall,
  builder: (context, call, _) {
    // Access current call info: call.id, call.status, etc.
  },
);
-----------------------------------
3. Call Duration
-----------------------------------
ValueListenableBuilder(
  valueListenable: AppSipController.instance.callDuration,
  builder: (context, duration, _) {
    // duration is a Duration object
  },
);
-----------------------------------
4. SIP Started / Registration State
-----------------------------------
ValueListenableBuilder(
  valueListenable: AppSipController.instance.sipStarted,
  builder: (context, isStart, _) {
    // isStart = true if SIP registered
  },
);
-----------------------------------
USAGE
-----------------------------------

// Register SIP
AppSipController.instance.register();
// Make a call (without UI)
AppSipController.instance.makeCall("sip:1002@your.sip.server");
// Show default call overlay UI
AppSipController.instance.showCallOverlay();
// End call
AppSipController.instance.endCall();
// Mute / Unmute microphone
AppSipController.instance.muteMicrophone();
AppSipController.instance.unmuteMicrophone();

Important libraries used in this library #

Features #

- Expose all call parameters.
- Update the example.

MIT License

Copyright (c) 2025 TRIANH SOLUTIONS