API voice call with SIP Identity and Privacy headers
Back to Articles
Tutorial VoIP SIP API Reference Howto

API voice call with SIP Identity and Privacy headers

May 23, 2018 2 min
Aivis Olsteins

Aivis Olsteins

When sending voice calls over SIP trunks, it is frequently needed to set specific SIP headers in order to comply with requirements of upstream carriers or pass additional information within call. It can be done when sending SIP calls via API.

One of the most popular case is setting SIP Privacy headers to comply with many European carriers requirements. The purpose of SIP Privacy headers are:

  1. to identify the origin of the call “out of band”. i. e. outside of parameters available to end users, and
  2. pass requested privacy setting to the upstream carrier, while preserving the information about caller for identification and subsequent rating and routing purposes.

 

The above two points are usually interconnected: most carriers now require both settings to be set in SIP message. The first header, asserting the identity of the caller is P-Asserted-Identity and has format as in this example:

 

P-Asserted-Identity tel:+3312345678

 

Note, that phone number is prefixed by tel: string and comes in full E.164 format including plus symbol. This field is usually used to determine the origin country/area of the call and therefore used to make decision how the call should be rated and routed. In countries and carriers which since last year make distinction between calls originated within or outside of EU/EEA, this is the determining field. Absence of this field might cause call to be rated most highest rate (sometimes unreasonably high – so beware) or rejected outright.

 

The other usually required attribute tells carrier whether callers wishes to display it's identity to called party or not. The SIP header name is “Privacy” and example usage is:

 

Privacy: Id

 

The example above shows that downstream carrier should use From SIP header to present as the caller ID to the called party.

 

Now, let's compose the API call with above headers:

 

POST /voice/call/play


{
"to": "123456",
"from": "112233",
"playlist":
[
{
"play": "http://server.domain.com/voices/hello.wav"
},
{
"play": "http://server.domain.com/voices/main-message.wav"
},
{
"play": "http://server.domain.com/voices/goodbye-thanks.wav"
}
]
"carrier_id" : "74445609",
"osip_P-Asserted-Identity" : "tel:+3312345678",
"osip_Privacy" : "Id"
}

So the above example tells upstream carrier that the real caller identity is +3312345678, but the caller should see on their display 112233 as the caller ID. The call is now compliant with carriers requirement and will be properly rated and routed as originated from within EU/EEA country (+33 France prefix).

Note, that custom SIP headers are prefixed by osip_ string and then follow exactly as typed.

Share this article

Aivis Olsteins

Aivis Olsteins

An experienced telecommunications professional with expertise in network architecture, cloud communications, and emerging technologies. Passionate about helping businesses leverage modern telecom solutions to drive growth and innovation.

Related Articles

The Commitment Economy: Why Voice AI Bookings Must Be Integrated, Not Just Conversational

The Commitment Economy: Why Voice AI Bookings Must Be Integrated, Not Just Conversational

AI can promise a booking, but what about the broken promise? Learn why systemic integration, Accuracy Rate, and System Sync define the real test of Voice AI reliability

Read Article
Beyond the Dial Tone: 3 Metrics That Define Outbound AI Success

Beyond the Dial Tone: 3 Metrics That Define Outbound AI Success

Outbound AI requires a new scorecard. Learn the 3 metrics (Connection Rate, Engagement Quality, and Conversion Impact) that measure pipeline movement, not just call volume

Read Article
The New AI Scorecard: How to Measure Campaign Effectiveness Beyond "Call Volume"

The New AI Scorecard: How to Measure Campaign Effectiveness Beyond "Call Volume"

Stop guessing with 'Call Volume'. Discover the 3-Layer Framework for measuring Voice AI success: Goal Completion Rate (GCR), Sentiment Drift, and Knowledge Retrieval. Turn phone calls into structured marketing data

Read Article
What Happens to Metrics When "Hold Time" Hits Zero?

What Happens to Metrics When "Hold Time" Hits Zero?

Does Voice AI just save money? No. Discover the "CSAT Paradox" and how zero hold time improves revenue, lead capture, and team morale simultaneously.

Read Article

SUBSCRIBE TO OUR NEWSLETTER

Stay up to date with the latest news and updates from our telecom experts