Closing Phrases
End the call as soon as the assistant says one of your closing sentences.
Technical documentation for
speech_config.end_call_phrases.
Overview
An assistant ends a call by using the end_call tool. Closing phrases add a second way that does not depend on that decision: you list the sentences your assistant uses to say goodbye, and as soon as one of its turns ends with one of them, the platform ends the call itself, after the sentence has been spoken.
Use closing phrases when the call should end exactly when the assistant says goodbye. They work on every assistant, pipeline (STT → LLM → TTS) and speech-to-speech alike.
Configuration
In the dashboard, open the assistant and go to Conversation → Hang up after these sentences. Enter one sentence per line.
Through the API, set speech_config.end_call_phrases on the assistant:
curl -X PATCH https://api.hmsovereign.com/api/v1/assistants/ASSISTANT_ID \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"speech_config": {
"end_call_phrases": ["Thanks for calling, goodbye", "Have a good day"]
}
}'speech_config is saved as one block: an update replaces the whole block. If the assistant already has other speech settings, such as silence or pronunciation, send them along in the same request, or they are removed.
| Field | Type | Limits | Description |
|---|---|---|---|
speech_config.end_call_phrases | array of strings | Up to 5 sentences, up to 100 characters each, with at least 2 letters or digits | Sentences after which the platform ends the call. An empty list, or no field at all, switches it off. |
A value outside these limits is rejected when you save it, with a 400 and reason_code: end_call_phrases_invalid. The error names the sentence it is about, for example end_call_phrases[1].
The setting belongs to the assistant and applies to inbound, outbound and web calls.
How a phrase is matched
- Only the assistant's turns are checked. A caller who says "goodbye" does not end the call; the assistant still answers.
- Only the end of a turn counts. The phrase has to be the last thing the assistant says in that turn.
- Whole words, without capitals or punctuation.
Goodbyematches "Goodbye!" and "GOODBYE.", but not "Goodbyes". - Not before the caller has spoken. An opening line that happens to end with one of your phrases does not end the call.
- Not during a transfer. Once a transfer has started, the call is left to it.
With the phrase Goodbye:
| The assistant says | Result |
|---|---|
| "Thanks for calling. Goodbye!" | The call ends |
| "You're welcome, goodbye." | The call ends |
| "Goodbye is a big word, but we can stop here if you like." | The call continues |
| "Goodbyes are never easy. Is there anything else?" | The call continues |
When a phrase matches
The assistant finishes the sentence, and the call then ends the same way as with the end_call tool. The call log records the end reason agent_hangup, and the end-of-call report is sent as usual.
Choosing your phrases
- Use the sentence your assistant actually says when it is done. The most dependable setup is to tell the assistant in its system prompt how to close a call, for example "When the caller has no further questions, say: Thanks for calling, goodbye.", and to list that same sentence here.
- Leave out sentences that also occur mid-conversation, such as "Okay" or "Thank you". Only the end of a turn counts, but a turn that happens to end with such a sentence would still end the call.
- Write the phrases in the language your assistant speaks. Matching is on the words, not on their meaning.
Combining with other settings
- The
end_calltool keeps working. Whichever comes first ends the call. speech_config.end_call_messageis spoken after the closing phrase, so the caller would hear two goodbyes. Use one or the other; the dashboard points this out when both are filled in.- Autonomous silence handling is unaffected and ends a silent call with its own final sentence. Give it a
silence.final_messageand it no longer adds theend_calltool, so closing phrases can be the only way the assistant ends a call. max_duration_secondsstill ends the call at the time you set.