Caller ID lost on SIP forwarding – incorrect SIP h...
# support
g
Hello Vapi Team, we are currently facing an issue with the caller ID (ANI) on inbound calls that are forwarded from a customer PBX via a SIP trunk to Twilio and then handled by a Vapi voice agent. Technical context: The upstream PBX sends the caller information in a fully RFC-compliant way. The SIP signaling contains:
Copy code
From: "49XXXXXXXX40" <sip:49XXXXXXXX40@provider.example>
This corresponds to: * CallerID (number):
49XXXXXXXX40
* CallerID (name):
<sip:49XXXXXXXX40@provider.example>
In addition, the PBX also sends a P-Asserted-Identity header. This header contains only the PBX trunk number and is intended for network authentication purposes only. It must not be used as the caller ID. Observed behavior: Inside the Vapi agent, the incoming calls appear with the PBX trunk number, not with the real caller’s number. This strongly suggests that the
P-Asserted-Identity
header is being used instead of the
From
header (
From.user
). Questions / request: * Which SIP header does Vapi currently use to determine the caller ID? * Is it possible to explicitly configure Vapi to use
From
/
CallerID(num)
? * If Twilio provides multiple identity headers, which one is mapped by default in Vapi? The upstream PBX is confirmed to be working correctly and provides the real caller number in the SIP
From:
header. Thank you for your support. Best regards Gerald
c
Hi, Vapi takes the caller details from the
From
header in SIP calls. However if you configured Twillio using the Twillio integration, we receive the call details using twillio's webhook. So in that case, we will not have any control over what identity is provided. If you used direct Twillio integration with Vapi, you need to configure on the Twillio side to send the correct caller ID
g
Here the answer from twilio: Hi, I am Wei Cheng, from Twilio Voice Support. Thank you for reaching out and providing detailed information about your SIP trunk caller ID issue. I understand how important it is for you to preserve the original caller’s number on inbound calls, and I’m here to help clarify and resolve this. To address your questions: 1. By default, Twilio uses theP-Asserted-Identity (PAI) header for caller ID on inbound SIP trunk calls if it is present. If the PAI header is not present, Twilio will use the From header. 2. Twilio will check bothFrom andP-Asserted-Identity header to confirm that the number used is a Twilio number or a verified caller ID. If it is none of the two, the call will be rejected. 3. I do understand that you are usingPAI to pass information of your PBX trunk number, but from a SIP standard point of view this is not what the PAI header is designed to be used for. Text below extracted from https://www.twilio.com/docs/glossary/sip-invites#p-asserted-identity-header · The P-Asserted-Identity header contains the Caller ID information for the call that was authenticated in some way. This header may be used when forwarding calls within trusted domains, in order to maintain the original caller's caller ID rather than the forwarding entity's. Can Twilio be configured to explicitly use From.user (CallerID(num))? This cannot be done.
Is there a recommended SIP trunk configuration to ensure that the original caller number is preserved? The only way in which you can preserve the original caller number would be to use SIP REFER when doing call transfer/forward. This however would only work if the initial call was from Twilio to your PBX. More detail on this can be found here https://www.twilio.com/docs/sip-trunking/call-transfer · In the call scenario where the initial call to your PBX did no pass through Twilio but you want to forward/transfer the subsequent call leg via Twilio, the original caller ID would not be able to be preserved. Let me know if the information provided helped to resolve the issue or if you have any further questions on this, or if there is anything else I can help you with! I’ll move this case to ‘Pending’ while I await your response. If I don’t hear back from you, the case will close. You’ll also receive reminders along the way. Kind regards, | Twilio Support
c
Hi @gerald94, If Twillio uses the PAI header as caller ID, there is little we can do from Vapi side. However, you could try to setup a custom BYO SIP integration from Twillio to Vapi instead of using Twillio integration. This might work, if Twillio directly forwards the SIP traffic from your PBX -> Twillio -> Vapi without any modification. You can check out BYO SIP trunking here: https://docs.vapi.ai/advanced/sip/sip-trunk