{"slug": "a-real-phone-number-answered-by-an-ai-voice-agent-openai-elevenlabs-gemini-and", "title": "A real phone number answered by an AI voice agent: OpenAI, ElevenLabs, Gemini and Grok behind one small PHP endpoint", "summary": "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.", "body_md": "*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.*\n\nA 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.\n\nThe 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.\n\nThis is the conversation from the call history. The caller's lines are what the speech recognition heard, word for word:\n\n```\nAgent: Good morning, this is the DotSIP assistant on Google Gemini. How can I help you?\nCaller: I would like to check when you are open on Wednesday.\nAgent: On Wednesday, we are open from 8:00 to 18:00.\nCaller: Okay, how about Saturday?\nAgent: We are closed on Saturday.\nCaller: Okay, thank you. Bye.\nAgent: Goodbye.\n```\n\nAnd this is what happened underneath, from the same history (times in UTC):\n\n```\n1. check_opening_hours   10:44:11\n2. check_opening_hours   10:44:20\n3. end_call              10:44:26      call ended by the agent 3 seconds later\n```\n\nMy 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.\n\n```\ncaller ──▶ your phone number (a SIP account) ──▶ DotSIP ──▶ route.php   \"answer, give it to agent-desk\"\n                                                    │\n                                          the voice agent talks\n                                                    │\n                                 the agent needs a fact ──▶ tool.php   \"open from 8:00 to 18:00\"\n```\n\nDotSIP 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.\n\nWhen 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.\n\nA GSM gateway works the same way as a provider's number. To DotSIP both are SIP accounts, so nothing in this article changes.\n\nThe 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.\n\nDotSIP 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.\n\n```\n<?php\n// route.php: DotSIP asks this endpoint what to do with each call.\n// Every incoming call is answered and handed to one agent, with the right \"right-1\".\n\n// Who answers. This one line is the whole choice of the voice:\n//   'agent-desk'    OpenAI\n//   'agent-eleven'  ElevenLabs\n//   'agent-gemini'  Google Gemini\n//   'agent-grok'    xAI Grok\nconst AGENT = 'agent-desk';\n\nheader('Content-Type: application/json');\n\n$ask = json_decode(file_get_contents('php://input'), true) ?: [];\n\n// The call is over. DotSIP only reports it; the answer is discarded.\nif (($ask['event'] ?? '') === 'ended') {\n    echo json_encode(['format_version' => 1, 'action' => 'reject']);\n    exit;\n}\n\n// A new call: answer it and hand it to the agent.\necho json_encode([\n    'format_version' => 2,\n    'commands' => [\n        ['do' => 'answer'],\n        ['do' => 'agent', 'agent' => AGENT, 'rights' => 'right-1'],\n    ],\n]);\n```\n\nThis is the place where your own logic would go. The request carries the caller's number, so the same file can look the caller up in your database first, check the time, and answer with something else: ring a group of phones, forward to a mobile, play a message. Here every call gets the agent.\n\n`rights` is a label for this one call. A tool is offered to the agent only on calls whose label allows it, which is how the same agent can do more for a known customer than for a stranger.\n\nWhen the agent decides it needs a tool, DotSIP POSTs the tool's name and the arguments the model filled in. You answer `ok` and the facts. The agent says them.\n\n```\n<?php\n// tool.php: DotSIP POSTs here each time the agent uses a tool.\n// \"tool\" says which tool, \"arguments\" holds what the model filled in.\n// Hanging up needs nothing here: DotSIP confirms end_call itself.\n\nheader('Content-Type: application/json');\n\n$call = json_decode(file_get_contents('php://input'), true) ?: [];\n$tool = (string)($call['tool'] ?? '');\n$args = is_array($call['arguments'] ?? null) ? $call['arguments'] : [];\n\nif ($tool === 'check_opening_hours') {\n    // In a real system these come from your database.\n    $hours = [\n        'monday' => '8:00 to 16:00', 'tuesday' => '8:00 to 16:00', 'wednesday' => '8:00 to 18:00',\n        'thursday' => '8:00 to 16:00', 'friday' => '8:00 to 14:00',\n        'saturday' => 'closed', 'sunday' => 'closed',\n    ];\n    $day = strtolower(trim((string)($args['day'] ?? '')));\n\n    // Never trust the arguments: the model filled them from what a stranger said.\n    if (!isset($hours[$day])) {\n        echo json_encode([\n            'ok' => false,\n            'message' => 'I can tell you the opening hours for any day of the week, Monday to Sunday. Which day do you mean?',\n        ]);\n        exit;\n    }\n\n    $open = $hours[$day];\n    echo json_encode([\n        'ok' => true,\n        'result' => ['day' => $day, 'hours' => $open],\n        'message' => $open === 'closed' ? \"On $day we are closed.\" : \"On $day we are open from $open.\",\n    ]);\n    exit;\n}\n\n// A tool this endpoint does not know.\necho json_encode(['ok' => false, 'error' => 'unknown tool']);\n```\n\nTwo things I would not skip in real code:\n\nThere is no branch for hanging up. Every agent has a tool called `end_call`, and DotSIP answers it itself. More on that after the first call.\n\nRun both files with anything that serves PHP. For a test on the same machine as DotSIP:\n\n```\nphp -S 127.0.0.1:8099 -t .\n```\n\nBefore DotSIP is involved at all, send each file the request DotSIP will send:\n\n```\ncurl -s -X POST http://127.0.0.1:8099/tool.php -H \"Content-Type: application/json\" \\\n  -d '{\"format\":\"dotsip.tool-call\",\"format_version\":1,\"call_id\":\"test-1\",\"tool\":\"check_opening_hours\",\"arguments\":{\"day\":\"wednesday\"},\"caller\":{\"number\":\"+421905123456\",\"name\":null,\"rights\":\"right-1\"}}'\n# {\"ok\":true,\"result\":{\"day\":\"wednesday\",\"hours\":\"8:00 to 18:00\"},\"message\":\"On wednesday we are open from 8:00 to 18:00.\"}\n\ncurl -s -X POST http://127.0.0.1:8099/route.php -H \"Content-Type: application/json\" \\\n  -d '{\"format\":\"dotsip.route\",\"format_version\":1,\"event\":\"incoming\",\"direction\":\"inbound\",\"call_id\":\"test-1\",\"sip_account\":{\"id\":\"main\",\"name\":\"main\"},\"sip_phone\":null,\"dialed\":\"0212345678\",\"route\":\"route-main\",\"caller\":{\"number\":\"+421905123456\",\"name\":null,\"rights\":null,\"groups\":[]}}'\n# {\"format_version\":2,\"commands\":[{\"do\":\"answer\"},{\"do\":\"agent\",\"agent\":\"agent-desk\",\"rights\":\"right-1\"}]}\n```\n\nEverything in the administration can also be done through DotSIP's own HTTP API, so I will show the requests. It is the same thing you would click, and it is what you would script for the tenth customer.\n\nCreate an API key in the administration (**API**) with the scopes `config:read`, `config:write`, `tools:write`, `credentials:write`, `system:write` and `recordings:read` (or `*`), and copy the secret and the port. Then:\n\n```\nAPI=http://127.0.0.1:19555\nKEY=dsk_your_key\nsend() { curl -s -X \"$1\" \"$API$2\" -H \"Authorization: Bearer $KEY\" -H \"Content-Type: application/json\" -d \"$3\"; echo; }\n```\n\n**The route.** Where DotSIP asks what to do with a call.\n\n```\nsend POST /v1/routes '{\n  \"id\": \"route-main\", \"scheme\": \"http\", \"url\": \"http://127.0.0.1:8099/route.php\",\n  \"verify_ssl\": false, \"timeout_ms\": 5000}'\n```\n\nUse `https` and leave `verify_ssl` out when the endpoint is on another computer.\n\n**The tool.** Its description is what the model reads to decide when to use it. The parameters are a JSON Schema.\n\n```\nsend POST /v1/tools '{\n  \"id\": \"check_opening_hours\", \"endpoint\": \"http://127.0.0.1:8099/tool.php\",\n  \"description\": \"Tells the opening hours for one day of the week, Monday to Sunday. Use it whenever the caller asks when we are open or closed.\",\n  \"parameters\": {\"type\": \"object\",\n    \"properties\": {\"day\": {\"type\": \"string\",\n      \"description\": \"The day of the week the caller asks about, in English, lower case: monday, tuesday, wednesday, thursday, friday, saturday or sunday.\"}},\n    \"required\": [\"day\"]},\n  \"rights\": [\"right-1\"]}'\n```\n\nEvery word of that description is there for a reason; one of them cost me a call (see *What I learned on the way*). There is no request for hanging up: `end_call` already exists, and every agent has it.\n\n**The key of the voice provider.** For OpenAI it belongs to the models, not to the agent. `GET /v1/models?provider=openai` lists them with their numeric ids; save the key on the `live` model the agent speaks with and on the `responses` model that runs the tools (the text model of the tool router, `GET /v1/routers/tool-router-builtin` names it in `model_id`). The ids differ between installations; on mine they are 1 and 2.\n\n```\nsend PATCH /v1/models/1 '{\"api_key\": \"sk-your-openai-key\"}'\nsend PATCH /v1/models/2 '{\"api_key\": \"sk-your-openai-key\"}'\n# each answer carries \"has_api_key\": true\n```\n\n**The agent.** Its model, its tool, the first sentence, and the prompt.\n\n```\nsend POST /v1/agents '{\n  \"id\": \"agent-desk\", \"live_model\": \"1\", \"router_id\": \"tool-router-builtin\",\n  \"tools\": [\"check_opening_hours\"],\n  \"voice_provider\": \"openai\",\n  \"voice_config\": {\"first_message\": \"Good morning, this is the DotSIP assistant. How can I help you?\"},\n  \"prompt\": \"You are the receptionist of our office. You tell callers when we are open. You never invent opening hours.\"}'\n```\n\nThat is the whole prompt. It says who the agent is, what it does, and what it must not make up. It does not name the tool (the tool's description does that), and it says nothing about saying goodbye or hanging up. DotSIP sends its own built-in instructions with every call, and those carry the mechanics that are the same for every business: how a tool result is spoken, and how a call ends.\n\nAn OpenAI agent's `voice_config` takes only `first_message` and `language`. Anything else, `voice` for example, is refused with `400` and the answer names the key.\n\n**The phone number.** The data from your provider, and the route its calls should take.\n\n```\nsend POST /v1/sip-accounts '{\n  \"account_id\": \"main\", \"display_name\": \"Main number\",\n  \"registrar_uri\": \"sip:sip.provider.example:5060\",\n  \"account_uri\": \"sip:0212345678@sip.provider.example\",\n  \"username\": \"0212345678\", \"password\": \"provider-password\", \"realm\": \"sip.provider.example\",\n  \"transfer_uri_template\": \"sip:{extension}@sip.provider.example\",\n  \"inbound_route\": \"route-main\"}'\n\nsend PATCH /v1/sip-settings '{\"incoming_account_ids\": [\"main\"]}'\n```\n\n`incoming_account_ids` replaces the whole list. If other accounts already take calls, read `GET /v1/sip-settings` first and send their ids too.\n\n**Check it before you pick up a phone.**\n\n```\nsend POST /v1/sip-accounts/main/test '{}'\n# \"registered\": true, \"summary\": \"Registration succeeded.\"\n```\n\nThat is seven requests and one check. From here on, DotSIP itself needs no more attention: what a call does is decided by your two files.\n\nCall it and ask \"When are you open on Wednesday?\", then \"And on Saturday?\", then say \"Thank you, bye.\" The agent answers both through the tool and hangs up after its farewell. The history has the proof:\n\n```\ncurl -s \"$API/v1/history?limit=1\" -H \"Authorization: Bearer $KEY\"       # the newest call and its call_id\ncurl -s \"$API/v1/history/<call_id>\" -H \"Authorization: Bearer $KEY\"     # its result, steps and transcript\n```\n\nThis is the stored transcript of my call, unchanged. I asked about Thursday that time:\n\n```\nAgent: Good morning, this is the DotSIP assistant. How can I help you?\nCaller: When you are open on a Wednesday\nAgent: Let me check that for you. On Wednesday, we're open from 8:00 in the morning until 6:00 in the evening. Anything else you'd like to know?\nCaller: And Thursday\nAgent: I'll check Thursday for you. On Thursday, we're open from 8:00 in the morning until 4:00 in the afternoon. Would you like to ask about another day?\nCaller: No, I am satisfied, thank you\nAgent: Okay, you're welcome. Thank you for calling. Have a great day!\n1. check_opening_hours   18:38:57\n2. check_opening_hours   18:39:08\n3. end_call              18:39:21      call ended by the agent 4 seconds later\n```\n\nTwo questions, two tool calls, and the end of the call came from the agent: \"No, I am satisfied, thank you\" has no \"bye\" in it, and the agent still understood that the caller was finished.\n\nThe same is on the page **Call history** in the administration, with the call flow and the text.\n\nIt works out of the box. You do not create a tool for it, you do not tick anything on the agent, your tool endpoint has no branch for it, and the prompt has no sentence about it. This is what happens:\n\n```\n1. The caller is finished: says goodbye in any words, says that is all, or asks to end the call.\n2. The model calls the tool end_call. Every agent has it, with every provider, on every call.\n3. DotSIP confirms it itself.\n4. The agent says its farewell, and DotSIP plays it to the caller.\n5. DotSIP drops the line: when the farewell has been played, at least 3 seconds after step 3,\n   and at the latest after the agent's end_call_seconds (4 by default) if no farewell comes at all.\n```\n\nA spoken goodbye alone ends nothing. DotSIP never hangs up because of a word; it hangs up only after a successful `end_call`.\n\nYou do not have to listen for a click to know who ended the call. This is the history of the Gemini call from the top of this article:\n\n```\n{\"ok\": true, \"item\": {\"call_id\": \"f2ae65cd4edbb297\", \"started_at\": \"2026-12-01T10:44:00+00:00\", \"ended_at\": \"2026-12-01T10:44:30+00:00\",\n  \"direction\": \"inbound\", \"caller\": \"+421905123456\", \"target\": null, \"extension\": null, \"sip_account\": \"main\",\n  \"result\": \"hangup\", \"has_transcript\": true,\n  \"steps\": [\n    {\"ts\": \"2026-12-01T10:44:11+00:00\", \"kind\": \"check_opening_hours\", \"payload\": \"\"},\n    {\"ts\": \"2026-12-01T10:44:20+00:00\", \"kind\": \"check_opening_hours\", \"payload\": \"\"},\n    {\"ts\": \"2026-12-01T10:44:26+00:00\", \"kind\": \"end_call\", \"payload\": \"\"}],\n  \"transcript\": \"...\"}}\n```\n\n`result` `hangup` means DotSIP ended the call, and the last step `end_call` means the agent asked for it. `result` `ended` with no `end_call` step would mean the caller had to hang up. In `dotsip.log` the same ending is three lines:\n\n```\ntool.call name=end_call call_id=f2ae65cd4edbb297\ncall.supervisor.armed state=farewell_armed:end_call call_id=f2ae65cd4edbb297\ncall.end_by_supervisor trigger=agent_farewell call_id=f2ae65cd4edbb297\n```\n\nThe videos above use a longer prompt that spells the ending out in its own sentences. Both forms work: the longer prompt, and the three sentences of this article.\n\nThe agent, not the route, knows which provider speaks. So another provider is one more agent, and the same two PHP files serve it unchanged. This video shows the four agents side by side on the same number:\n\nThe three agents below have the same tool and the same three-sentence prompt as `agent-desk`. What differs is where the key goes and what the voice settings are called:\n\n|  | OpenAI | ElevenLabs, direct mode | Google Gemini Live | xAI Grok Voice | \n|---|---|---|---|---|\n| `voice_provider` | `openai` | `elevenlabs` | `gemini` | `grok` | \n| Who calls the tools | a text model inside DotSIP; the speaking model hands work over to it | the model that speaks | the model that speaks | the model that speaks | \n| The provider's key | on the models ( `PATCH /v1/models/{id}` ) | on the agent ( `voice_api_key` ) | on the agent ( `voice_api_key` ) | on the agent ( `voice_api_key` ) | \n| `live_model` | needed | not used | not used | not used | \n| After you change a tool's description | nothing | `POST /v1/agents/{id}/voice-setup` | nothing | nothing | \n\nA provider cannot be changed on an existing agent; another provider is another agent.\n\nThe ElevenLabs key goes on the agent. DotSIP creates the agent in your ElevenLabs account and gives it the tools, `end_call` included; you set nothing up in the ElevenLabs dashboard.\n\n```\nsend POST /v1/agents '{\n  \"id\": \"agent-eleven\",\n  \"tools\": [\"check_opening_hours\"],\n  \"voice_provider\": \"elevenlabs\", \"voice_api_key\": \"sk_your-elevenlabs-key\",\n  \"voice_config\": {\"mode\": \"direct\", \"voice_id\": \"your-voice-id\", \"language\": \"en\",\n                   \"conversation_llm\": \"gpt-4o-mini\",\n                   \"first_message\": \"Good morning, this is the DotSIP assistant on ElevenLabs. How can I help you?\"},\n  \"prompt\": \"You are the receptionist of our office. You tell callers when we are open. You never invent opening hours.\"}'\n# the answer carries \"voice_setup\": {\"ok\": true, \"mode\": \"direct\", \"tools\": [\"check_opening_hours\", \"end_call\"], ...}\n```\n\nIn `route.php`:\n\n``` js\nconst AGENT = 'agent-eleven';\n```\n\nSave the file and call again. This is the stored transcript of that call, unchanged:\n\n```\nAgent: Good morning, this is the DotSIP assistant on ElevenLabs. How can I help you?\nCaller: What hours you are open on Wednesday?\nAgent: On Wednesday, we are open from eight in the morning to six in the evening.\nCaller: And how about Saturday?\nAgent: On Saturday, we are closed.\nCaller: Okay. Thank you.\nAgent: Is there anything else you need?\nCaller: No, no, no. Thank you. Bye.\nAgent: Goodbye!\n1. check_opening_hours   10:54:08\n2. check_opening_hours   10:54:17\n3. end_call              10:54:28      call ended by the agent 3 seconds later\n```\n\nLook at the middle. \"Okay. Thank you.\" after an answer did not end the call; the agent asked whether there was anything else. Only \"No, no, no. Thank you. Bye.\" did. That distinction comes from DotSIP's built-in instructions, not from my prompt.\n\nTwo things are specific to ElevenLabs:\n\n```\n  send POST /v1/agents/agent-eleven/voice-setup '{}'\n  # \"voice_setup\": {\"ok\": true, ..., \"updated\": [\"check_opening_hours\"]}\n```\n\nElevenLabs has a second mode, `\"mode\": \"delegate\"`, where the ElevenLabs model only speaks and an OpenAI text model inside DotSIP runs the tools (it needs the OpenAI key on the models, as in Step 3). I called it on 0.2.0 too, with the same prompt: \"Okay. Thank you.\" after an answer did not end the call, \"No, that's all. Thank you. Bye.\" did. It was slower: the first tool call came four seconds after my question, and I had asked again before the answer came.\n\nGemini Live is one model that hears, speaks and calls the tools. It needs one Google API key, on the agent, and nothing else: no account to prepare, no second model.\n\n```\nsend POST /v1/agents '{\n  \"id\": \"agent-gemini\",\n  \"tools\": [\"check_opening_hours\"],\n  \"voice_provider\": \"gemini\", \"voice_api_key\": \"your-google-api-key\",\n  \"voice_config\": {\"voice\": \"Kore\", \"language\": \"en-US\",\n                   \"first_message\": \"Good morning, this is the DotSIP assistant on Google Gemini. How can I help you?\"},\n  \"prompt\": \"You are the receptionist of our office. You tell callers when we are open. You never invent opening hours.\"}'\njs\nconst AGENT = 'agent-gemini';\n```\n\nThis is the call at the top of the article. Its steps:\n\n```\n1. check_opening_hours   10:44:11\n2. check_opening_hours   10:44:20\n3. end_call              10:44:26      call ended by the agent 3 seconds later\n```\n\nGrok Voice is the same arrangement as Gemini: one xAI model hears, speaks and calls the tools. The xAI key goes on the agent, and nothing is set up at xAI; DotSIP sends the prompt, the voice and the tools with every call.\n\n```\nsend POST /v1/agents '{\n  \"id\": \"agent-grok\",\n  \"tools\": [\"check_opening_hours\"],\n  \"voice_provider\": \"grok\", \"voice_api_key\": \"your-xai-api-key\",\n  \"voice_config\": {\"voice\": \"eve\", \"language\": \"en\",\n                   \"first_message\": \"Good morning, this is the DotSIP assistant on Grok. How can I help you?\"},\n  \"prompt\": \"You are the receptionist of our office. You tell callers when we are open. You never invent opening hours.\"}'\n# the answer carries \"voice_provider\": \"grok\" and \"has_voice_api_key\": true\njs\nconst AGENT = 'agent-grok';\n```\n\nThe stored transcript, unchanged, and the steps:\n\n```\nAgent: Good morning, this is the DotSIP assistant on Grok. How can I help you?\nCaller: When we are open at Wednesday?\nAgent: Let me check Wednesday for you.\nAgent: On Wednesday we are open from 8:00 to 18:00. Is there anything else you'd like to know?\nCaller: So how about Saturday?\nAgent: Checking Saturday now.\nAgent: On Saturday we are closed. Would you like the hours for another day?\nCaller: No, no, no. Thank you. Bye.\nAgent: I'll hang up for you.\nAgent: Goodbye!\n1. check_opening_hours   10:42:15\n2. check_opening_hours   10:42:27\n3. end_call              10:42:38      call ended by the agent 3 seconds later\n```\n\nGrok says a short line before it uses a tool (\"Let me check Wednesday for you.\"), which keeps the caller from listening to silence. The line \"I'll hang up for you.\" is one I did not want: Grok announced the hang-up and then said goodbye. That call ran on a build from the morning of the release day. Before the release, DotSIP's Grok connection was changed so that at a goodbye Grok calls `end_call` without a word and says one farewell after it. The last call on the final build was with a Slovak Grok agent, and its ending was the caller's \"Nie, nie, vďaka, to je všetko.\" and one agent line, \"Dovidenia.\". I have not called the English agent again since.\n\nThe xAI language list does not include Slovak, so DotSIP passes the language only as a hint. It worked on my calls; test your own language on a real call before you rely on it.\n\nSo the number, the tool, the opening hours, the prompt and the history stayed where they were through four providers. A different company's model was talking each time, and the only thing I touched between calls was one constant.\n\nBecause that choice is made in your code for every call, it does not have to be a constant. The same line can pick the agent by the caller's number, by the hour, or by a flag in your database, which is a cheap way to compare providers on real calls.\n\nThe first version of this article had a long chapter about prompts that end a call, with four that failed. 0.2.0 made most of it unnecessary. What is still true:\n\n`end_call` does. If you point `{\"ok\": true}` for it, or the line stays open after the farewell.`day` parameter said \"The weekday the caller asks about\". The ElevenLabs agent read \"weekday\" as Monday to Friday, and this is from that call's history, unchanged:\n\n```\n  Caller: And how about Saturday?\n  Agent: I am sorry, I cannot help with that on this line.\n  Caller: What?\n  Agent: I can only provide information about our opening hours for weekdays. If you have any other questions, feel free to ask!\n```\n\nGemini and Grok called the tool for Saturday with the same text. With \"one day of the week, Monday to Sunday\" in the description and every day listed in the parameter, the next ElevenLabs call answered \"On Saturday, we are closed.\" Write the full range of values, and avoid words with a narrower everyday meaning.\n\n| What the history or the phone shows | What happened | What to change | \n|---|---|---|\n| `\"result\": \"failed\"` , start and end in the same second; the call rings and drops | The voice session did not start | The provider's key, in the place the table above names: `has_api_key` on the OpenAI models,`has_voice_api_key` on the other agents | \n| No new call in the history at all | The call did not reach DotSIP or the route | The registration test from Step 3; `inbound_route` and`incoming_account_ids` | \n| The caller asked and there is no `check_opening_hours` step | The tool was not offered | The tool's `rights` must contain the right`route.php` sends (`right-1` ), and the agent's`tools` must list the tool | \n| The agent answers with \"I am sorry, I cannot help with that on this line.\" for a question the tool covers | The model read the tool's description as not covering it | The description and the parameter, word by word | \n| `\"result\": \"ended\"` , no`end_call` step | The caller had to hang up | Your prompt: remove any sentence about goodbyes. If `end_call` points at your own endpoint and is in the agent's`tools` , that endpoint must answer`ok` true | \n| `\"result\": \"hangup\"` ,`end_call` right after the first answer | The agent ended the call too early | A sentence in the prompt puts a goodbye next to an answer; remove it | \n| The agent talks about the tool instead of using it | The parameters or the endpoint address ended up in the prompt | They belong to the tool | \n\nDotSIP's download contains a folder of rules written for AI coding assistants: the request and answer formats, the order of work, a worked example of this very line, and a page of pitfalls written from real mistakes, mine included. An assistant that reads them can write the two endpoints and send the seven requests for you.\n\nI tried both ways while writing the first version of this article. An assistant that skipped the rules put the OpenAI key in the wrong place, and wrote the goodbye-next-to-an-answer sentence above. Following the rules, the setup worked on the next call.\n\nBoth files and a short setup guide: `EXAMPLES/ai-reception` in the DotSIP examples. The full contract of both endpoints is in the documentation: *Writing a route endpoint* and *Writing a tool endpoint*.\n\nThe two videos above belong to a series that goes from installing DotSIP to AI voice agents: [DotSIP: From Installation to AI Voice Agents](https://www.youtube.com/playlist?list=PLdqYimygZCmQ).", "url": "https://wpnews.pro/news/a-real-phone-number-answered-by-an-ai-voice-agent-openai-elevenlabs-gemini-and", "canonical_source": "https://dev.to/dotapp/a-real-phone-number-answered-by-an-ai-voice-agent-openai-elevenlabs-gemini-and-grok-behind-one-2li", "published_at": "2026-12-01 20:59:21+00:00", "updated_at": "2026-12-01 21:13:48.295731+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "ai-products"], "entities": ["DotSIP", "OpenAI", "ElevenLabs", "Google Gemini", "xAI Grok", "PHP"], "also_reported_by": [], "takeaway": "Routing calls through a route endpoint that returns answer-and-agent commands plus a separate tool endpoint lets one prompt and one tool serve OpenAI, ElevenLabs, Gemini and Grok by changing a single agent constant.", "recommendation": {"advice": "Separate call routing from tool lookups into two endpoints so the voice provider can be swapped by changing one agent identifier while the prompt and tools stay fixed.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/a-real-phone-number-answered-by-an-ai-voice-agent-openai-elevenlabs-gemini-and", "markdown": "https://wpnews.pro/news/a-real-phone-number-answered-by-an-ai-voice-agent-openai-elevenlabs-gemini-and.md", "text": "https://wpnews.pro/news/a-real-phone-number-answered-by-an-ai-voice-agent-openai-elevenlabs-gemini-and.txt", "jsonld": "https://wpnews.pro/news/a-real-phone-number-answered-by-an-ai-voice-agent-openai-elevenlabs-gemini-and.jsonld"}}