Skip to main content

SIP Integration

SIP (Session Initiation Protocol) integration allows Crew to connect directly to your existing phone infrastructure, PBX systems, or SIP providers.

Overview

SIP integration is ideal for:
  • Enterprises with existing PBX systems
  • Organizations using custom SIP providers
  • High-volume deployments requiring direct connectivity
  • Scenarios requiring specific codec or routing control

Prerequisites

Before setting up SIP:
  1. SIP trunk provider or PBX with SIP support
  2. Static IP address(es) or FQDN for Crew
  3. Network firewall access for SIP/RTP traffic
  4. Codec compatibility (G.711, Opus)

SIP Trunk Configuration

Crew SIP Endpoint

Configure your SIP trunk to route calls to Crew:
SettingValue
SIP URIsip:{crew_id}@sip.usecrew.ai
TransportUDP, TCP, or TLS
Port5060 (UDP/TCP) or 5061 (TLS)
CodecG.711 μ-law, G.711 A-law, Opus

Authentication

Crew supports multiple SIP authentication methods: IP Allowlisting:
{
  "sip": {
    "auth": {
      "type": "ip_allowlist",
      "allowed_ips": [
        "203.0.113.10",
        "203.0.113.11"
      ]
    }
  }
}
Digest Authentication:
{
  "sip": {
    "auth": {
      "type": "digest",
      "username": "crew_user",
      "password": "secure_password"
    }
  }
}

Outbound Configuration

For outbound calls via your SIP trunk:
{
  "sip": {
    "outbound": {
      "uri": "sip:your-trunk.provider.com",
      "transport": "tls",
      "auth": {
        "username": "your_username",
        "password": "your_password"
      },
      "caller_id": "+14155551234"
    }
  }
}

Call Routing

Inbound Routing

Map inbound SIP calls to Crew agents:
{
  "sip": {
    "inbound_routes": [
      {
        "match": {
          "to_user": "main"
        },
        "agent_id": "agent_sarah"
      },
      {
        "match": {
          "to_user": "support"
        },
        "agent_id": "agent_marcus"
      }
    ]
  }
}

DID Routing

Route based on called number (DID):
{
  "sip": {
    "inbound_routes": [
      {
        "match": {
          "to_uri": "+14155551111"
        },
        "agent_id": "agent_sales"
      },
      {
        "match": {
          "to_uri": "+14155552222"
        },
        "agent_id": "agent_support"
      }
    ]
  }
}

Network Configuration

Firewall Rules

Allow the following traffic:
ProtocolPortDirectionPurpose
UDP5060Inbound/OutboundSIP signaling
TCP5060Inbound/OutboundSIP signaling
TLS5061Inbound/OutboundSecure SIP
UDP10000-20000Inbound/OutboundRTP media

Crew IP Ranges

For outbound calls from Crew, allow these IP ranges:
203.0.113.0/24  (example - actual IPs provided during setup)
198.51.100.0/24 (example - actual IPs provided during setup)
Contact support@usecrew.ai for current IP ranges.

Codec Configuration

Supported Codecs

CodecSample RateBitrateQuality
G.711 μ-law8kHz64 kbpsStandard
G.711 A-law8kHz64 kbpsStandard
Opus8-48kHz6-510 kbpsHigh

Codec Priority

Configure codec preference:
{
  "sip": {
    "codecs": [
      {
        "name": "opus",
        "priority": 1,
        "sample_rate": 16000
      },
      {
        "name": "PCMU",
        "priority": 2
      },
      {
        "name": "PCMA",
        "priority": 3
      }
    ]
  }
}

PBX Integration

Asterisk

Example Asterisk trunk configuration:
; sip.conf
[crew-trunk]
type=friend
host=sip.usecrew.ai
username=your_crew_id
secret=your_sip_password
fromdomain=sip.usecrew.ai
insecure=port,invite
qualify=yes
context=from-crew
; extensions.conf
[from-external]
exten => _X.,1,Dial(SIP/${EXTEN}@crew-trunk)

[from-crew]
exten => _X.,1,Dial(SIP/${EXTEN})

FreePBX

Configure via FreePBX web interface:
  1. ConnectivityTrunksAdd SIP Trunk
  2. Set outbound caller ID
  3. Configure PEER details with Crew SIP endpoint
  4. Create outbound route pointing to trunk

Cisco Unified CM

Configure SIP trunk in CUCM:
  1. DeviceTrunkAdd New
  2. Select SIP Trunk type
  3. Configure destination as sip.usecrew.ai
  4. Set up route pattern for Crew destinations

SIP Headers

Custom Headers

Pass custom data via SIP headers:
{
  "sip": {
    "custom_headers": {
      "inbound": [
        {
          "header": "X-Customer-ID",
          "variable": "customer_id"
        }
      ],
      "outbound": [
        {
          "header": "X-Campaign-ID",
          "value": "{{campaign_id}}"
        }
      ]
    }
  }
}

RPID/PAI

Configure Remote Party ID or P-Asserted-Identity:
{
  "sip": {
    "caller_id": {
      "source": "pai",
      "fallback": "rpid"
    }
  }
}

Monitoring

SIP Registration Status

Check SIP trunk status:
curl https://api.usecrew.ai/v1/sip/status \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "status": "registered",
  "registrar": "sip.usecrew.ai",
  "last_registration": "2024-01-15T10:00:00Z",
  "expires": "2024-01-15T10:05:00Z"
}

Call Quality Metrics

Monitor SIP call quality:
{
  "call_id": "call_abc123",
  "quality": {
    "mos": 4.2,
    "jitter_ms": 12,
    "packet_loss_percent": 0.1,
    "rtt_ms": 45
  }
}

Troubleshooting

Registration Failures

  1. Verify credentials are correct
  2. Check firewall allows SIP traffic
  3. Ensure DNS resolves properly
  4. Check for NAT traversal issues

One-Way Audio

  1. Verify RTP ports are open
  2. Check for NAT/firewall blocking
  3. Ensure symmetric RTP if required
  4. Verify codec negotiation

Call Quality Issues

  1. Check network latency and jitter
  2. Verify sufficient bandwidth
  3. Test codec compatibility
  4. Review QoS settings

Best Practices

Encrypt SIP signaling with TLS for security.
Use SRTP to encrypt voice traffic when possible.
Prioritize SIP/RTP traffic on your network.
Track MOS scores and address degradation promptly.
Configure backup SIP trunks for redundancy.

Next Steps