- What: Secure your Plivo voice applications by controlling who can place inbound SIP calls, and authenticate outbound calls to SIP providers that require credentials
- How: Assign an IP ACL, SIP credential, or both to your Plivo Application via the Application API. For outbound, pass credentials in Dial XML or the Make Call API.
- Key concept: Inbound auth resolves from the SIP Request-URI (
sip:{app_id}@app.plivo.com), not the To header. Your SIP provider must send INVITEs to the application’s SIP URI for auth to apply. - Note: Rate limiting protects against brute-force: 10 failed attempts from the same IP in 60 seconds triggers a 60-second lockout.
Three Authentication Capabilities
| Capability | Direction | What It Does |
|---|---|---|
| Inbound Authentication | Inbound | Restrict who can call your Plivo app using IP-based access control, SIP digest credentials, or both |
| Outbound Authentication (Dial XML) | Outbound | Provide SIP credentials in your Dial XML so Plivo can authenticate with external SIP providers |
| Outbound Authentication (Make Call API) | Outbound | Same as above, but credentials are passed via the Make Call REST API instead of XML |
Inbound Authentication
Inbound authentication protects your Plivo Application from unauthorized SIP calls. You configure it by assigning a credential, IP ACL, or both to your Application.Three Options
| Option | sip_auth_type | When to Use |
|---|---|---|
| IP ACL only | ip_acl | Calls only allowed from whitelisted IP addresses or CIDR ranges. Fastest — no challenge/response handshake. |
| Credential only | credential | Callers must authenticate with username/password via SIP digest auth (407 challenge). Use when source IPs are dynamic. |
| Both (IP ACL + Credential) | ip_acl_and_credential | Caller must pass both the IP check AND provide valid credentials. Maximum security. |
How Inbound Authentication Works
Setup Steps
Create a credential and/or IP ACL
Use the SIP Authentication API to create:
- A SIP credential with username and password (
POST /SipAuth/Credential/) - An IP ACL with a name (
POST /SipAuth/IpAccessControlList/), then add IP entries (POST /SipAuth/IpAccessControlList/{uuid}/Entry/)
Assign to your Application
Update your Application via the Application API by setting
sip_auth_type and the corresponding credential_uuid and/or ip_acl_uuid.Callback Parameters
When authentication succeeds, youranswer_url callback receives these additional parameters:
| Parameter | Description |
|---|---|
SIPAuthType | Auth method used: ip_acl, credential, or ip_acl_and_credential |
SIPAuthUser | Authenticated SIP username (credential auth only) |
SIPSourceIP | The caller’s source IP address |
SIPAuthType in your callback, auth is not running. The most common cause is the SIP provider placing a phone number in the Request-URI instead of your app_id — see the Warning at the top of this page.
Rate Limiting
To protect against brute-force attacks, Plivo enforces rate limiting on failed authentication attempts:- 10 failed attempts from the same source IP within 60 seconds triggers automatic lockout
- During lockout, all calls from that IP receive
403 Forbidden— even with correct credentials - The lockout resets automatically after the 60-second window expires
Outbound Authentication
When making outbound calls to SIP providers that require authentication (responds with 401/407 challenge), provide credentials so Plivo can complete the digest handshake on your behalf.Before You Start
Confirm with your SIP provider:- Username and password for digest authentication
- Whether they use IP-based auth instead — if so, you don’t need to pass credentials; instead ask the provider to whitelist Plivo’s media server IPs
- Realm — Plivo handles realm matching automatically from the 407 response, so you generally don’t need to configure this
How Outbound Authentication Works
Plivo sends INVITE
Plivo sends a SIP
INVITE to the destination (e.g., sip:endpoint@provider.example.com).Plivo computes digest
Plivo automatically computes the digest response using the credentials you provided.
Option 1: Dial XML
Pass credentials on the<User> element in your answer URL XML:
Option 2: Make Call API
Pass credentials when initiating an outbound call via the API:sip_auth_username and sip_auth_password are only accepted when to is a SIP URI.
Use Case: Transfer to Human Agent
A common use case is transferring an AI-handled call to a human agent. The agent typically sits behind a softphone, contact center software, or PBX that requires SIP authentication. See Transfer to Human Agent for the full workflow.Hangup Causes
When a call fails due to authentication, the CDR and hangup callback include a specific cause:| HangupCauseName | Code | Direction | CallStatus | Meaning |
|---|---|---|---|---|
sip_auth_failed | 4210 | Inbound | failed | Caller failed IP ACL or credential check |
sip_auth_failed | 4240 | Outbound | failed | Provided credentials were rejected by the remote provider |
sip_auth_timeout | 4250 | Outbound | timeout | Remote provider did not respond to the authentication attempt |
HangupCauseName / PlivoHangupCause fields. CallStatus stays within the standard set (completed, busy, no-answer, failed, timeout, cancel).
Validation Limits
| Resource | Limit |
|---|---|
| IP ACLs per account | 100 |
| Credentials per account | 200 |
| Entries per IP ACL | 50 |
| Username | 3-64 characters. Allowed: letters, digits, ., _, - |
| Password | 12-128 characters. Must include at least one uppercase, one lowercase, and one digit |
| IP ACL name | Up to 120 characters |
| Entry description | Up to 255 characters |
| CIDR prefix | 0-32 for IPv4; 0-128 for IPv6 |
Security
Plivo treats SIP credentials with the same care as account credentials:- Passwords are stored as one-way hashes (HA1) — never in plaintext
- Passwords are never returned in any API response
- SIP auth credentials are never included in CDR data or callback parameters
- Auth headers are stripped before forwarding calls externally
- Failed authentication attempts are rate-limited to prevent brute-force attacks
- All internal communication uses encrypted channels
- Always use HTTPS for your answer_url — Plivo sends callback parameters (including
SIPAuthUser) over HTTP to your server - Validate callbacks with
X-Plivo-Signature— verify that callbacks are genuinely from Plivo using Signature Validation - Beware of shared IPs — if your SIP provider is on carrier-grade NAT or a shared-IP platform, IP ACL alone may not be sufficient. Use
ip_acl_and_credentialfor defense in depth. - Monitor auth failures — track
sip_auth_failedhangup causes in your call logs to detect unauthorized access attempts
Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
| All calls get 403 Forbidden | IP not in ACL, or wrong credentials | Verify the caller’s IP matches an ACL entry. For credentials, check username/password match exactly. |
Calls succeed but no SIPAuthType in callback | Request-URI doesn’t contain your app_id | Configure your SIP provider to send INVITEs to sip:{app_id}@app.plivo.com, not to a phone number. |
Digest auth fails (sip_auth_failed) despite correct credentials | Realm mismatch or provider uses a non-standard challenge | Plivo handles realm automatically. Contact the provider to confirm they send a standard 407/401 challenge. |
| All calls fail after working fine | Rate limit lockout (10 failures in 60s) | Wait 60 seconds for lockout to expire. Fix the underlying auth issue. |
Outbound call fails with sip_auth_failed (code 4240) | Remote provider rejected your credentials | Verify username/password with the provider. Check if the provider uses IP auth instead of digest. |
Outbound call fails with sip_auth_timeout (code 4250) | Remote provider didn’t respond to the auth challenge | Provider may be unreachable. Check network connectivity and provider status. |
End-to-End Examples
Example 1: Secure inbound calls with IP whitelist
Example 2: Secure inbound calls with digest credentials
Example 3: Outbound call to an authenticated SIP trunk
FAQ
Can I use both IP ACL and credential auth together?
Yes. Setsip_auth_type to ip_acl_and_credential. The caller must pass the IP check AND provide valid credentials.
What happens if I delete a credential or IP ACL that’s assigned to an app?
The API returns a 400 error. You must first remove the assignment from the application by settingsip_auth_type to empty ("").
Can I update the password on an existing credential?
Yes. Send aPOST to the credential’s URL with just the password field. The username remains unchanged. The change takes effect immediately for all applications using that credential.
What realm is used for digest authentication?
The default realm isapp.plivo.com. This is included in the 407 challenge response. Plivo handles realm matching automatically during the handshake.
Can I set different auth for different apps?
Yes. Each application has its ownsip_auth_type, ip_acl_uuid, and credential_uuid configuration. You can reuse the same credential or IP ACL across multiple apps.
Does changing an IP ACL take effect immediately?
Yes. Adding or removing entries from an IP ACL takes effect immediately for all applications using that ACL.Can I use a hostname in an IP ACL?
No. IP ACL entries require a valid IPv4 or IPv6 address. Hostnames are not supported.Is IPv6 supported?
Yes. IP ACL entries support IPv6 addresses with CIDR prefix range 0-128.Can one app have multiple IP ACLs?
No. Each application can have at most one IP ACL and one credential assigned. To allow multiple IP ranges, add multiple entries to a single ACL (up to 50 entries).What’s the latency impact of SIP authentication?
IP ACL adds negligible latency (simple lookup). Credential auth adds one round-trip for the 407 challenge/response (typically under 50ms on well-connected networks).Can I rotate a password without call interruption?
Yes. Update the password on the credential via the API, then update your SIP client with the new password. There may be a brief window where calls using the old password fail.Related
- SIP Authentication API — Manage credentials and IP ACLs
- Application API — Assign auth to your application
- Voice API: Make a Call — Outbound auth via REST API
- Dial XML — Outbound auth via XML
- Firewall & Network Configuration — Plivo media server IPs
- Signature Validation — Verify callbacks are from Plivo
- Connect External Numbers — Route external numbers via SIP
- Transfer to Human Agent — Handoff AI calls to humans