Skip to content

[Feature]: Add granular SIP call + transfer lifecycle webhook events for CRM workflows #125

@nilay-automatesmb

Description

@nilay-automatesmb

Problem statement

Rapida currently emits conversation-level webhook events (conversation.begin/completed/failed and endpoint-api events), but CRM systems need lower-level telephony lifecycle visibility before and around conversation startup.

For SIP call-center workflows, downstream systems must:

  • create exactly one backend call session per provider call_id
  • avoid duplicate contact lookup/create caused by multiple browser clients reacting independently
  • notify intended users on transfer attempts
  • close stale notifications when another target answers
  • track final outcome for each attempted target (connected/no_answer/busy/rejected/cancelled/failed)

Without granular SIP/call-routing events, CRM disposition and real-time routing UX are incomplete.

Proposed solution

Extend the existing SIP webhook pipeline (server-to-server, same webhook executor path) with additional lifecycle events and normalized outcomes.

Add/extend events:

  • Call lifecycle: call.created, call.ringing, call.answered, call.no_answer, call.busy, call.rejected, call.cancelled, call.ended, call.failed
  • Transfer lifecycle: transfer.requested, transfer.attempt.started, transfer.connected, transfer.attempt.ended, transfer.cancelled, transfer.failed
  • Define (but only emit with reliable hooks): call.media.started, transfer.target.ringing

Emission semantics:

  • call.created before/around ringing once SIP session identity is established
  • call.ringing around 180 Ringing
  • call.answered around 200 OK / connected
  • classify known SIP failures into call.no_answer / call.busy / call.rejected; keep call.failed for unclassified/technical failures
  • transfer.requested before per-target attempts
  • transfer.attempt.ended for every attempted target terminal outcome
  • transfer.cancelled for pending targets when another target answers (reason=answered_by_other)

Non-goals:

  • no browser websocket implementation
  • no separate realtime server
  • no broad SIP refactor

Alternatives considered

No response

Impact area

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions