What is the Auto-Dialer?
The BrokerOS Auto-Dialer is a custom native Android module written in Kotlin, embedded directly into the Expo mobile application (apps/mobile/modules/auto-dialer/). It enables pre-sales telecallers to dial through daily lead queues consecutively without manually entering phone numbers or switching between multiple apps.
Every outgoing call is:
- Automatically initiated using Android’s native telephony manager and the agent’s physical SIM card
- Monitored in real time through native broadcast receivers that track call duration and connection status
- Reported to managers via live status indicators (
User.isOnCall), showing whether an agent is currently on a live call - Recorded and uploaded via Android Jetpack
WorkManager, which runs in the background even if the app process is closed - Transcribed with Groq AI and attached to the lead’s historical CRM timeline
Native Telephony Engine Components
The auto-dialer consists of three core native Kotlin components working alongside the React Native JavaScript thread:Call Execution & Audio Ingest Pipeline
Real-Time Manager Supervision (useCallStatus)
BrokerOS provides sales managers with live visibility into which agents are on a call. This is synchronized through the useCallStatus hook mounted at the root of the dashboard shell:
- When
onCallStartedfires: The mobile app triggersPOST /api/call-status { isOnCall: true }. - When
onCallEndedfires: The mobile app triggersPOST /api/call-status { isOnCall: false }. - Even if the React Native JavaScript thread is paused in the background,
CallBroadcastReceiver.ktexecutes a fallback directHttpURLConnectionon a background thread using the auth token stored inSharedPreferences.
- Green Status Indicator: Agent is actively speaking on a connected call.
- Yellow Status Indicator: Agent is available and waiting for the next lead.
- Gray Indicator: Agent is offline or logged out.
Background Audio Upload Architecture
To ensure audio recordings are uploaded reliably even if an agent force-closes the app or loses signal mid-shift, BrokerOS avoids relying on React Native background tasks. Instead, it utilizes native Android Jetpack WorkManager:- Storage Access Framework (SAF): During setup, the agent grants BrokerOS persistent access to their call recording folder (
setODialerFolder). - Work Scheduling: Upon
EXTRA_STATE_IDLE,CallBroadcastReceiver.ktschedules aOneTimeWorkRequestBuilder<CallUploadWorker>with an initial delay of 5 seconds to ensure the recording app has finished writing the audio file. - Timestamp Matching:
CallUploadWorker.ktreads the scoped document tree (DocumentFile.fromTreeUri), locates.mp3files modified during the call window, and validates length. - Multipart Transmission: The worker streams the file to
/api/leads/upload-call-recordusing authentication credentials retrieved fromAutoDialerPrefs. - Automatic Exponential Backoff: If the mobile device is offline, WorkManager pauses the upload job and automatically retries with exponential backoff once network connectivity returns.
Required Android Telephony Permissions
The auto-dialer requires the following permissions declared inapps/mobile/app.json: