Skip to main content

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.

  1. SSH to the VM: gcloud compute ssh --zone "us-central1-c" "instance-20251031-20251031-055846" --project "pajama-dev"
  2. Ensure no running server: ps aux | grep "videosdk_server.py"
  3. To start the server for debugging: source venv/bin/activate && python videosdk_server.py
  4. 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​

  1. 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.
  2. SSH and copy over source files.
  3. 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
  1. Update the IP address in pajama/services/firebase/functions/pajama/rtc/operations/constants.py to the new VM's External IP.

Updating the video​

  1. 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
  2. Copy file to VM
  3. Restart server