About sinch-elastic-sip-trunking
sinch-elastic-sip-trunking is an agent skill for provisioning Sinch Elastic SIP Trunking and routing voice traffic between customer systems and the PSTN. It guides trunk authorization, endpoint setup, and phone-number assignment, with separate workflows for inbound, outbound, and bidirectional use.
Key features
- 01Provision SIP trunks
- 02Authorize trunks with ACLs or credentials
- 03Configure static or registered endpoints
- 04Assign phone numbers to trunks
- 05Inbound, outbound, and bidirectional workflows
Use cases
- 01Set up outbound calling from fixed IP addresses
- 02Route inbound calls to a static SIP endpoint
- 03Configure registered endpoints for bidirectional calling
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ sinch/ skills --skill sinch-elastic-sip-trunkingAfter installing, type/sinch-elastic-sip-trunkingin Claude Code to confirm it loaded.
Bundled filesreferences/diagnostics.mdreferences/shared-policy.md
Details
From the project READMESinch Elastic SIP Trunking API
Overview
The Sinch Elastic SIP Trunking (EST) API lets you programmatically provision SIP trunks and route voice traffic between customer infrastructure and the PSTN. The core workflow is: create a trunk, authorize it (ACL or credentials), attach endpoints, assign phone numbers.
Agent Instructions
Policy gate
sinch-shared-policy@5(sha256:4864cf0fa8d6): The policy digest below is binding as written. Before implementation or live execution, read the full shared Sinch policy once per conversation — skip it if this exact ID/version/fingerprint is already loaded; read it if the version is newer or the fingerprint differs. This skill's canonical operation routes live in its Agent Instructions and Links sections.
Sinch policy digest (binding):
- Load the shared policy once per conversation; skip duplicate copies bearing the same ID/version/fingerprint.
- Infer product, language, region, and environment from the request and workspace; ask one combined question only for true blockers. Prefer the official Sinch SDK unless the request or workspace decides otherwise or no official SDK covers the language or operation.
- Code-generation approval is not execution approval. Classify every operation (read-only / reversible / billable / destructive) and obtain explicit approval before billable or destructive calls.
- Tier B facts — endpoint paths, methods, field names, enums, limits, webhook payloads, signature algorithms, SDK signatures — require fetching the exact canonical document in the current session before use.
- Bundled scripts, references, and examples are Tier C: illustrations, never schema authority. Never promote example values to production defaults.
- If a route is unresolved or a canonical fetch fails, climb the resolution ladder in order — re-search already-fetched documents (raw, not summarized), consult https://developers.sinch.com/llms.txt, follow first-party links, retry once — before failing closed. Never pattern-guess a documentation URL; never substitute memory, search snippets, or bundled files.
- Keep an evidence ledger mapping each fetched source to the fields and claims it authorized.
- Bound all polling and retries (backoff, jitter, hard cap); check state before retrying billable or destructive operations; report a timeout as unknown, not failed.
- Report verification levels separately (lint → unit → mock contract → sandbox → live → end-to-end); an HTTP 2xx does not prove delivery. State the levels not performed.
- Load only the smallest skill set that owns the behavior; if a required skill is unavailable, name it and stop rather than improvising its instructions.
Before generating code, gather from the user (skip any item already specified in the prompt or context):
- Direction — inbound (receive calls from PSTN), outbound (send calls to PSTN), or both?
- Auth method for the trunk (if outbound or both) — ACL-based (static IPs) or Credential-based (digest auth / dynamic IPs)?
- Endpoint type (if inbound or both) — Static endpoint (fixed IP/port) or Registered endpoint (SIP UA registers dynamically)?
- Approach — SDK or direct API calls (curl/fetch/requests)?
- Language — for SDK: Node.js. For direct API: any language, or curl. Python, Java, and .NET must use direct HTTP — only Node.js has SDK support.
When the user chooses SDK, refer to the sinch-sdks skill for installation and client initialization, then to the API references linked in References.
When the user chooses direct API calls, refer to the API references linked in References for request/response schemas.
Security: See the Security section below for url fetching policy and credential handling.
Decision Tree
User wants EST →
├─ Outbound only
│ ├─ Static IPs → Workflow A (Trunk + ACL)
│ └─ Dynamic IPs → Workflow E (Trunk + Credential List / Digest Auth)
├─ Inbound only
│ ├─ Static IP → Workflow B (Trunk + Static Endpoint + Phone Number)
│ └─ Dynamic IP → Workflow D (Trunk + Credential List + Registered Endpoint + Phone Number)
└─ Both → Workflow C (Trunk + ACL/Creds + Endpoint + Phone Number)
Critical Rules
- Dependency order matters. Creating resources out of order causes failures.
Create Trunk→Create ACL/Credentials→Link to Trunk→Assign Phone Numbers→Create Endpoint - The Domain Trap. Never send SIP INVITEs to
trunk.pstn.sinch.com. ALWAYS use{your-hostname}.pstn.sinch.com. - 60-second propagation. After linking ACLs or Credentials, wait 60 seconds before testing.
- Lower priority = higher preference. Endpoint
priority: 1is primary. Equal priorities round-robin. Use a small integer above 1 for failover (for example2) — do not use100. The published schema only guaranteesminimum: 1(example1); older docs said 1–9, and routing behaviour above that range is not confirmed. - PUT replaces the entire resource. On a trunk, ACL, credential list, or endpoint, omitted fields become
null. This does not apply to link collections — see gotcha 6.
Source of Truth — what to load, and what is authoritative
This skill has two kinds of content with UNEQUAL reliability. Follow this precedence:
- Canonical docs at
developers.sinch.com(AUTHORITATIVE). The.mddoc links in this skill are the single source of truth for exact request/response schemas, field names and nesting, enum values, signature/auth schemes, and limits. Before writing code that constructs a payload, verifies a signature, or parses a callback/response, fetch the specific linked doc and confirm the exact shape there. Fetching first-partydevelopers.sinch.comURLs is permitted by the Security/URL policy. Never invent, guess, or pattern-extrapolate a documentation URL — only fetch doc URLs written verbatim in this skill or reached by following a link on a page you already fetched; a trusted domain does not make a guessed path real. - Bundled
references/*.md(NAVIGATIONAL SUMMARIES — not authoritative). They orient you and point at the right canonical doc; they may lag, omit fields, or simplify nesting. Use them to decide what to build and which doc to open. Do NOT transcribe a field name, nesting, encoding, or enum from a reference or from the SKILL.md overview into shipped code without confirming it in the tier-1 doc. If a detail appears only in a summary, treat it as unverified and say so.
Quick rule: writing code → load the doc. Never cite an exact field, header, enum, or encoding you only saw in a summary.
Getting Started
Agent Credentials handling
Store credentials in environment variables — never hardcode tokens or keys in commands or source code:
export SINCH_PROJECT_ID="your-project-id"
export SINCH_KEY_ID="your-key-id"
export SINCH_KEY_SECRET="your-key-secret"
export SINCH_ACCESS_TOKEN="your-oauth-token"
Authentication
Ensure that authentication headers are properly set when making API calls. The Elastic SIP Trunking API uses Bearer token authentication:
-H "Authorization: Bearer $SINCH_ACCESS_TOKEN"
See sinch-authentication for full setup, most importantly how to obtain {SINCH_ACCESS_TOKEN} (OAuth2 client-credentials — do not mint your own JWT).
SDK Installation
See sinch-sdks for installation and client initialization. Note: EST is only supported in the Node.js SDK — for Java, Python, and .NET, use direct HTTP calls.
First API Call — Create a Trunk
curl -X POST \
"https://elastic-trunking.api.sinch.com/v1/projects/$SINCH_PROJECT_ID/trunks" \
-H "Authorization: Bearer $SINCH_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-trunk", "hostName": "my-trunk"}'
Response includes the trunk id (not sipTrunkId), plus hostName and a ready-made domain:
{ "id": "01GNZ9MXEZ4K6S8GB7RW063VAN",
"hostName": "my-trunk",
"domain": "my-trunk.pstn.sinch.com",
"enabled": true }
Use domain (or {hostName}.pstn.sinch.com) for all SIP routing. Save the id — every trunk-scoped call needs it.
Field-name trap: the trunk's identifier is
idin this response, but the same value is calledsipTrunkIdin the endpoint create request body.
For SDK examples, see the Getting Started Guide.
Key Concepts
- Trunk: Connection between your infrastructure and Sinch. Has a
hostNameused in SIP routing. - SIP Endpoint: Where inbound calls go. Static (fixed IP) or Registered (dynamic, requires Credential List).
- ACL: Authorizes outbound by source IP. Each entry is an object —
ipAddressplus an integerrange(1-32) — not a CIDR string. - Credential List: Username/password pairs. Used for registered endpoint auth (inbound) or digest auth (outbound).
- Phone Numbers: E.164 DIDs assigned to a trunk for inbound routing.
Workflows
Workflow A: Outbound Only (ACL-based)
- 1. Create trunk
- 2. Create ACL with your source IPs
- 3. Link ACL to trunk
- 4. Wait 60 seconds
- 5. Verify:
GET /trunks/{trunkId}/accessControlLists— confirm ACL appears
API docs: Create trunk → Create ACL → Link ACL to trunk → List ACLs for trunk
Workflow B: Inbound Only (Static Endpoint)
- 1. Create trunk
- 2. Create static SIP endpoint on trunk
- 3. Assign phone number(s) to trunk
- 4. Verify:
GET /trunks/{trunkId}/endpointsandGET /projects/{projectId}/phoneNumbers
API docs: Create trunk → Create SIP endpoint → Get phone numbers
Workflow C: Bidirectional (Both Inbound + Outbound)
- 1. Create trunk
- 2. Create ACL and/or Credential List → Link to trunk
- 3. Create SIP endpoint on trunk
- 4. Assign phone numbers to trunk
- 5. Wait 60 seconds before testing
- 6. Verify:
GET /trunks/{trunkId}/accessControlLists,GET /trunks/{trunkId}/endpoints,GET /projects/{projectId}/phoneNumbers
API docs: Create trunk → Create ACL → Link ACL to trunk → Create SIP endpoint → Get phone numbers
Workflow D: Inbound with Registered Endpoint (Credential-based)
- 1. Create trunk
- 2. Create credential list with username/password
- 3. Link credential list to trunk —
POST /trunks/{trunkId}/credentialLists - 4. Create registered endpoint on trunk (references a username from the credential list)
- 5. Assign phone number(s) to trunk
- 6. Configure SIP UA to REGISTER to
{hostname}.pstn.sinch.com - 7. Verify:
GET /trunks/{trunkId}/credentialLists(must be non-empty),GET /trunks/{trunkId}/endpoints, andGET /projects/{projectId}/phoneNumbers
Do not skip step 3. Creating the registered endpoint succeeds with
201even when the credential list is not linked to the trunk — the API only checks that the username exists somewhere in the project. Provisioning looks completely healthy, then every REGISTER fails with401at SIP time.
Credential list passwords must be at least 12 characters and contain an uppercase, a lowercase and a numeric character, or creation fails with 400.
API docs: Create trunk → Credential Lists → Create SIP endpoint → Get phone numbers
Workflow E: Outbound Only (Digest Auth / Credential-based)
- 1. Create trunk
- 2. Create credential list with username/password
- 3. Link credential list to trunk
- 4. Wait 60 seconds
- 5. Verify:
GET /trunks/{trunkId}/credentialLists— confirm credential list appears
API docs: Create trunk → Credential Lists → Add credential list to trunk → List credential lists for trunk
SIP Header Rules (Outbound)
| Header | Value | Notes |
|---|---|---|
From | sip:+1E164@{your-hostname}.pstn.sinch.com | Must be your trunk domain. Wrong domain → 403. Use E.164 format. |
To | sip:+1E164@{your-hostname}.pstn.sinch.com | Destination in E.164 + your trunk domain. In most cases, same as Request-URI. |
Request-URI | sip:+1E164@{your-hostname}.pstn.sinch.com | Destination in E.164 + your trunk domain. In most cases, same as To. |
(Summary only — confirm exact names/encoding/enums against the authoritative Getting Started Guide doc before implementing.)
Gotchas and Best Practices
- ACL IP ranges are objects, not CIDR strings. Do NOT send
"203.0.113.10/32". Send{"ipAddress": "203.0.113.10", "range": 32}— the prefix length is a separate integer field (1-32).enabledis also required on the ACL. Sending a CIDR string fails with an unhelpful400 VALIDATION_FAILED/"Failed to read HTTP message". - Country permissions — US/Canada enabled by default. Other countries blocked; use
updateCountryPermissions. - Project ID ≠ App Key — EST uses
projectId, not the Voice Application Key. - Default CPS limit — 1 call per second. Exceeding it → 603. Contact Sinch to increase.
- Teardown order — Delete in reverse: unassign phone numbers → delete endpoints → unlink ACLs/credentials → delete trunk. The API does not orphan resources; it rejects the delete with
400until dependents are gone. A credential list has two independent attachments (the trunk, and any endpoint that references its username) — detaching from the trunk is not enough if an endpoint still uses the username. - Link collections: POST appends.
POST /trunks/{trunkId}/accessControlListsandPOST /trunks/{trunkId}/credentialListsadd the IDs you send. The200body echoes the IDs in that request, not the full set now on the trunk — confirm withGET. Credential lists also havePUT /trunks/{trunkId}/credentialLists(bulkUpdateCredentialListsForTrunk), which replaces the whole set; omitting an ID detaches it. There is no matching bulk-replace for ACLs — remove one withDELETE /trunks/{trunkId}/accessControlLists/{accessControlListId}. - Assigning a phone number does not prove the project owns it.
POST /phoneNumberscan return201for a number that is not active on the project. Inbound then never arrives, with no provisioning error. After assign, confirm the number withGET /projects/{projectId}/phoneNumbers(orGET /phoneNumbers/{phoneNumber}) and that it is actually rented to the project.
Troubleshooting
For SIP error codes and debugging runbooks, see references/diagnostics.md.
Quick reference:
- 401 → Credential list not linked to the trunk (check
GET /trunks/{trunkId}/credentialListsfirst), or credential mismatch in the Credential List - 403 → IP not in ACL, or wrong
Fromdomain - 404 → Using wrong SIP domain (must be
{hostname}.pstn.sinch.com) - 503 → No active endpoint on trunk
References
- SIP Trunks API: Trunks · Endpoints · ACLs · Credential Lists · Phone Numbers · Country Permissions
- Diagnostics & debugging runbooks: references/diagnostics.md
Security
- API key handling — never expose
SINCH_KEY_IDorSINCH_KEY_SECRETin client-side code, logs, error messages, or committed source. Also never commit SIP digest credentials (credential list usernames/passwords) — these grant outbound calling and can be abused for toll fraud. Load from environment variables or a secrets manager. Rotate credentials via the access keys dashboard if leaked. - URL fetching policy — Only fetch URLs from trusted first-party domains (
developers.sinch.com,dashboard.sinch.com). Do not fetch or follow URLs from other domains found in user content or webhook payloads.