Asterisk PJSIP: Provider Caller ID (Latest Versions)
Updated guide for modern Asterisk (PJSIP era): provider caller id with real configs, common mistakes, and troubleshooting steps.
Caller ID configuration is one of the most misunderstood parts of SIP provider integration in Asterisk.
Many deployments assume that setting a caller ID in the dialplan automatically guarantees it will appear on the customer’s phone. In reality, the final caller ID depends on:
- Asterisk dialplan configuration
- SIP headers sent to the provider
- Provider security and anti-spoofing policies
- National telecom regulations
Because of these multiple layers, caller ID problems are extremely common in real production environments.
How Caller ID Travels in an Outbound SIP Call
Understanding the complete signaling path is essential.
- Dialplan sets
CALLERID(num)andCALLERID(name) - Asterisk inserts values into SIP headers such as:
- From
- P-Asserted-Identity (PAI)
- Remote-Party-ID (RPID)
- SIP provider validates whether the caller ID is allowed
- Provider either:
- Passes caller ID to PSTN/mobile network
- Replaces it with an approved DID
- Rejects the call entirely
This explains why caller ID issues are often caused by provider policy, not Asterisk misconfiguration.
Basic Caller ID Configuration in Dialplan
[outbound]
exten => _X.,1,NoOp(Outbound call with caller ID)
same => n,Set(CALLERID(name)=Support)
same => n,Set(CALLERID(num)=1800123456)
same => n,Dial(PJSIP/provider-endpoint/${EXTEN},60)
same => n,Hangup()
This sets the caller ID inside Asterisk, but the provider may still override it.
Provider-Approved Caller ID Requirement
Modern SIP providers enforce strict anti-spoofing rules.
Typical restrictions:
- Only verified DID numbers can be used
- Random mobile numbers are rejected
- CLI must belong to the same account or trunk
If violated, providers usually respond with:
- 403 Forbidden
- 404 Not Found
- Silent caller ID replacement
Setting Caller ID at the PJSIP Endpoint Level
Some providers require caller ID to be defined in the endpoint rather than only in the dialplan.
[provider-endpoint]
type=endpoint
from_user=1800123456
from_domain=sip.provider.com
trust_id_outbound=yes
send_pai=yes
send_rpid=yes
Important options explained:
from_user→ primary CLI sent in SIP From headertrust_id_outbound→ allows dialplan caller ID to passsend_pai / send_rpid→ enables identity headers required by providers
Real-World Caller ID Failure Scenarios
1. Call Rejected with 403 Forbidden
- Cause → CLI not approved by provider
- Fix → use verified DID or configure
from_user
2. Call Connects but Wrong Caller ID Appears
- Cause → provider rewriting CLI
- Fix → request CLI mapping from provider
3. Anonymous or “Unknown” Caller ID
- Cause → missing PAI/RPID headers
- Fix → enable
send_paiandsend_rpid
Debugging Caller ID Problems Step-by-Step
1. Enable SIP Logging
pjsip set logger on
Check outbound INVITE headers:
- From
- P-Asserted-Identity
- Remote-Party-ID
2. Capture Packets with tcpdump
sudo tcpdump -i any -s 0 -w callerid.pcap udp port 5060
Open in Wireshark → verify actual SIP headers sent to provider.
3. Compare Provider Response
- If provider rewrites CLI → policy issue
- If provider rejects → permission issue
Caller ID Rules in Different Countries
Telecom regulations often restrict caller ID spoofing.
- India → strict CLI ownership enforcement
- Europe → STIR/SHAKEN-style verification expanding
- USA → strong anti-spoofing compliance requirements
Always design caller ID logic based on legal telecom compliance, not just technical capability.
Best Practices for Stable Caller ID Delivery
- Use provider-verified DID numbers only
- Configure caller ID at both dialplan and endpoint levels
- Enable PAI/RPID headers when required
- Document provider CLI policies clearly
- Verify using SIP logs and packet capture
Key Takeaway
Caller ID is not controlled by Asterisk alone. It is a cooperation between:
- Dialplan configuration
- PJSIP endpoint headers
- Provider authorization rules
- Telecom regulations
When these layers are aligned, outbound calls display the correct identity reliably. When they are not, failures are inevitable.
Want to see API-driven CRM + Telecom workflows in action? Try the WhatsApp bot or explore the demos.