Skip to content

GTR-13432 (Handle multiple Twilio error codes in call handling) - #1419

Merged
yileicn merged 2 commits into
SciSharp:masterfrom
adenchen123:master
Sep 3, 2026
Merged

GTR-13432 (Handle multiple Twilio error codes in call handling)#1419
yileicn merged 2 commits into
SciSharp:masterfrom
adenchen123:master

Conversation

@adenchen123

Copy link
Copy Markdown
Contributor

No description provided.

aden.chen added 2 commits September 3, 2026 16:36
Handle multiple Twilio error codes in call handling

Replaced single error code constant with a HashSet to handle
multiple Twilio error codes (21215, 21216). Updated the `catch`
block to check for error codes in the set. Added `message.StopCompletion`
to stop further execution on error. Improved comments for clarity.
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Handle Twilio call-blocking errors and stop completion

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Handle Twilio error codes 21215 and 21216 as blocked outbound calls.
• Stop further model completion after returning the user-facing call restriction message.
Diagram

graph TD
  A["Outbound handler"] --> B["Twilio API"] --> C{"Call outcome?"}
  C -->|21215 or 21216| D["Restriction message"] --> E["Stop completion"]
  C -->|Queued| F["Conversation fork"]
  C -->|Other| G["Existing failure path"]
Loading
High-Level Assessment

The centralized HashSet and filtered catch are appropriate for a small, extensible list of equivalent Twilio restriction codes. A direct pattern-match condition would be shorter for two codes but less convenient as the supported set grows.

Files changed (1) +5 / -3

Bug fix (1) +5 / -3
OutboundPhoneCallFn.csHandle multiple blocked-call errors and halt completion +5/-3

Handle multiple blocked-call errors and halt completion

• Replaces the single geo-permission error constant with a set containing Twilio codes 21215 and 21216. Matching API exceptions now return the existing restriction message and set 'StopCompletion' to prevent further execution.

src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Functions/OutboundPhoneCallFn.cs

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@yileicn
yileicn merged commit f936f92 into SciSharp:master Sep 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants