Create Voice Call Context
Allocates a server-minted contextID handle for a voice call transfer to Agentforce Voice.
Use this API to obtain a contextID handle before performing a SIP-address transfer of the PSTN call to Salesforce. The partner telephony system calls this API to reserve the context, then places the returned contextID in a SIP X-header on the outbound SIP-address transfer leg. Salesforce’s SIP relay looks up the stored call context by this contextID at ringing time and hands the call off to Agentforce Voice with the correct session context. The returned contextID is valid for a limited time and can’t be supplied by the client—the value is always server-minted. This API is available only to organizations provisioned for Agentforce Voice with the contextID transfer mode enabled.
https://{MyDomain}.my.salesforce-scrt.com/telephony/v1/voiceCalls/createVoiceCallContext
Where {MyDomain} is a value configured as part of Salesforce setup.
POST
- Authorization: Bearer <token>
String. Standard header. The authorization token, where <token> is the JSON Web Token (JWT). Required.
- Content-Type: <format>
String. Standard header. The format of the request body. Valid formats include JSON and XML. For example,
application/jsonorapplication/xml. Required.- Telephony-Provider-Name: <telephony provider name>
String. Custom header. The name of the telephony provider that calls this API. For example,
Amazon Connect.
The request body is CreateVoiceCallContextRequest.
| Property Name | Type | Description | Required |
|---|---|---|---|
fromNumber | string | The caller’s phone number in E.164 format. For example, +14155551234. This number is used for validation during call lookup. | Yes |
countryCode | string | ISO 3166-1 alpha-2 country code of the destination. For example, US. | Yes |
context | object | The voice-call context (VoiceCallContext) associated with this reservation. See context (VoiceCallContext). | Yes |
| Property Name | Type | Description | Required |
|---|---|---|---|
scrt2Domain | string | The SCRT2 domain URL for the Salesforce organization. For example, https://example.my.salesforce-scrt.com. | Yes |
toNumber | string | The virtual phone number in E.164 format that you configure in Salesforce. | Yes |
callId | string | The ID of the initial voice call record (VC1) that’s created when the inbound call to the partner contact center. If omitted, context chaining with the parent voice call doesn’t happen. | No |
partnerCallId | string | Vendor call key or UUID for the originating call leg. Reserved for phase 2. | No |
transactionId | string | A UUID that uniquely identifies this createVoiceCallContext request. If provided, Salesforce uses this value to support idempotent retry behavior. If the partner contact center retries the request due to a timeout or transient error, passing the same transactionId ensures that a duplicate contextID lease isn’t created. | No |
The contextID can’t be supplied by the client. The server always mints a new UUIDv4 and returns it in the response.
The response body is CreateVoiceCallContextResponse.
| Property Name | Type | Description |
|---|---|---|
status | string | Outcome of the context reservation. One of success or failure. |
mode | string | Mode of the reserved handle. Always contextID for this endpoint. |
handle | object | The reserved handle (VoiceCallContextHandle). See handle (VoiceCallContextHandle). |
| Property Name | Type | Description |
|---|---|---|
contextID | string | Server-minted UUIDv4 context identifier. Place this value in the SIP X-header on the SIP-address transfer leg. |
expiresAt | string | ISO-8601 timestamp at which the lease expires. |
Request:
Response: