SIP Trunk Authentication Issue – 403 Forbidden Err...
# support
c
Hello everyone, I'm experiencing an authentication issue with my SIP trunk using the "byo-sip-trunk" provider. When I use a SIP URL like sip:mynumbervapi@sip.vapi.ai without authentication, calls are placed successfully and reach the configured VAPI agent. However, the problem arises when authentication is enabled. Initially, I attempted to use a SIP URL with authentication (sip:mynumbervapi@sip.vapi.ai), but I couldn't place calls. Then, I configured a SIP trunk with the "byo-sip-trunk" provider following the guide at: https://vapi.notion.site/SIP-104008c8393f80feaeb7de8ca19565ed The trunk configuration, number, and API call verification to the number are all working perfectly. The issue occurs when placing a call from Asterisk, as sip.vapi.ai returns a SIP 403 Forbidden error. Below is the SIP configuration I am using in Asterisk: [vapi-trunk] type=peer host=sip.vapi.ai fromdomain=sip.vapi.ai fromuser=78989895-684a-4f87-9ca7-*************f username=78989895-684a-4f87-9ca7-*************f secret=32******-7981-4682-96f3-*************** context=incoming-vapi canreinvite=no qualify=yes [incoming-vapi] exten => _X.,1,NoOp(Calling Vapi) same => n,Dial(SIP/vapi-trunk/${EXTEN}) same => n,Hangup() Can anyone with experience in SIP trunks help me identify what might be causing this authentication issue? Thank you in advance for your help. Best regards, Sergio C.H
v
Hi Sergio! 👋 I can see you're having authentication issues with your SIP trunk. Based on the information you've provided, here are some potential causes for the SIP 403 Forbidden error: ### Common Authentication Issues - **Credential Format**: Make sure your username and password match exactly what's configured in your VAPI account [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1333747605628391434) - **Authentication Method Mismatch**: Verify whether VAPI is expecting IP-based or credential-based authentication [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1333747605628391434) ### Configuration Suggestions I notice you're using the older SIP configuration format in Asterisk. Our documentation suggests using PJSIP configuration for better compatibility. Here's an example of how it might look:
Copy code
ini
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[byo-sip-trunk]
type=endpoint
transport=transport-udp
context=from-internal
disallow=all
allow=ulaw
outbound_auth=byo-sip-trunk-auth
aors=byo-sip-trunk

[byo-sip-trunk-auth]
type=auth
auth_type=userpass
username=your_outbound_username
password=your_outbound_password

[byo-sip-trunk]
type=aor
qualify_frequency=60
contact=sip:sip.vapi.ai:5060
### API Configuration You might also want to verify your trunk configuration in VAPI matches this format:
Copy code
json
{
  "provider": "byo-sip-trunk",
  "name": "BYOC Trunk",
  "credentials": {
    "username": "YourUsername",
    "password": "YourPassword"
  },
  "gateways": [
    {
      "ip": "YourStaticIP",
      "port": "YourStaticPort",
      "netmask": 32,
      "inboundEnabled": true,
      "outboundEnabled": true,
      "outboundProtocol": "udp"
    }
  ]
}
### Additional Troubleshooting
- Check if your Asterisk server is correctly responding to authentication challenges with the proper
Authorization
header [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1334238882660618250) - Verify network settings, including firewall configurations and SIP ALG, which could interfere with SIP messages [source](https://discord.com/channels/1211482211119796234/1211483291191083018/1334919245468799007) Let me know if any of these suggestions help or if you need further assistance! Sources: - [Discord Channel Authentication Issues](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1333747605628391434) - [Discord Channel Error Handling](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334238882660618250) - [Discord Channel Network Configuration](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334919245468799007) - [Discord Channel Authentication Plan](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341469652366266408)
k
The 403 Forbidden error occurs when the authentication credentials or parameters you're using in your Asterisk configuration don't match what the VAPI SIP trunk is expecting. To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
s
Wss this resolved? May i have working pjsip or sip file?
k
This ticket has been marked as solved, and as a result, you will no longer receive any further responses. Kindly create a new support ticket to escalate your inquiry. 
5 Views