> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryhamsa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# End Call Node

> Gracefully terminate calls with customizable farewell messages

## Overview

End call nodes terminate the conversation and disconnect the call. They provide a clean, graceful way to end calls with optional farewell messages and tracking of call completion reasons. Every flow should have clear paths to end call nodes to avoid leaving callers hanging.

**Key characteristic:** End call nodes are terminal nodes—the flow stops here, and the call disconnects.

## When to Use

Use end call nodes to:

* **Successful completion** - Caller's needs were met
* **User-requested termination** - Caller asks to end call
* **Error scenarios** - Technical issues requiring call termination
* **Timeout handling** - No user input for extended period
* **After transfers** - Clean up after transferring to external number
* **Opt-out handling** - User declines service or opts out
* **Survey completion** - End of feedback collection
* **Appointment confirmation** - After successful booking

**Every flow should:**

* Have at least one end call node
* Provide clear paths to termination
* Handle both success and failure scenarios
* Give appropriate farewell messages

***

## Core Configuration

```typescript theme={null}
{
  type: "end_call",
  label?: string,
  description?: string,

  // Final message (optional)
  finalMessage?: string,
  messageType: "static" | "prompt",  // Default: "static"

  // No transitions (terminal node)
  transitions: []  // Always empty
}
```

<Info>
  End call nodes are terminal nodes—they have no transitions. Once reached, the flow ends and the call disconnects.
</Info>

***

## Final Message

### Static Message

Exact, predetermined farewell message spoken every time.

```yaml theme={null}
End Call Node: Call_Complete
  Final Message:
    message: "Thank you for calling Acme Corporation. Have a great day!"
    messageType: static
```

**Use static when:**

* Consistent, professional farewell
* Brand-specific closing
* Legal disclaimers needed
* Simple, universal goodbye

### Prompt-Based Message

AI generates contextual farewell based on conversation.

```yaml theme={null}
End Call Node: Call_Complete
  Final Message:
    message: "Thank the caller warmly, reference their specific issue, and wish them a great day."
    messageType: prompt
```

**AI might say:**

* "Thank you for calling about your account update, `{{customer_name}}`. Have a wonderful day!"
* "I'm glad I could help with your question. Thanks for calling, and take care!"

**Use prompt when:**

* Want personalized, contextual farewell
* Reference specific conversation topics
* Natural, conversational ending
* Dynamic based on outcome

### Message with Variables

Use extracted variables in farewell.

```yaml theme={null}
End Call Node: Appointment_Confirmed
  Final Message:
    message: "Perfect! Your appointment is confirmed for {{appointment_date}} at {{appointment_time}}. We'll send a reminder to {{customer_email}}. Thank you, {{customer_name}}!"
    messageType: static
```

### Silent Termination (No Message)

End call immediately without farewell.

```yaml theme={null}
End Call Node: Silent_End
  # No finalMessage - immediate disconnect
```

**Use when:**

* After transfer (new system handles goodbye)
* Error requires immediate termination
* User already said goodbye
* Abrupt ending is appropriate

***

## Use Cases & Examples

### Example 1: Successful Completion

**Scenario:** User's question answered, end positively.

```yaml theme={null}
Conversation Node: Answer_Question
  message: "I hope that answers your question about our pricing."
  transitions:
    - Natural Language: "User is satisfied" → Call_Complete
    - Natural Language: "User has more questions" → Continue_Conversation

End Call Node: Call_Complete


  Final Message:
    message: "Thank you for calling Acme Corp. If you have any other questions, feel free to call back. Have a wonderful day!"
    messageType: static
```

### Example 2: After Appointment Booking

**Scenario:** Appointment booked, confirm and end.

```yaml theme={null}
Tool Node: Book_Appointment
  outputMapping:
    appointment_date: $.date
    appointment_time: $.time
    confirmation_number: $.confirmation_id
  transitions:
    - Always → Appointment_Confirmed

End Call Node: Appointment_Confirmed


  Final Message:
    message: "Your appointment is confirmed for {{appointment_date}} at {{appointment_time}}. Your confirmation number is {{confirmation_number}}. We'll send a reminder email. Thank you, and see you then!"
    messageType: static
```

### Example 3: User Requested End

**Scenario:** User says they're done.

```yaml theme={null}
Conversation Node: Anything_Else
  message: "Is there anything else I can help you with today?"

  transitions:
    - Natural Language: "User says no or goodbye" → User_Goodbye
    - Natural Language: "User has more questions" → Continue_Support

End Call Node: User_Goodbye


  Final Message:
    message: "Thank you for calling. Have a great day!"
    messageType: static
```

### Example 4: Error Termination

**Scenario:** Critical API failure, can't continue.

```yaml theme={null}
Tool Node: Critical_Database_Lookup
  onErrorBehavior: fail
  transitions:
    - Always → Database_Error_End

End Call Node: Database_Error_End


  Final Message:
    message: "I'm experiencing technical difficulties accessing our system. Please try calling back in a few minutes, or visit our website. We apologize for the inconvenience."
    messageType: static
```

### Example 5: Timeout Scenario

**Scenario:** User inactive for 60 seconds.

```yaml theme={null}
Router Node: Check_User_Active
  # System monitors inactivity
  transitions:
    - Equation: {{seconds_since_input}} > 60 → Timeout_Warning
    - Always → Continue_Conversation

Conversation Node: Timeout_Warning
  message: "Are you still there? Let me know if you need more time."
  skipResponse: false

  transitions:
    - Natural Language: "User responds" → Resume_Conversation
    - Equation: {{seconds_since_input}} > 30 → Timeout_End

End Call Node: Timeout_End


  Final Message:
    message: "I haven't heard from you. Please call back when you're ready. Goodbye!"
    messageType: static
```

### Example 6: After Transfer

**Scenario:** Transfer to human, then end AI call.

```yaml theme={null}
Transfer Call Node: Transfer_To_Human
  phoneNumber: +18005551234
  transferType: warm
  transferMessage: "I'm transferring you to a specialist now."

  transitions:
    - Always → End_After_Transfer

End Call Node: End_After_Transfer

  # No final message - transfer system handles it
```

### Example 7: Opt-Out Handling

**Scenario:** User opts out of service.

```yaml theme={null}
Conversation Node: Opt_Out_Confirmation
  message: "I understand you'd like to opt out. I've processed that request."

  transitions:
    - Always → Opt_Out_Complete

End Call Node: Opt_Out_Complete


  Final Message:
    message: "Your opt-out request has been processed. You won't receive further calls. Thank you."
    messageType: static
```

### Example 8: Survey Completion

**Scenario:** Customer satisfaction survey finished.

```yaml theme={null}
Conversation Node: Final_Question
  message: "On a scale of 1-10, how satisfied are you with our service?"

  Extract Variables:
    - satisfaction_score: "Extract rating 1-10"

  transitions:
    - Always → Survey_Complete

Tool Node: Submit_Survey
  tool: Save_Survey_Results
  parameters:
    score: {{satisfaction_score}}
  transitions:
    - Always → Thank_You_End

End Call Node: Thank_You_End


  Final Message:
    message: "Thank you for your feedback! It helps us improve our service. Have a great day!"
    messageType: static
```

### Example 9: Multiple End Paths

**Scenario:** Different endings for different outcomes.

```yaml theme={null}
Router Node: Outcome_Router
  transitions:
    - Equation: {{issue_resolved}} == true → Success_End
    - Equation: {{transferred_to_human}} == true → Transfer_End
    - Equation: {{user_frustrated}} == true → Apologetic_End
    - Always → Standard_End

End Call Node: Success_End

  finalMessage: "I'm glad I could resolve your issue. Thank you for calling!"

End Call Node: Transfer_End

  finalMessage: "You've been transferred. Have a great day!"

End Call Node: Apologetic_End

  finalMessage: "I apologize we couldn't resolve this to your satisfaction. Please contact our support team for further assistance. Thank you."

End Call Node: Standard_End

  finalMessage: "Thank you for calling. Goodbye!"
```

### Example 10: Contextual Personalized Ending

**Scenario:** Reference conversation details in goodbye.

```yaml theme={null}
End Call Node: Personalized_Goodbye


  Final Message:
    message: "Thank you, {{customer_name}}! Your {{order_type}} order for {{product_name}} will arrive on {{delivery_date}}. We appreciate your business!"
    messageType: static
```

***

## Flow Examples

### Example Flow 1: Simple Support

```mermaid theme={null}
graph TD
    Start[Start: Greeting]
    Support[Conversation: Support]
    Resolved{Router: Resolved?}
    End[End: Success]
    Transfer[Transfer: Human]

    Start --> Support
    Support --> Resolved
    Resolved -->|"yes"| End
    Resolved -->|"no"| Transfer
```

### Example Flow 2: Error Handling

```mermaid theme={null}
graph TD
    Start[Start]
    Tool[Tool: API Call]
    Success{Router: Success?}
    Complete[End: Completed]
    Error[End: Error]

    Start --> Tool
    Tool --> Success
    Success -->|"success"| Complete
    Success -->|"error"| Error
```

### Example Flow 3: User Choice

```mermaid theme={null}
graph TD
    Menu[Conversation: How can I help?]
    Continue{Router: Continue?}
    More[More Questions]
    Goodbye[End: User Requested]

    Menu --> Continue
    Continue -->|"more questions"| More
    Continue -->|"done"| Goodbye
    More --> Menu
```

***

## Troubleshooting

### Issue: Calls ending abruptly

**Possible causes:**

* No final message configured
* Message generation failing
* Transition directly to end without conversation

**Solution:**

1. Add final message
2. Use static message if prompt fails
3. Add transition node before end

### Issue: Users confused at end

**Possible causes:**

* Unclear final message
* No confirmation of actions taken
* Missing next steps

**Solution:**

1. Clarify what happened in final message
2. Confirm important details
3. Provide next steps or follow-up info

### Issue: No path to end call

**Possible causes:**

* Flow has no end nodes
* Transitions don't lead to end
* Circular conversation loop

**Solution:**

1. Add end call nodes
2. Review all transition paths
3. Ensure every path can reach an end

***

## Schema Reference

```typescript theme={null}
{
  type: "end_call",
  label?: string,
  description?: string,

  // Final message (optional)
  finalMessage?: string,
  messageType: "static" | "prompt",  // Default: "static"

  // Transitions (always empty - terminal node)
  transitions: [],

  // Position
  position: { x: number, y: number }
}
```

***

## Common Patterns

### Pattern 1: Confirmation + End

```yaml theme={null}
Conversation Node: Confirm_Action
  message: "I've completed {{action}}. Is there anything else?"
  transitions:
    - Natural Language: "no" → End_Complete
    - Natural Language: "yes" → Continue_Support

End Call Node: End_Complete

  finalMessage: "Great! Thank you for calling."
```

### Pattern 2: Multi-Outcome Routing

```yaml theme={null}
Router Node: Determine_Outcome
  transitions:
    - Equation: {{success}} == true → Success_End
    - Equation: {{error}} == true → Error_End
    - Always → Standard_End
```

### Pattern 3: Pre-End Feedback

```yaml theme={null}
Conversation Node: Get_Feedback
  message: "Before you go, how was your experience today? Good, okay, or bad?"
  extractVariables:
    - feedback: "Extract sentiment"
  transitions:
    - Always → Thank_And_End

End Call Node: Thank_And_End

  finalMessage: "Thank you for your feedback! Have a great day."
```

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Start Node" icon="play" href="./start-node">
    Begin flows that end gracefully
  </Card>

  <Card title="Conversation Node" icon="comments" href="./conversation-node">
    Lead to satisfying conclusions
  </Card>

  <Card title="Router Node" icon="route" href="./router-node">
    Route to appropriate endings
  </Card>

  <Card title="Transfer Nodes" icon="phone-arrow-up-right" href="./transfer-call-node">
    Transfer before ending
  </Card>

  <Card title="Transitions" icon="arrows-split-up-and-left" href="../transitions">
    Path to end call nodes
  </Card>

  <Card title="Best Practices" icon="check" href="../best-practices">
    Build better flows
  </Card>
</CardGroup>
