Elastic SIP Trunking — Trunks
List or create SIP trunks using the Sinch Elastic SIP Trunking API. Trunks are the top-level resource for SIP connectivity. Uses OAuth2.
IMPORTANT: Execute this command directly. Do NOT generate script files. Perform the API call immediately.
Input
--action/-a: list or create - optional, default list--name/-n: Trunk name (for create) - required if action=create--host-name/-h: SIP hostname for the trunk (for create) - optional--format/-f: Output format (table or json) - optional
Arguments: $ARGUMENTS
Instructions
Execute these steps directly - do not write code or scripts:
If $ARGUMENTS empty: ask "List trunks or create one?" and for create get name, hostname. Otherwise parse.
Validate: --action (list|create), for create require --name. Get CONVERSATION_PROJECT_ID, CONVERSATION_KEY_ID, CONVERSATION_KEY_SECRET. Base: https://elastic-trunking.api.sinch.com/v1. If missing, report "Sinch API is not configured."
If list: GET https://elastic-trunking.api.sinch.com/v1/projects/{projectId}/trunks with OAuth2. Display table (id, name, hostName, createTime) or JSON.
If create: POST .../trunks with body { name, hostName }. Return trunk id and hostname. Note: use trunk-specific hostname (e.g. {trunk-hostname}.pstn.sinch.com) for SIP INVITEs, not generic trunk.pstn.sinch.com.
"✅ Trunks listed" or "✅ Trunk created". Handle 401, 400, 404. Handle all errors gracefully.
Examples
/sinch-api-sip-trunks
/sinch-api-sip-trunks --action=create --name="Production" --host-name=sip.example.com
API Reference
- Base URL: https://elastic-trunking.api.sinch.com/v1
- List: GET /projects/{projectId}/trunks
- Create: POST /projects/{projectId}/trunks
- Documentation: https://developers.sinch.com/docs/elastic-sip-trunking/