app_call_button 0.0.22
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 #
- audio_session: ^0.2.2
- permission_handler: ^11.3.1
- sip_ua: ^1.0.1
- flutter_webrtc: ^0.12.12+hotfix.1
- connectivity_plus: ^7.0.0
- flutter_overlay_manager: ^2.0.2
- internet_connection_checker_plus: ^2.9.1
Features #
- Expose all call parameters.
- Update the example.
MIT License
Copyright (c) 2025 TRIANH SOLUTIONS