Fancall is a high-concurrency celebrity calling platform that enables fans to book paid live voice and video sessions with creators, influencers, and celebrities. Building real-time audio/video infrastructure across heterogeneous mobile devices and telephony networks presents extreme latency and call-lifecycle challenges.
Go-Based WebRTC to SIP Gateway
To bridge app-to-app WebRTC calls with standard telephony landlines and SIP endpoints, I built a custom media gateway in Go using the Pion WebRTC library.
The gateway receives WebRTC RTP audio streams from client mobile applications, transcodes audio formats on the fly, and bridges them to SIP trunks provided by Vobiz. This allows seamless call initiation between native mobile apps and traditional phone lines with sub-100ms jitter buffers.
Resolving iOS AVAudioSession & CallKit Lifecycle Conflicts
During high-volume testing on iOS, users experienced silent audio dropouts mid-call. Tracing native state transitions revealed race conditions between iOS AVAudioSession category changes and CallKit CXProvider delegate callbacks when switching speaker modes or answering incoming GSM calls.
By implementing a state-machine wrapper around AVAudioSession and synchronizing audio route requests directly with CallKit delegate lifecycle hooks, I eliminated mid-call audio drops completely.
Fixing Ghost-Call Session Leakage
A critical edge-case occurred when a fan forcefully killed their mobile app mid-call. The WebRTC connection died, but the server failed to detect the ungraceful disconnect immediately — keeping creator-side paid sessions running indefinitely and causing severe billing errors.
To solve this, I designed a dual heartbeat monitor using Redis pub/sub and Socket.IO. If client heartbeats miss two consecutive 3-second ticks, the Go server triggers immediate call teardown, notifies both parties, and finalizes billing accuracy down to the exact second.
Key Technical Achievements
- Built custom Go WebRTC gateway with Pion bridging mobile app audio to PSTN/SIP via Vobiz.
- Synchronized CallKit delegates and AVAudioSession to fix silent call drops on iOS.
- Implemented Socket.IO/Redis heartbeat call teardown, eliminating ghost-call runaway billing.