termcall 0.2.0
A CLI-based video/audio calling app using WebRTC and Firebase
Requires Python: >=3.8

# TermCall

A CLI-based video/audio calling app for the terminal using WebRTC and Firebase.

## Features

- Peer-to-peer video and audio calls in your terminal
- Remote video as colored ASCII art
- Local video preview as Sixel graphics (Sixel-compatible terminal required)
- Simple CLI interface for browsing users and making calls

## Requirements

- Python 3.8+
- A Sixel-compatible terminal (e.g., xterm -ti vt340, mlterm) for local video preview
- Webcam and microphone

## Installation

1. **Install TermCall (after building the package):**

   ```bash
   pip install termcall
   ```

2. **Install system dependencies (if needed):**

   - macOS: `brew install libjpeg`
   - Ubuntu: `sudo apt-get install libopencv-dev`

## Usage

After installation, run:

```bash
termcall
```

- On first run, you will be prompted for your email and full name.
- Browse users, initiate calls, and accept/decline incoming calls from the CLI menu.
- During a call:
  - Remote video is shown as ASCII art
  - Local video preview (bottom right) uses Sixel graphics (if supported)
  - Controls: `m` to mute audio, `v` to mute video, `q` to quit call

## Database & Security

- TermCall connects to the public TermCall Firebase database automatically. **You do NOT need to set up your own Firebase or provide any credentials.**

Firebase Database Rules:

```json
{
  "rules": {
    "users": {
      "$email": {
        // Anyone can read user profiles
        ".read": true,
        // Only allow writes if the provided token matches the stored token
        ".write": "(!data.exists() && newData.child('token').val() != null) || (data.child('token').val() === newData.child('token').val())"
      }
    },
    "call_requests": {
      "$request_id": {
        // Anyone can read call requests
        ".read": true,
        // Only allow the caller or callee (with correct token) to write/update/delete
        ".write": "(!data.exists() && newData.child('caller_email').val() != null && newData.child('callee_email').val() != null && newData.child('token').val() != null) || (data.child('token').val() === newData.child('token').val())"
      }
    },
    "signaling": {
      "$call_id": {
        "$peer_email": {
          // Anyone can read signaling data
          ".read": true,
          // Only allow the peer (with correct token) to write/update/delete
          ".write": "(!data.exists() && newData.child('token').val() != null) || (data.child('token').val() === newData.child('token').val())"
        }
      }
    }
  }
}
```

- TermCall uses a central Firebase Realtime Database, maintained by the project owner.
- The app connects via the public database URL using the Firebase REST API.
- **No admin credentials or serviceAccountKey.json are distributed.**
- Users do NOT need to set up their own Firebase project or credentials.

### Future Improvements

- Add authentication (e.g., anonymous or email/password) to restrict users to their own data
- Update database rules to enforce per-user access
- Modularize codebase for maintainability
- Improve packaging and distribution (PyPI, Homebrew, etc.)
- Monitor and mitigate abuse/spam

- **Migrate to Firebase Authentication (Long-Term):**
  - Implement Firebase Authentication (email/password, anonymous, etc.) for all users.
  - Use `auth.uid` in database rules to enforce per-user access and secure all sensitive operations.
  - This enables robust, scalable security and is recommended for production deployments.

### Distribution & Packaging

- See Distribution.md for historical notes and advanced packaging options
- The main user experience is via pip install and the `termcall` CLI

## License

`
MIT License`