RTC Auto-Answer Bot
The calling system includes an RTC auto-answer bot for development and testing. This way you can iterate on the subsystem with a single phone. When you call the bot contact, the backend automatically notifies a remote bot server to join/leave the call.
Starting the Bot Server
It runs on Google Compute Engine (not Firebase) since it needs to be always running, listening for incoming calls.
- SSH to the VM:
gcloud compute ssh --zone "us-central1-c" "instance-20251031-20251031-055846" --project "pajama-dev" - Ensure no running server:
ps aux | grep "videosdk_server.py" - To start the server for debugging:
source venv/bin/activate && python videosdk_server.py - To start the server for long-term running:
source venv/bin/activate
nohup python videosdk_server.py > server.log 2>&1 &
Setting up a New VM
- Reserve a VM from https://console.cloud.google.com/compute/instances. The bot uses ~0.15 vCPU per connection, so a micro should suffice. Ensure you "Add Firewall Rule" to allow IPv4 ranges: 0.0.0.0/0 and TCP Port: 58989.
- SSH and copy over source files.
- Install packages:
sudo apt update
sudo apt install software-properties-common -y
sudo apt install python3-pip python3.12-venv
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
- Update the IP address in
pajama/services/firebase/functions/pajama/rtc/operations/constants.pyto the new VM's External IP.
Updating the video
- Save your video in an optimized lower res format:
ffmpeg -i loop.mp4 -vf "scale=180:320" -r 15 -c:v libx264 -preset ultrafast -crf 28 -b:v 150k loop_lowres.mp4 - Copy file to VM
- Restart server