A real phone number answered by an AI voice agent: OpenAI, ElevenLabs, Gemini and Grok behind one small PHP endpoint A developer built a working AI voice agent on a real phone line using DotSIP, a self-hosted telephony engine that routes incoming SIP calls to a PHP endpoint and hands them to a live voice session. The setup uses two short PHP files—one to answer and assign an agent, one to serve tool calls—and swapping a single constant switches the same number between OpenAI, ElevenLabs, Google Gemini and xAI Grok. In a recorded call, the Gemini-backed agent checked opening hours twice via the tool endpoint and ended the call on its own three seconds after the caller said goodbye, without any hang-up instruction in its three-sentence prompt. I build DotSIP, the telephony engine used in this article. Everything below ran on a real phone line; every transcript is from a real call. A phone rings. An AI voice answers, the caller asks when the office is open on Wednesday and on Saturday, the agent asks my code each time, says the answer, and when the caller says goodbye it hangs up. Nobody told it how to hang up. The video below shows the whole set-up for this call, from the tool endpoint to the call history. Everything in it is also written out in this article. This is the conversation from the call history. The caller's lines are what the speech recognition heard, word for word: Agent: Good morning, this is the DotSIP assistant on Google Gemini. How can I help you? Caller: I would like to check when you are open on Wednesday. Agent: On Wednesday, we are open from 8:00 to 18:00. Caller: Okay, how about Saturday? Agent: We are closed on Saturday. Caller: Okay, thank you. Bye. Agent: Goodbye. And this is what happened underneath, from the same history times in UTC : 1. check opening hours 10:44:11 2. check opening hours 10:44:20 3. end call 10:44:26 call ended by the agent 3 seconds later My part of it is two short PHP files. The agent's prompt is three sentences, and none of them is about ending the call. That call was answered by Google Gemini. Below I build the same line with OpenAI first, and then change one line so that the same number is answered by ElevenLabs, Gemini and xAI Grok, with the same tool and the same prompt. caller ──▶ your phone number a SIP account ──▶ DotSIP ──▶ route.php "answer, give it to agent-desk" │ the voice agent talks │ the agent needs a fact ──▶ tool.php "open from 8:00 to 18:00" DotSIP is a program you run on your own Windows or Linux machine. It registers to your phone provider, takes the call, and has no opinion about what should happen next. It asks a web address you give it, once per call. Whatever answers there decides. That is the route endpoint. When the answer is "put an agent on it", DotSIP runs the live voice session. When the agent needs something from the real world, DotSIP calls a second web address of yours. That is the tool endpoint. A GSM gateway works the same way as a provider's number. To DotSIP both are SIP accounts, so nothing in this article changes. The provider charges for the minutes, the voice provider charges for the model, and DotSIP needs a license after the trial. None of that is hidden in the steps below. DotSIP POSTs one JSON object when a call arrives: who is calling, which number was dialed, through which account. You answer with a list of commands.