SIP calls with variables
# support
j
Has anyone had success passing variables through a sip call? I’m running into an issue with SIP headers not appearing as variables. I’ve gone through the full setup process, including registering my SIP trunk with Twilio. Everything appears to be working on the Twilio side. I’m using a TwiML Bin like this as a minimal test: sip:my-assistant@sip.vapi.ai?X-testVar=helloWorld&X-customerName=TestCustomer In Wireshark, I confirmed that Twilio is sending the SIP INVITE to sip.vapi.ai with: X-testVar: helloWorld X-customerName: TestCustomer My assistant’s first message is including them. I've tried variations with and without hyphens. I've also tried with other assistants. Nothing appears in the call transcript or in the Vapi mesage logs. I’ve tested: -With X-customerName (camelCase) and X-customer-name (hyphenated) -Calling via TwiML Bin using -Verified via .pcap that headers are definitely in the SIP INVITE -Registered and configured my Twilio SIP trunk to allow calls to Vapi Is there a known issue with parsing SIP headers in flows? Or is there a specific naming convention or limitation I should be aware of?
c
Hey jonjon, I wanted to let you know that we're managing a high volume of support requests at the moment, so our response time might be a bit slower than usual. I truly appreciate your understanding and will get back to you as soon as possible!  Thanks again for your patience!
Include
X-
headers in your
<Dial><Sip>
URL, reference them in your assistant’s
firstMessage
using
{{variableName}}
, and ensure Twilio isn't stripping headers..
k
did you solve the issue? was you able to pass a variable through SIP header?
c
If you are encountering issues with
X-
headers, let us know
k
hi, i am not able to store and send one x- header
REOPEN, can you share whit me how to get the x- headers in the assistant?
c
Hi jonjon, Yes, you can pass custom values through headers. What you put in the configuration gets turned into literal HTTP headers on the outgoing request. For example:
Copy code
{
  "headers": {
    "X-Tenant-Id": "acme-corp",
    "X-Env": "production"
  }
}
Results in Vapi sending:
Copy code
POST /vapi/webhook HTTP/1.1
Host: your-server.com
Content-Type: application/json
X-Tenant-Id: acme-corp
X-Env: production
If you’re updating an existing assistant, you can add headers using a PATCH request:
Copy code
curl -X PATCH https://api.vapi.ai/assistant/ASSISTANT_ID \
  -H "Authorization: Bearer YOUR_VAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "server": {
      "url": "https://your-server.com/vapi/webhook",
      "headers": {
        "X-Tenant-Id": "acme-corp"
      }
    }
  }'
If you’re specifically trying to access SIP
X-
headers received from your SIP provider inside the assistant, could you share an example of the header you’re sending and where you’re expecting to access it? That will help us determine whether the header is being passed through the SIP ingress path correctly or if additional configuration is needed. Best, Vapi Support
k
perfect, this is for outgoing calls from Vapi, but, i want to recieve that header it in the incoming call and use it in the assistan variables
i can see the values in that section of the log, how can i get UCID to be used in the asistant or any other value that can come in that variables? https://cdn.discordapp.com/attachments/1394734088274968655/1512412574409425007/image.png?ex=6a23ff79&is=6a22adf9&hm=4d26d5fa0a5c2208d13fc1d91dfff47c94d97ad7bb314bb729802ec351b21a47&
c
If you can see the value in
variableValues
in the logs, the main thing is to reference the key exactly as it appears there, including the same casing. A couple things to keep in mind: • LiquidJS is case-sensitive. • If the key contains hyphens, you can’t use normal dot syntax. Examples:
Copy code
{{ accountId }}
For keys with hyphens:
Copy code
{{ variableValues["X-Account-Id"] }}
Using
{{ X-Account-Id }}
won’t work because Liquid interprets that as subtraction. I’d also recommend using a fallback so missing headers don’t resolve to an empty string:
Copy code
Greet {{ callerName | default: "the caller" }} and pull up account {{ accountId }}.
k
Hello, I’ve tried lots of combinations; could you please check this call ID: 019ea6fa-2de9-7ff4-a6f1-b9fd6091cda5
c
i see UCID in the assistantOverride.variableValues, so now all you need to put in the assistant prompt is this:
Copy code
//your assistant prompt up here
UCID: {{ucid}}
k
ok, many thanks
we finally get the correct value in the api call, was all prompt configuration
c
great! i will close this ticket now
4 Views