agentleFS
wittyreferencewittyreference/twilio-claude-plugin/skills/sip/SKILL.md

sip

Skill2 starsChanged 8 months agoMITView on GitHub

Twilio development skill: sip

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Call recording on SIP calls — see recordings skill

    line 44
  2. Distinctive:

    Default negotiation uses PCMU/PCMA.

    line 105
  3. Very specific:

    Status callback for inbound SIP: Only the completed event is delivered.

    line 153
  4. Very specific:

    All standard <Dial> attributes also apply: record, timeout, hangupOnStar, callerId, action, timeLimit, ringTone, etc.

    line 181
  5. Very specific:

    If no port is specified, Twilio uses the default for the scheme (5060 for sip:, 5061 for sips:)

    line 200
  6. Very specific:

    If your infrastructure relies on DNS SRV for failover or load distribution, use Twilio-side mechanisms instead: Elastic SIP Trunking …

    line 202
  7. Distinctive:

    Does not require a validated Twilio phone number

    line 206
  8. Very specific:

    After the SIP leg completes, the <Dial action=""> URL receives:

    line 212
  9. Distinctive:

    Both auth types enforced simultaneously: When both IP ACL and credential list are mapped, the caller must pass BOTH checks — source IP must …

    line 253
  10. Distinctive:

    IP ACL is not enough for multi-tenant providers: If your PBX is hosted on a shared platform (e.g., cloud PBX provider), multiple customers …

    line 255
  11. Distinctive:

    BYOC trunks discard custom headers: If the call arrives via a BYOC trunk, all custom SIP headers are silently dropped.

    line 265
  12. Very specific:

    Edge parameter ignored for registered endpoints: When dialing a registered endpoint via <Dial><Sip>, the edge or region URI parameter is …

    line 273
  13. Distinctive:

    Multiple registrations fork the call: If the same AOR has multiple active registrations (max 10), an inbound call to that AOR rings all …

    line 275
  14. Very specific:

    Mixed TLS environments: Use separate SIP Domains for endpoints with different TLS capabilities — one secure: true (TLS 1.2-compatible) and …

    line 301
  15. Very specific:

    SIP response codes are in DialSipResponseCode: When an outbound SIP call fails, the SIP response code (486 Busy, 408 Timeout, 503 …

    line 313

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

name: sip description: Twilio Programmable SIP (SIP Interface / SIP Domains) development guide. Use when building SIP-connected voice applications — PBX integration, softphone registration, SIP-to-PSTN bridging, custom SIP header routing, or choosing between SIP Interface and Elastic SIP Trunking.

Programmable SIP (SIP Interface)

Twilio SIP Interface connects SIP infrastructure (IP-PBX, softphones, SBCs) to Twilio Programmable Voice via SIP Domains. Inbound SIP INVITEs trigger TwiML webhooks; outbound calls reach SIP endpoints via <Dial><Sip>. This is the programmable layer — every call hits your webhook for dynamic routing, unlike Elastic SIP Trunking which provides a static PSTN pipe.

Evidence date: 2026-03-28 | Account: ACxx...xx | Test domain: SD88afbff... (cleaned up)

Scope

What SIP Interface does:

  • Receives SIP INVITEs at {your-domain}.sip.twilio.com and invokes your Voice URL for TwiML-based call handling
  • Sends outbound SIP via <Dial><Sip> to any SIP URI (your PBX, another provider, registered endpoints)
  • Supports SIP Registration so softphones/desk phones can register and receive calls without static IPs
  • Passes custom X- SIP headers bidirectionally between your infrastructure and webhooks
  • Authenticates via IP ACL, digest credentials, or both
  • Supports TLS signaling + SRTP media encryption (secure mode)
  • Supports emergency calling (E911) on SIP Domains

What SIP Interface CANNOT do:

  • Cannot provide a PSTN phone number directly — SIP Domains have no phone numbers. To receive PSTN calls on a SIP endpoint, route a Twilio number's Voice URL to return <Dial><Sip>. To originate PSTN calls from SIP, your webhook dials the PSTN number via <Dial><Number>.
  • Cannot do IP-only auth for registrations — Registration always requires digest credentials. IP ACL auth only applies to INVITE (call) authentication.
  • Cannot validate remote TLS certificates — Twilio accepts self-signed certs. TLS alone is not authentication and does not prevent MITM. You must also configure IP ACL or credential auth.
  • Cannot pass standard SIP headers to webhooks — Only X- prefixed custom headers and four specific standard headers (User-to-User, Remote-Party-ID, P-Preferred-Identity, P-Called-Party-ID) are forwarded. All other standard headers are stripped.
  • Cannot use custom headers with BYOC trunks — Custom SIP headers from BYOC trunk calls are silently discarded. This only works with Programmable Voice SIP.
  • Cannot use IPv6 in IP ACLs — IPv4 only, no wildcard IPs.
  • Cannot retrieve credential passwords — Passwords are MD5-hashed at creation and cannot be read back.
  • Cannot exceed 100 SIP Domains per account — Hard limit. Plan domain naming carefully.

Out of scope (covered by other skills):

  • Elastic SIP Trunking (carrier-grade PSTN pipe) — see the elastic-sip-trunking skill (in progress)
  • BYOC Trunks — see the elastic-sip-trunking skill
  • Call recording on SIP calls — see recordings skill
  • Conference bridging SIP legs — see conference skill

Quick Decision

NeedUseWhy
Connect PBX to PSTN via TwilioElastic SIP TrunkingStatic trunk, no per-call webhook logic needed
Dynamic call routing per SIP INVITESIP Interface (this skill)Every call hits your webhook for TwiML decisions
Softphone/desk phone registrationSIP Interface with sipRegistration: trueOnly SIP Domains support SIP REGISTER
Bring your own carrier to TwilioBYOC TrunkCarrier interconnect with Twilio call control
Pass metadata in SIP headersSIP InterfaceCustom X- headers flow to/from webhooks
Simple PSTN origination/terminationElastic SIP TrunkingNo TwiML needed, straight PSTN pipe
SIP-to-SIP call bridgingSIP InterfaceUse <Dial><Sip> in your webhook handler
Voice AI agent answering SIP callsSIP InterfaceWebhook returns ConversationRelay TwiML

Decision Frameworks

Authentication Model

SIP Domains support two auth mechanisms. If both are configured, both are enforced (AND, not OR). The authType field on the domain reflects the current state.

ConfigurationauthType valueBehavior
No auth configured"" (empty)Domain rejects all traffic
IP ACL only"IP_ACL"Source IP must match ACL entry
Credentials only"CREDENTIAL_LIST"407 challenge, digest auth required
Both"CREDENTIAL_LIST,IP_ACL"IP must match AND credentials must pass

[Evidence: SD88afbff... — tested all four states, authType field values confirmed]

Legacy vs v2 Auth API paths: The API exposes two paths for mapping ACLs and credential lists to domains — "legacy" top-level mappings (/Domains/{SD}/IpAccessControlListMappings) and "v2" auth-scoped mappings (/Domains/{SD}/Auth/Calls/IpAccessControlListMappings). These share the same backend storage — mapping via one path prevents mapping via the other (error 21231). Use the v2 paths for clarity: they separate call auth from registration auth. See auth-model reference for the full mapping.

Call Direction

DirectionHow it worksAuth requiredWebhook triggered
Inbound (SIP → Twilio)Your infra sends INVITE to {domain}.sip.twilio.comIP ACL and/or credentialsDomain's voiceUrl
Outbound (Twilio → SIP)TwiML returns <Dial><Sip>sip:user@host</Sip></Dial>Optional (username/password on <Sip>)<Sip url=""> for screening, <Dial action=""> on completion
Registered (registered endpoint → Twilio)Endpoint sends INVITE to its registration edgeCredential auth (registration + call)Domain's voiceUrl

Transport Selection

TransportURI parameterDefault portWhen to use
UDPtransport=udp (default)5060Standard, lowest latency
TCPtransport=tcp5060Large SIP messages, reliable delivery
TLStransport=tls5061Encrypted signaling (combine with secure: true for SRTP)

Codecs

SIP Interface supports the same codecs as Elastic SIP Trunking:

CodecAvailabilitySample Rate
G.711 μ-law (PCMU)GA8 kHz
G.711 A-law (PCMA)GA8 kHz
G.729Limited Availability8 kHz
OpusLimited Availability8-48 kHz
AMR-NBLimited Availability8 kHz

Default negotiation uses PCMU/PCMA. If your PBX only supports G.729 or other non-G.711 codecs, you must enroll in Limited Availability through Twilio. Calls to endpoints offering only unsupported codecs receive SIP 488 Not Acceptable Here.

Edge/Region Selection (Outbound)

Controls where Twilio's SIP-out traffic originates. Append to the SIP URI: sip:user@host;region=us1.

RegionEdgeLocation
us1ashburnVirginia (default)
us2umatillaOregon
ie1dublinIreland
de1frankfurtGermany
sg1singaporeSingapore
jp1tokyoJapan
br1sao-pauloBrazil
au1sydneyAustralia

For registered endpoints, the edge parameter on <Sip> is ignored — traffic originates from the registration edge.

Inbound SIP Call Flow

Your PBX/Softphone
  │ SIP INVITE → {domain}.sip.{edge}.twilio.com
  │
  ├── Auth: IP ACL check (if configured)
  ├── Auth: 407 challenge (if credentials configured)
  │
  └── Twilio fetches voiceUrl with standard + SIP-specific params:
        SipCallId, SipDomain, SipDomainSid, SipSourceIp,
        SipHeader_X-{name} (custom headers)
        │
        └── Your TwiML response handles the call

Inbound Webhook Parameters

Standard Voice parameters (CallSid, From, To, AccountSid, etc.) plus:

ParameterDescription
SipCallIdSIP Call-ID header from the INVITE
SipDomainHost portion of the SIP Request-URI
SipDomainSidSD-prefixed SID of the matched domain
SipSourceIpSource IP of the SIP signaling
SipHeader_X-{Name}Custom X-prefixed headers from the INVITE
SipHeader_User-to-UserUser-to-User header (if present)

Status callback for inbound SIP: Only the completed event is delivered. You do not get initiated, ringing, or answered events.

Outbound SIP (<Dial><Sip>)

<Response>
  <Dial callerId="sip:agent@example.com">
    <Sip username="myuser" password="mypass"
         statusCallback="https://example.com/sip-status"
         statusCallbackEvent="initiated ringing answered completed">
      sip:dest@pbx.example.com;transport=tls?x-route-id=42&amp;User-to-User=abc%3Bencoding%3Dhex
    </Sip>
  </Dial>
</Response>

<Sip> Noun Attributes

AttributeDefaultDescription
username(none)SIP digest auth username for the target
password(none)SIP digest auth password for the target
url(none)Call screening URL — TwiML fetched when callee answers, before connecting
methodPOSTHTTP method for the url attribute
statusCallback(none)URL for call status events
statusCallbackMethodPOSTHTTP method for status callback
statusCallbackEvent(none)Space-separated: initiated, ringing, answered, completed

All standard <Dial> attributes also apply: record, timeout, hangupOnStar, callerId, action, timeLimit, ringTone, etc.

SIP URI Format

sip:user@host[:port][;uri-params][?headers]
  • URI parameters (after ;): transport=tls, region=ie1, edge=dublin
  • Headers (after ?): x-mycustomheader=value, User-to-User=abc%3Bencoding%3Dhex
  • Max 1024 characters total for custom headers
  • XML-encode & as &amp; in TwiML

DNS Resolution for Outbound SIP URIs

Twilio resolves hostname-based SIP URIs (sip:sbc.example.com:5060) via A/AAAA DNS records only. RFC 3263 NAPTR/SRV resolution is not performed on the target hostname. This means:

  • SRV records advertising ports, transports, or weights for your SIP domain are ignored by Twilio's outbound SIP stack
  • The port and transport must be specified explicitly in the URI (e.g., sip:sbc.example.com:5060;transport=tls)
  • If no port is specified, Twilio uses the default for the scheme (5060 for sip:, 5061 for sips:)

If your infrastructure relies on DNS SRV for failover or load distribution, use Twilio-side mechanisms instead: Elastic SIP Trunking origination URL priority/weight routing, or multiple <Sip> nouns in TwiML.

Outbound Caller ID

  • Does not require a validated Twilio phone number
  • Can be alphanumeric with +-_. characters (no whitespace)
  • Set via callerId on <Dial> or From on the parent call

Action Callback Parameters

After the SIP leg completes, the <Dial action=""> URL receives:

ParameterDescription
DialSipCallIdSIP Call-ID from the INVITE
DialSipResponseCodeSIP response code (200, 486, 408, etc.)
DialSipHeader_X-{Name}Custom X-headers from the final SIP response

See sip-headers reference for the full header passthrough rules.

SIP Registration

Enable sipRegistration: true on the domain, then map at least one Credential List to the domain's Registration auth. Endpoints REGISTER at {domain}.sip.{edge}.twilio.com and can then receive calls and place outbound calls through the domain.

See registration reference for lifecycle, limits, edge locations, and calling patterns.

Registration Quick Reference

ParameterValue
Min expiry600 seconds (10 min)
Max expiry3600 seconds (1 hour)
Recommended refreshHalf of expiry
Max registrations per AOR10 (all ring simultaneously)
Max registrations per domain1,000,000
Auth methodDigest credentials only (no IP ACL for REGISTER)

Gotchas

Setup

  1. No auth = no traffic: A SIP Domain with no auth mappings (empty authType) silently rejects all inbound SIP. There is no error message — calls simply never arrive. Always verify authType is populated after setup. [Evidence: SD88afbff... — confirmed empty authType accepts nothing]
  2. No voiceUrl = call failure: Inbound SIP calls to a domain without a voiceUrl configured will fail. validate_sip catches this. [Evidence: validate_sip on SD88afbff...]
  3. Domain names are globally unique: {name}.sip.twilio.com is unique across all Twilio accounts. Error 21232 on collision. Use descriptive prefixes (e.g., mycompany-prod.sip.twilio.com). [Evidence: duplicate create returned 21232]
  4. Legacy and v2 auth paths share storage: Mapping an ACL via /Domains/{SD}/IpAccessControlListMappings and then via /Domains/{SD}/Auth/Calls/IpAccessControlListMappings returns error 21231 "already associated." They are the same mapping viewed from two API paths. Pick one path (v2 recommended) and stick with it. [Evidence: SD88afbff... — tested legacy then v2, got 21231]

Authentication

  1. Both auth types enforced simultaneously: When both IP ACL and credential list are mapped, the caller must pass BOTH checks — source IP must be in the ACL AND credentials must authenticate. This is AND logic, not OR. [Evidence: authType shows "CREDENTIAL_LIST,IP_ACL" — both listed]
  2. IP ACL is not enough for multi-tenant providers: If your PBX is hosted on a shared platform (e.g., cloud PBX provider), multiple customers may share the same IP. IP ACL alone cannot distinguish between them — add credential auth.
  3. Registration requires credentials, not IP ACL: The registration auth path (/Auth/Registrations/CredentialListMappings) only accepts credential lists. There is no IP ACL option for SIP REGISTER. This is by design — registering endpoints are typically on dynamic IPs.
  4. Credential passwords: min 12 chars, mixed case, digit required: Passwords are MD5-hashed and irrecoverable. If lost, delete and recreate the credential. Username max 32 characters.

Headers

  1. Only X-prefixed custom headers pass through: Standard SIP headers are stripped. Exceptions: User-to-User, Remote-Party-ID, P-Preferred-Identity, P-Called-Party-ID — these four standard headers also pass through on outbound <Sip> URIs.
  2. BYOC trunks discard custom headers: If the call arrives via a BYOC trunk, all custom SIP headers are silently dropped. This only works with Programmable Voice SIP Interface.
  3. 1024 character limit on outbound headers: Total length of all custom headers in the <Sip> URI query string. URL-encoding counts toward this limit.
  4. Action URL does not receive standard headers: The <Dial action=""> callback receives DialSipHeader_X-* (custom headers from the SIP response) but does not receive the four standard headers.

Registration

  1. Edge parameter ignored for registered endpoints: When dialing a registered endpoint via <Dial><Sip>, the edge or region URI parameter is ignored. Traffic originates from the edge where the endpoint registered.
  2. Multiple registrations fork the call: If the same AOR has multiple active registrations (max 10), an inbound call to that AOR rings all registered endpoints simultaneously (forked INVITE).
  3. E.164 required for PSTN from registered endpoints: Calls from registered endpoints to PSTN must use E.164 format and the number must be verified in the Twilio Console.
  4. Twilio sends E.164 with + prefix to your PBX: Inbound calls via SIP domains arrive with full E.164 formatting (e.g., +15551234567). PBXes configured for 10-digit or 11-digit dialing patterns will fail to match. Your dialplan must handle the + prefix — in Asterisk, use _+. pattern alongside _X. patterns.

DTMF

  1. DTMF mode must be RFC 2833/4733: Twilio uses RFC 2833 (telephone-event) for DTMF relay. PBXes configured for SIP INFO DTMF (e.g., Cisco CUCM default) or inband DTMF detection will lose all touchtone capability — no <Gather> digits, no payment entry, no conference controls. No error appears in the debugger; the call works but DTMF is silently lost. Configure your PBX for RFC 2833/4733 DTMF.

Security

  1. TLS ≠ authentication: Enabling secure: true enforces TLS signaling + SRTP media, but Twilio does not validate remote certificates. Self-signed certs are accepted. TLS prevents eavesdropping but not spoofing — always pair with IP ACL or credential auth.
  2. Secure mode applies to the entire domain: You cannot selectively enforce TLS for some endpoints and not others on the same domain. If you need mixed security levels, use separate SIP Domains.
  3. SIP session timers (RFC 4028) can drop long calls: Twilio uses session timers on SIP legs. If your PBX does not respond to session refresh re-INVITEs, the call is torn down after the session timer expires (typically 1800s / 30 minutes). This manifests as clean BYEs with no Twilio-side error. Contact center hold scenarios, conference bridges, and IVR parking are most affected. Ensure your PBX supports RFC 4028 session timer refreshes.
  4. Validate Twilio's TLS certificate on your PBX: While Twilio accepts self-signed certs from your infrastructure, your PBX SHOULD validate Twilio's certificate (issued by DigiCert). Configure verify_server=yes (Asterisk) or equivalent. One-way validation prevents MITM on the Twilio→PBX leg. The SIP Lab's Asterisk config demonstrates this pattern.
  5. SRTP requires SDES key exchange (RFC 4568): Twilio uses SDES (Session Description Protocol Security Descriptions) for SRTP key negotiation. PBXes configured for DTLS-SRTP (common in WebRTC) or ZRTP will fail media negotiation — TLS handshake succeeds but audio fails. Configure your PBX for media_encryption=sdes (Asterisk) or equivalent SDES mode.

TLS Version Compatibility

  1. TLS version negotiation failure is silent: When secure: true is set on a SIP Domain, Twilio enforces TLS for signaling. If the remote endpoint only supports TLS 1.3 and Twilio's edge negotiates TLS 1.2, the handshake fails silently — no debugger error specifically indicates TLS version mismatch. Diagnostic path: (1) Verify calls work without secure: true, (2) Check remote endpoint's TLS version with openssl s_client -connect <pbx>:5061 -tls1_2, (3) If TLS 1.2 fails, the endpoint needs reconfiguration or use a separate unsecured domain with IP ACL auth.
  2. Mixed TLS environments: Use separate SIP Domains for endpoints with different TLS capabilities — one secure: true (TLS 1.2-compatible) and one without (IP ACL-only security for incompatible endpoints).

DNS

  1. No DNS SRV resolution on outbound targets: When Twilio sends an outbound SIP INVITE via <Dial><Sip> to a hostname-based URI, it resolves the hostname via A/AAAA records only. RFC 3263 NAPTR/SRV lookups are not performed. If your PBX relies on SRV records for port/transport/weight discovery, those records are ignored. Use explicit port and transport in the URI, and handle failover via Twilio-side mechanisms (EST origination URL priority/weight, or multiple <Sip> nouns).

Observability

  1. Inbound status callback: completed only: Unlike outbound SIP (which supports initiated, ringing, answered, completed), inbound SIP to a domain only delivers the completed status event.
  2. Debugger SIP errors are account-wide: The validate_sip tool checks debugger for SIP errors (13xxx, 64xxx) account-wide, not filtered to the specific domain. Noisy accounts may show errors from other SIP resources.
  3. SIP response codes are in DialSipResponseCode: When an outbound SIP call fails, the SIP response code (486 Busy, 408 Timeout, 503 Unavailable, etc.) is available in the <Dial action=""> callback as DialSipResponseCode. This is the primary diagnostic for outbound SIP failures.

Resource Limits

ResourceLimit
SIP Domains per account100
IP Access Control Lists per account1,000
IP addresses per ACL100
Credential Lists per account100
Credentials per list1,000
Active registrations per AOR10
Active registrations per domain1,000,000
Registration expiry600–3,600 seconds
Custom SIP header total length1,024 characters
Domain friendlyName max64 characters
ACL friendlyName max255 characters
Credential username max32 characters
Credential password min12 characters

SID Reference

ResourcePrefix
SIP DomainSD
IP Access Control ListAL
IP AddressIP
Credential ListCL
CredentialCR

MCP Tools Quick Reference

OperationToolWhen
Validate domain + auth + debuggervalidate_sip(domainSid)After provisioning or when debugging
Create domaincreate_sip_domainInitial setup
Update domain configupdate_sip_domainChange voiceUrl, enable secure/registration
List domainslist_sip_domainsDiscovery
Create IP ACLcreate_sip_ip_access_control_listAuth setup
Add IP to ACLcreate_sip_ip_addressAuth setup
Create credential listcreate_sip_credential_listAuth setup
Add credentialcreate_sip_credentialAuth setup (password min 12, mixed case + digit)
Map ACL to domain (calls)create_sip_domain_auth_calls_ip_acl_mappingv2 auth path
Map CL to domain (calls)create_sip_domain_auth_calls_credential_list_mappingv2 auth path
Map CL to domain (registration)create_sip_domain_auth_registrations_credential_list_mappingRegistration auth

Note: SIP tools are P3 tier in the MCP server. validate_sip is always available; CRUD tools load on demand.

Common Patterns

Inbound SIP → TwiML Handler

// ABOUTME: Webhook handler for inbound SIP calls to a Twilio SIP Domain.
// ABOUTME: Routes calls based on custom SIP header or dialed extension.
exports.handler = function (context, event, callback) {
  const twiml = new Twilio.twiml.VoiceResponse();
  const routeId = event.SipHeader_X_Route_Id;
  const calledNumber = event.To;

  if (routeId === 'support') {
    twiml.dial().queue('support-queue');
  } else if (calledNumber.includes('8001')) {
    twiml.dial().conference('room-8001');
  } else {
    twiml.say('No route configured for this destination.');
    twiml.hangup();
  }

  callback(null, twiml);
};

Outbound SIP with Custom Headers

// ABOUTME: Places an outbound call that bridges to a SIP endpoint.
// ABOUTME: Passes custom headers and uses TLS transport.
exports.handler = function (context, event, callback) {
  const twiml = new Twilio.twiml.VoiceResponse();
  const dial = twiml.dial({
    callerId: 'sip:ivr@example.com',
    action: '/sip/dial-complete',
    timeout: 30,
  });

  dial.sip({
    username: context.SIP_USERNAME,
    password: context.SIP_PASSWORD,
    statusCallback: `https://${context.DOMAIN_NAME}/callbacks/sip-status`,
    statusCallbackEvent: 'initiated ringing answered completed',
  }, 'sip:agent@pbx.example.com;transport=tls?x-call-id=abc123&x-tenant=acme');

  callback(null, twiml);
};

Dial Action Handler (SIP Response Codes)

// ABOUTME: Handles the result of an outbound SIP dial attempt.
// ABOUTME: Routes based on SIP response code for retry or voicemail.
exports.handler = function (context, event, callback) {
  const twiml = new Twilio.twiml.VoiceResponse();
  const sipCode = event.DialSipResponseCode;
  const dialStatus = event.DialCallStatus;

  if (dialStatus === 'completed') {
    twiml.hangup();
  } else if (sipCode === '486') {
    // Busy — offer voicemail
    twiml.say('The extension is busy. Please leave a message.');
    twiml.record({ maxLength: 120, action: '/recordings/save' });
  } else if (sipCode === '408' || sipCode === '480') {
    // Timeout or temporarily unavailable — retry on backup
    twiml.dial().sip('sip:agent@backup-pbx.example.com');
  } else {
    twiml.say('Unable to connect your call. Goodbye.');
    twiml.hangup();
  }

  callback(null, twiml);
};

Related Resources

  • Voice skill — TwiML reference, <Dial> attributes, call lifecycle
  • Recordings skill — Recording SIP call legs
  • Conference skill — Bridging SIP participants into conferences
  • Real-time Transcription skill — Live transcription on SIP calls
  • SIP Lab — infrastructure/sip-lab/CLAUDE.md (Asterisk PBX test infrastructure)
  • SIP Lab E2E tests — __tests__/e2e/sip-lab/ (termination and PSTN connectivity tests)
  • Voice use case map — /skills/voice-use-case-map/SKILL.md (product selection guide)

Reference Files

TopicFileWhen to read
Auth model (legacy vs v2, setup order)references/auth-model.mdSetting up or debugging SIP Domain authentication
Custom SIP headers (passthrough rules)references/sip-headers.mdPassing metadata between SIP infrastructure and webhooks
SIP Registration (lifecycle, edges)references/registration.mdRegistering softphones, desk phones, or SIP endpoints
Live test results (evidence)references/test-results.mdVerifying specific claims or checking evidence SIDs
Assertion auditreferences/assertion-audit.mdReviewing provenance chain for skill claims
Voice SDK ↔ SIP bridgereferences/sdk-sip-bridge.mdBridging Voice SDK (WebRTC) calls to SIP endpoints, decision matrix

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.