Add <Refer> BXML verb and referComplete webhook support#189
Closed
Copilot wants to merge 3 commits into
Closed
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Copilot
AI
changed the title
[WIP] Add support for <Refer> BXML verb and referComplete webhook
Add May 22, 2026
<Refer> BXML verb and referComplete webhook support
Copilot stopped work on behalf of
atelegu due to an error
May 22, 2026 10:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds SDK support for the new Voice
<Refer>flow andreferCompletecallback payload shape, modeled after existing transfer patterns while preserving REFER semantics (successful REFER hands the call off; no post-success continuation pattern). It includes BXML modeling, webhook models/enums, and docs/examples aligned to failure-aware callback handling.BXML: new
<Refer>verbReferverb model with optional attributes:referCompleteUrlreferCompleteMethod(defaultPOST, validated toGET|POST)tag(optional)<SipUri>child (Refer.SipUri) with SIP scheme validation (sip:).WithSipUri(...)WithReferCompleteUrl(...)WithReferCompleteMethod(...)WithTag(...)Webhook:
referCompletepayload modelingReferCompleteCallbackmodel foreventType=referComplete.ReferCallStatusEnum(success,failure).tagreferSipResponseCodenotifySipResponseCodeUnit coverage for new behavior
Docs and release notes
<Refer>generation.referCallStatus=failure.ReferCompleteCallbackandReferCallStatusEnum.<Refer>andreferCompletesupport (with pre-merge note for api-specs PR 2142).Original prompt
Overview
Add support for the new
<Refer>BXML verb andreferCompletewebhook to the C# SDK. This mirrors the existing<Transfer>verb pattern with one critical asymmetry:<Refer>terminates the call on success (the remote SIP endpoint redirects away from Bandwidth), whereas<Transfer>keeps the call alive. SDK examples must not mimic Transfer's "play after success" pattern.Reference: https://github.com/Bandwidth/api-specs/pull/2142 (do not ship before this is merged)
1.
<Refer>BXML VerbXML shape
Attributes (all optional)
referCompleteUrlreferCompleteMethodGET|POSTPOSTtagChild element
<SipUri>— required, exactly one. Text content is a SIP URI (must start withsip:). No attributes.Implementation requirements
Refermodel class following existing verb conventions in the SDK (look atTransferas the closest analogue).SipUrichild element/class that serializes correctly.sipUri(required),referCompleteUrl,referCompleteMethod, andtag.2.
referCompleteWebhookPayload fields
eventType"referComplete"eventTimeaccountIdapplicationIdfromtodirection"inbound"callIdcallUrlstartTimeanswerTimereferCallStatus"success"or"failure"tagreferSipResponseCode202,405,603— absent on successnotifySipResponseCode200,404,486— absent on REFER rejection or NOTIFY timeoutImplementation requirements
ReferCompletewebhook event model (match the SDK's existing webhook naming convention).referCompletein the SDK's webhook event-type discriminator/enum so callback parsing routes to the new model.tag,referSipResponseCode,notifySipResponseCode) must be nullable/optional.3. Unit Tests
Cover all of the following cases:
<Refer>verb XML round-trip — serialize and deserialize, verify output matches expected XML.referCallStatus=success, noreferSipResponseCode, nonotifySipResponseCode.referCallStatus=failure,referSipResponseCode=405, nonotifySipResponseCode.referCallStatus=failure,referSipResponseCode=202,notifySipResponseCode=<error>.referCallStatus=failure,referSipResponseCode=202, nonotifySipResponseCode.4. Documentation
<Refer>usage to the README or relevant docs section.referCallStatus=failurein thereferCompleteUrlcallback.5. Changelog
Add a changelog entry for:
<Refer>BXML verbreferCompletewebhook eventCritical notes
tagattribute on<Refer>is pending confirmation (VAPI-2916) — add it as optional for now.Transferverb implementation as the closest pattern to follow, but remember the success-semantics difference.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: ```
Add SIP REFER verb support to csharp-sdk
Key details
Main
Operations
Description
Overview
Add support for the new BXML verb and referComplete webhook to the C# SDK. Mirrors the existing verb pattern, but note the critical success-semantics asymmetry below.
Repo
https://github.com/Bandwidth/csharp-sdk
References
Parent epic: VAPI-2459
API spec ticket: VAPI-2916
Spec PR (DRAFT — do not ship SDK before merge): https://github.com/Bandwidth/api-specs/pull/2142
Design doc: https://bandwidth-jira.atlassian.net/wiki/spaces/PV/pages/6901727392/SIP+REFER
Verb
sip:alice@atlanta.example.com Attributes (all optional):referCompleteUrl — URL...
This pull request was created from Copilot chat.