app_call_button 0.0.3
app_call_button: ^0.0.3 copied to clipboard
Call in App Flutter.
APP CALL BUTTON BY TRIANH SOLUTIONS #
Author: TRAN THANH TRA
With App Call Button, you can easily integrate real-time calling in Flutter without dealing with complex setup. It bundles SIP client, WebRTC audio handling, call state management, reconnection logic, and device audio routing into a simple API.
Key features include:
•Microphone enable/disable
•Speaker mode toggle
•DTMF tone sending
•Automatic network detection
•Audio routing and device switching
•Call state tracking via streams or callbacks
Designed for fast, reliable, and developer-friendly integration, whether building support tools, internal communication apps, or VoIP services.
For suggestions, feedback, or bug reports, visit: 👉 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 muốn truy cập micro để thực hiện cuộc gọi tổng đài</string>
<key>NSCameraUsageDescription</key>
<string>App Name muốn truy cập camera để thực hiện cuộn gọi tổng đài</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 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
⚠️ Note: #
1. In the customer’s source code, include the App Call Buttons library.
2. Call the register function when the app launches.
• ✅ If registration is successful → the call button becomes active.
• ❌ If registration fails → display a message indicating that calls cannot be made.
3. Add a call button anywhere in the app → when the button is clicked, trigger the call action → use the Model(sdalkdjlsk).
4. After clicking the Call button → navigate to the on-call screen (designed by TAS; the customer can customize this screen if desired).
[assets/examle/example2.jpg] [assets/examle/example1.jpg]
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();
NOTE: 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();
Note: When calling
AppSipController.instance.register();, if no configuration is provided, the default configuration provided by us will be used.
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 TRAN THANH TRA
