Outbound Caller ID override overwrites P-Asserted-Identity and Remote-Party-ID (need to preserve original caller number independently)

Formsdirect

Customer
Joined
Mar 18, 2021
Messages
15
Reaction score
3
We're running 3CX V20 (build 20.0.9.995) with a SIP trunk to Twilio, and have a specific SIP header behavior question backed by packet captures.

Use case: A customer calls our PBX, and the call is forwarded from a Call Queue to an external number (an AI voice agent) via our Twilio trunk. Twilio requires the From header's Caller ID to be a verified/owned number, so we applied an Outbound Caller ID override (configured via the Outbound Rule / trunk's Default Outbound Caller ID) using our verified Twilio number. This successfully resolved a 403 'Caller ID unauthorized' rejection from Twilio.

However, we also need to preserve the ORIGINAL customer's phone number in the P-Asserted-Identity and/or Remote-Party-ID headers, so our downstream AI agent platform can identify the caller for a CRM lookup - independent of what From carries.

What we're observing (confirmed via pcap):

BEFORE the Caller ID override was applied:
- From: "+1925xxxxxxx" <sip:[email protected]> (customer's real number - rejected by Twilio with 403)
- P-Asserted-Identity: <sip:[email protected]> (correct - customer's real number)
- Remote-Party-ID: <sip:[email protected]> (correct - customer's real number)

AFTER applying the Caller ID override (our verified number, e.g. 1855xxxxxx):
- From: "+1925xxxxxx" <sip:[email protected]> (fixed - call now succeeds)
- P-Asserted-Identity: <sip:1855xxxxxx@...> (customer's number LOST - now shows our verified number instead)
- Remote-Party-ID: <sip:1855xxxxxx@...>;party=calling (customer's number LOST - same issue)

We also tried setting "P-Asserted Identity : Display Name" and "Remote Party ID - Calling Party : Display Name" (on the trunk's Options tab) to the "OriginatorCallerID" option, but this only changed the DISPLAY NAME text to match the existing URI number (e.g. "1855xxxxxxx"<sip:1855xxxxxxx@...>) rather than restoring the customer's actual number in the header.

Our question: Is there a way in 3CX to apply an Outbound Caller ID override that affects ONLY the From header, while independently preserving the original caller's number in P-Asserted-Identity and/or Remote-Party-ID?
 
Solution
Hi @Formsdirect by default Twillio does not support Clip No Screening, meaning that you can only present as caller id the numbers that are with your account.

1789648102548.png


If you check the Twillio default template, these are the outbound parameters:

<!-- Gateway / Provider Outbound Parameters -->
<field name="ParameterOut" custom="" parameter="RequestLineURIUser">$CalledNum</field>
<field name="ParameterOut" custom="" parameter="RequestLineURIHost">$GWHostPort</field>
<field name="ParameterOut" custom="" parameter="ContactUser">$AuthID</field>
<field name="ParameterOut" custom="" parameter="ContactHost">$ContactURI</field>
<field name="ParameterOut" custom="" parameter="ToUserPart">$CalledNum</field>...
Hi @Formsdirect by default Twillio does not support Clip No Screening, meaning that you can only present as caller id the numbers that are with your account.

1789648102548.png


If you check the Twillio default template, these are the outbound parameters:

<!-- Gateway / Provider Outbound Parameters -->
<field name="ParameterOut" custom="" parameter="RequestLineURIUser">$CalledNum</field>
<field name="ParameterOut" custom="" parameter="RequestLineURIHost">$GWHostPort</field>
<field name="ParameterOut" custom="" parameter="ContactUser">$AuthID</field>
<field name="ParameterOut" custom="" parameter="ContactHost">$ContactURI</field>
<field name="ParameterOut" custom="" parameter="ToUserPart">$CalledNum</field>
<field name="ParameterOut" custom="" parameter="ToHostPart">$GWHostPort</field>
<field name="ParameterOut" custom="" parameter="FromDisplayName">$CustomField</field>
<field name="ParameterOut" custom="" parameter="FromUserPart">$OutboundCallerId</field>
<field name="ParameterOut" custom="" parameter="FromHostPart">$GWHostPort</field>
<field name="ParameterOut" custom="" parameter="RemotePartyIDCallingPartyUserPart">$OutboundCallerId</field>
<field name="ParameterOut" custom="" parameter="RemotePartyIDCallingPartyHostPart">$GWHostPort</field>
<field name="ParameterOut" custom="" parameter="P-AssertedIdentityUserPart">$OutboundCallerId</field>
<field name="ParameterOut" custom="" parameter="P-AssertedIdentityHostPart">$GWHostPort</field>

The FromUserPart uses OutboundCallerId so according to this document it explains the following:

During an outbound call the PBX will check for an Outbound Caller ID in four different locations with descending priority. The highest priority is the "Outbound Caller ID" field that can be set in the Outbound Rules.

Location: Outbound Rules → Select the Outbound Rule → Make outbound calls on

1789648350127.png

If that is empty, then the Outbound Caller ID is taken from the Extension settings.

Location: Users → Select Extension → General (tab) → Outbound Caller ID.

1789648350132.png

If this field is empty, then 3CX will check the SIP Trunk settings → “Options” tab → “Caller ID Control”“Default Outbound Caller ID” field.

If this field is also empty, the 3CX will use the Main Trunk Number that is configured in the “General” tab of the SIP Trunk settings.


So, if you want to send the original caller id using the SIP Fields P-AssertedIdentityUserPart and RemotePartyIDCallingPartyUserPart then make sure that those use the parameter OriginatorCallerID as follows:

<field name="ParameterOut" custom="" parameter="RemotePartyIDCallingPartyUserPart">$OriginatorCallerID</field>
<field name="ParameterOut" custom="" parameter="RemotePartyIDCallingPartyHostPart">$GWHostPort</field>
<field name="ParameterOut" custom="" parameter="P-AssertedIdentityUserPart">$OriginatorCallerID</field>
<field name="ParameterOut" custom="" parameter="P-AssertedIdentityHostPart">$GWHostPort</field>

So go to the advanced menu --- templates --- voip providers templates ---- make a copy of the Twillio Template and edit those outboundparameters as mentioned above.

Once done, go to the Voice and Chat menu, select your trunk and replace the template with the custom one.

Have a good day!
 
  • Like
Reactions: YiannisH_3CX
Solution
Additionally to my colleague mentioned if you populate the Outbound Rules → Select the Outbound Rule →Outbound Caller ID then that will override the originator caller id setting in the template.
If you want to always send your main trunk number in the From header and the customers originating number in the PAI header then follow what Alejandro said but keep the From header using the OutboundCallerID or try this in the From header:
<field name="ParameterOut" custom="" parameter="FromUserPart">$LineNumber</field>
This will force the trunk to always send its main trunk number in the from header.
 
  • Like
Reactions: Alejandro_3CX

Forum statistics

Threads
112,084
Messages
590,674
Members
165,044
Latest member
WAPU