Inspiration

Most of us know the "stay on the phone with me till you reach" routine. Walking home from a station late at night, or sitting alone in a cab when the driver takes an unfamiliar turn, a voice on the line makes you feel safer. It also signals to anyone nearby that someone is expecting you. But there isn't always someone free to pick up.

The tools that exist didn't fit that moment. SOS apps assume you can openly press a panic button, which is hard when the person making you uneasy is sitting next to you and can see your screen. Fake-call apps play a scripted recording that can't answer back, so the illusion breaks as soon as anyone listens closely. And neither tells the people who care about you where you are.

So we asked: what if the call itself were the safety tool? A caller who actually talks back, while quietly keeping your people informed, and who can raise the alarm without anyone noticing.

What it does

Saathi (साथी, "companion") is a web app that looks like an ordinary phone call.

  • You tap Start call and "Didi" (or whoever you choose) picks up. She talks with you in real time: she asks where you are and how far you are from home, and mentions that dinner is waiting, in Hinglish if you use it.
  • Your trusted contacts get a Telegram message and a live location pin that moves with you.
  • If you feel unsafe, you say your code phrase, an innocent sentence like "did you feed the cat?", or tap the caller's photo three times. Your contacts instantly get an alert with your location, followed by a 20-second audio clip from the call. Your phone buzzes twice so you know the alert went through.
  • The caller then says, out loud, that she has your location open and has sent it to the others too. The AI becomes a deterrent aimed at whoever is listening.

How we built it

Frontend. Plain HTML, CSS and JavaScript, so it runs in a mobile browser with nothing to install. The call loop uses the Web Speech API: SpeechRecognition to listen and speechSynthesis to speak. Around it, we use the Geolocation API for live position, MediaRecorder for the audio clip, the Screen Wake Lock API to keep the mic alive, and the Vibration API for silent confirmation. We designed the call screen to be indistinguishable from a native call, with the system font, a round avatar, a timer, and mute, speaker and end buttons.

Backend. A FastAPI server does two jobs:

  1. It proxies the language model, so the API key never reaches the browser. It works with any OpenAI-compatible endpoint; we used Groq because it's fast.
  2. It talks to the Telegram Bot API. It uses sendLocation with a live_period to start a moving pin, editMessageLiveLocation to update it, and sendDocument to send the audio clip.

The conversation. Each call follows the loop listen → detect end of turn → LLM → speak → listen. A system prompt sets up the caller's persona, and the backend trims every reply to a few short spoken sentences. For a voice call, latency is everything. The delay before the caller answers is roughly

$$ T_{\text{reply}} \approx t_{\text{pause}} + t_{\text{LLM}} + t_{\text{TTS start}}, $$

so we used a short end-of-turn pause ($t_{\text{pause}} \approx 0.9\,\text{s}$), a fast inference provider, and a small token budget.

Code phrase detection. Speech recognition often mishears a word or two. Let $W_p$ be the set of words in the phrase and $W_h$ the set of words heard. An exact substring match always triggers. For phrases of four or more words, we also trigger when

$$ \frac{|W_p \cap W_h|}{|W_p|} \ge 0.75, $$

which tolerates one misheard word. We check interim recognition results too, so the alert goes out the moment the phrase is heard, before the sentence ends.

Challenges we ran into

  • The caller hearing herself. Speech recognition kept picking up the synthesized voice and replying to it. We pause listening while the caller speaks and restart it afterwards, with a back-off so a failing recognizer doesn't loop.
  • Knowing when it's your turn. The browser streams words but doesn't say when you've finished talking. We built end-of-turn detection on top of final results with a short silence timer, plus a check-in ("Hello? Are you there?") if you go quiet.
  • Reasoning models and short replies. Our first model spent its token budget thinking and sometimes returned nothing. We added a configurable reasoning effort and server-side cleanup that strips reasoning tags and stage directions.
  • Never giving false reassurance. We realised the deterrent line ("I've sent your location to the others") must only be spoken if it's true. The caller says it only when at least one contact actually received the alert. Otherwise the phone gives one long buzz and the phrase can be retried.
  • Telegram's rules. Bots can't message anyone first, so we built a "Find contacts" flow: contacts send /start, and the app discovers them.
  • Browser constraints. The mic and location only work over HTTPS, and mobile browsers pause the mic when the screen sleeps. We deployed with HTTPS and hold a wake lock during calls.

What we learned

  • Designing for an adversarial listener changes everything. Every word the caller says, every buzz and every pixel on screen had to be judged by what a person standing next to her would notice.
  • In a safety product, the system prompt is safety-critical code. The difference between "I can see where you are" and a vague reassurance matters, and it has to match what the system actually did.
  • Modern browser APIs are powerful enough to build a real-time voice agent with no app install. Their limits, such as background audio and recognition quirks, are exactly where a native app would help next.

What's next

  • A native Android app, with listening in the background and a lock-screen or power-button trigger.
  • An SMS fallback for when there's no data.
  • On-device speech recognition, and more Indian languages.
  • A handoff to 112 India for verified emergencies.

Built With

  • css3
  • fastapi
  • generative-ai
  • geolocation-api
  • groq
  • html5
  • httpx
  • javascript
  • llm
  • mediarecorder-api
  • python
  • render
  • speechrecognition
  • speechsynthesis
  • telegram-bot-api
  • uvicorn
  • vibration-api
  • wake-lock-api
  • web-speech-api
Share this project:

Updates