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).
Import package and use:
1.Import section ✅
Import the package before using any SIP registration, call handling, overlay management, or controller methods:
import ‘package:app_call_button/app_call_button.dart’;
2.AppSipController class ✅
AppSipController is a singleton class that manages the SIP controller Bloc and exposes high-level methods to register, initiate calls, handle call events, and display the calling overlay UI.
Usage:
final sip = AppSipController.instance;
3.showCallOverlay() ✅
This method displays a full-screen call overlay using FlutterOverlayManager. It dims the background and shows the CallingScreen wrapped inside a BlocProvider so the UI can react to SIP call events in real time.
Usage:
AppSipController.instance.showCallOverlay();
4.hideCallOverlay() ✅
Hides the active call overlay if it is currently visible.
Usage:
AppSipController.instance.hideCallOverlay();
5.register() ✅
This method registers a SIP account using the provided configuration. Missing parameters automatically fall back to default values. It then dispatches InitializeSipEvent to begin the SIP registration process.
Usage:
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 Hotline”, keyboard: true );
6.makeCall() ✅
Initiates an outgoing call to the specified target (or a default SIP endpoint). After triggering the call, it automatically displays the call overlay UI.
Usage:
AppSipController.instance.makeCall(“sip:1002@your.sip.server”);
7.endCall() ✅
Terminates the current SIP call and hides the call overlay.
Usage:
AppSipController.instance.endCall();
8.sendDtmf() ✅
Sends a DTMF key tone during an active call.
Usage:
AppSipController.instance.sendDtmf(“5”);
9.muteMicrophone() / unmuteMicrophone() ✅
Enables or disables the microphone by dispatching the appropriate Bloc events.
Usage:
AppSipController.instance.muteMicrophone();
AppSipController.instance.unmuteMicrophone();
10.startLocalStream() / stopLocalStream() ✅
Starts or stops the local WebRTC audio stream, allowing the system to manage call audio.
Usage:
AppSipController.instance.startLocalStream();
AppSipController.instance.stopLocalStream();
11.enableVoiceCallMode() / disableVoiceCallMode() ✅
Switches between standard audio mode and voice-call mode for proper audio routing during SIP calls.
Usage:
AppSipController.instance.enableVoiceCallMode();
AppSipController.instance.disableVoiceCallMode();
12.enableMicrophone() / disableMicrophone() ✅
Convenience methods that internally mute or unmute the microphone.
Usage:
AppSipController.instance.enableMicrophone();
AppSipController.instance.disableMicrophone();
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
•Update the library functions such as register, makeCall, showCallOverlay, etc.
•Update the logic to call library functions upon import
•Update the call screen interface
MIT License
Copyright (c) 2025 TRAN THANH TRA
Libraries
- core/blocs/sip_controller/sip_controller_bloc
- core/blocs/sip_controller/sip_controller_event
- core/blocs/sip_controller/sip_controller_state
- core/controller/controller
- core/core
- core/theme/app_colors
- gen/assets.gen
- GENERATED CODE - DO NOT MODIFY BY HAND
- model/model
- model/sip_config/sip_config_model
- screens/calling/calling_screen
- screens/screens
- widgets/custom_text
- widgets/keyboard
- widgets/my_keyboard
- widgets/my_toast
- widgets/relative_builder
- widgets/widgets
