Read P-Asserted-Identity and Diversion from inbound SIP trunk calls as prompt variables, and send your own SIP headers on outbound calls and transfers.
SIP headers carry information alongside a call. On a SIP trunk you can read two carrier headers on inbound calls, and send headers of your own on outbound calls and on transfers.
Direction
What you can do
Where it is set
Inbound
Read P-Asserted-Identity and Diversion into prompt variables
Agent, sip_header_variables
Outbound
Send your own headers on every call the agent places
Agent, sip_headers
Transfer
Send your own headers on the call to the transfer target
Bolna passes two headers from your carrier’s INVITE to the agent: P-Asserted-Identity and Diversion. Other headers on the INVITE do not reach the agent. To use either one, map it to a variable name on the agent; the variable then appears in recipient_data and in the prompt as {variable_name}.The variable holds the header’s value exactly as your carrier sent it, display name and parameters included, for example "Asha" <sip:+919876543210@203.0.113.10>. If the INVITE carries the same header more than once, the first one is used. A header that is not on a call leaves its variable empty; the call still goes ahead.
1
Open the agent's inbound settings
Open the agent, go to the Calling tab and set Telephony Provider to SIP Trunk. The SIP Header Variables section appears under Inbound Calling.
2
Map the headers
Click Add header. Enter the header name on the left, exactly P-Asserted-Identity or Diversion, and the variable name on the right, for example caller_identity. Header names are case-sensitive. Any other header name shows a warning, because a SIP trunk never passes it to the agent.
Mapping P-Asserted-Identity to a variable
3
Use the variable
Reference it in the prompt or welcome message, for example The network reports the caller as {caller_identity}.
The Ingest lookup key below the mappings can pick one of these headers to look the caller up in your caller data instead of from_number. The lookup uses the header’s full value, so your data source has to store it in the same form.
Headers you set on the agent go on every INVITE the agent places through a trunk: single calls, batches and workflow calls. Each value is a template, and %(name)s in it is replaced with that call’s variable, typically from the user_data you pass when placing the call.
A call with "user_data": {"account_id": "48219"} sends X-Account-Id: 48219 and X-Campaign: renewals-q4. A header whose value comes out empty, because the call has no such variable, is left off that call.
1
Open the agent's tools
Save the agent with Telephony Provider set to SIP Trunk, then open its Tools tab. SIP headers on outbound calls is at the bottom of the Function Tools for LLM Models card.
2
Add headers
Click Add header, enter the name and the value, and click Save headers.
Outbound SIP headers on the Tools tab
A call uses the headers saved on the agent version it runs on.
These apply to outbound and transfer headers on SIP trunk agents. Bolna refuses to save a header whose name or template breaks them. A value that breaks them only once a variable is filled in, for example by running past 120 characters, is left off that call.
Rule
Detail
Name
Letters, digits and dashes, up to 64 characters. Each name once, ignoring case.
Value
Up to 120 characters after substitution. No quotes, pipes, curly braces, backslashes or control characters.
Reserved for Bolna
Any name starting with X-Bolna-, plus X-Client-Call-Id and X-Trunk
When an agent on a SIP trunk transfers a call, the call to the transfer target carries the headers set on that transfer tool, not the agent’s outbound headers. Values use the same %(name)s templates and the same rules. On an inbound call, the variables include your mapped header variables and any caller data, so you can forward what the carrier told you about the caller.In the dashboard, the Transfer Call tool shows Custom SIP headers when the destination is SIP trunk (URI). Through the API, a transfer tool’s sip_headers apply whichever destination type it uses.
A header that breaks a rule is refused with 400, for example reserved header X-Trunk.A transfer tool carries its headers in its param, next to the destination: