How it works
At a high level, API-based SIP transfers work by:- Request a SIP URI: Your system requests a destination SIP URI from ASAPP via API call. You can provide complex context to the call.
- GenerativeAgent handles the conversation: Transfer the call to GenerativeAgent via the SIP URI so it can talk directly to the customer.
- Return control: When GenerativeAgent has completed the call, it will transfer the call back to your specified return URI and your system will fetch the resulting context and handle the rest of the call flow.
Detailed Flow
Detailed Flow

- Incoming Call: A customer calls your existing phone number
- IVR Processing: Your existing IVR system processes the call and determines when to transfer to GenerativeAgent
- Request a SIP URI: Your system requests a destination SIP URI from ASAPP via API call. You can provide complex context to the call.
- Transfer the call: Your system transfers the call to the destination SIP URI via SIP protocol.
- Detect call completion: When GenerativeAgent has completed the call, it will transfer the call back to your return URI.
- Fetch the call context: Your system will fetch the context, which includes the transfer type, from the call via API call.
- Handle the call: Using the context and transfer type, your system handles the agent escalation, call disposition, or any other steps in your call flow.
Before you Begin
Before implementing API-based SIP Transfers, you need:- Get your API Key Id and Secret
- Ensure your API key has been configured to access GenerativeAgent APIs. Reach out to your ASAPP team if you need access enabled.
- Configure Tasks and Functions
- Contact your ASAPP account team to enable SIP transfers
- This includes determining how many concurrent calls you need to support, SIP infrastructure requirements, etc.
- Configure SIP server authentication: ASAPP requires authentication for all incoming SIP requests to ensure security. You must provide one or both of the following authentication methods:
- IP whitelist: The IP address(es) of your SIP server(s) that ASAPP will allow to make SIP requests
- Username and password: SIP authentication credentials that ASAPP will use to validate your SIP requests
Security requirement: ASAPP cannot accept unauthenticated SIP requests. You must provide at least one authentication method (IP whitelist and/or username/password) during setup. - Get your SIP URI for transfers: Obtain the static SIP URI from ASAPP that you’ll use to route calls to GenerativeAgent
- Configure transfer settings: Set up your default transfer type and authentication credentials (for INVITE transfers) with your ASAPP account team
Transfer Types
Your transfer type is configured as part of your static setup with ASAPP. Choose the appropriate transfer type based on your call flow needs:Transfer Type | Behavior | Use Case |
---|---|---|
BYE | GenerativeAgent disconnects when done | Your system handles the disconnect (lower cost) |
REFER | Standard blind transfer - sends REFER message to your return URI | Transfer to another system after ASAPP completes (higher cost) |
INVITE | Keeps ASAPP in call flow for continued transcription | Provide end-to-end conversation understanding for GenerativeAgent (higher cost) |
Cost Implications: REFER and INVITE transfer types have higher cost implications that need to be aligned with your sales team before implementation. Contact your ASAPP representative to discuss pricing for these transfer types.
For INVITE transfers, you can provide authentication credentials (username/password) as part of your static configuration with ASAPP.
Step 1: Create a call transfer
To transfer a call to GenerativeAgent, you need to create acall-transfer
. A call transfer is the attempt to transfer a call to GenerativeAgent. This resource will include context and configuration for the transfer, but you’ll route the call to the static SIP URI provided by ASAPP.
To create a call transfer, you need to specify:
Parameter | Description |
---|---|
id | Your unique identifier for the call transfer. You will use this later to fetch the call transfer result. |
externalConversationId | Your unique identifier for the conversation. This allows you to reconnect the customer to the same conversation and is used in reporting. |
type | Specify a type of SIP. |
sip.returnURI | Only used for REFER and INVITE transfer types. The SIP URI to transfer the call back to when the conversation ends. You can include any parameters in the URI (e.g., User-to-User headers, custom parameters) and ASAPP will send the URI back exactly as provided. Maximum length: 1024 characters. |
inputContext | Optionally specify the taskName and inputVariables to trigger GenerativeAgent with specific task information and variables. |
id
from the response; you will need it to pass as the X-ASAPP-CallTransferId
header when transferring the call and to query the call transfer result in Step 3.
Step 2: Transfer the call and handle the response
Once you’ve created the call transfer, you need to route the call to GenerativeAgent and handle the return transfer when the conversation ends.1
Send the call to ASAPP
Transfer the call to the static SIP URI provided by ASAPP during setup. Include the call transfer Once you transfer the call, GenerativeAgent is given the input context, if provided, and talks to the customer.The specific implementation on how to perform a SIP transfer depends on your call center system.
id
as the X-ASAPP-CallTransferId
header in your SIP transfer.Authentication required: ASAPP will authenticate your SIP request using the IP whitelist and/or username/password credentials you provided during setup. Your SIP request must pass authentication or it will be rejected.
With SIP transfers, the customer is calling into your phone number so your SBC/PBX is handling the inbound call. Your system maintains visibility and ultimate ownership of the call the entire time.
2
Handle the return transfer and detect call completion
Two scenarios are possible during the conversation that you must handle accordingly:
-
GenerativeAgent completes the conversation with an agent escalation or a system transfer
- GenerativeAgent has determined it needs to return the call to your system, either to an agent escalation or a system transfer.
- GenerativeAgent handles the call return based on your transfer type:
- BYE Transfer: GenerativeAgent disconnects the call. Your system needs to detect the disconnect and proceed to fetch the call context.
- REFER Transfer: GenerativeAgent sends a SIP REFER message to your return URI. Your system should accept and handle the REFER, and then fetch the call context.
- INVITE Transfer: GenerativeAgent sends a SIP INVITE to your return URI. Your system should accept the INVITE and then fetch the call context. ASAPP will continue to transcribe the call until the call is ended.
- The output context of the conversation can be retrieved.
-
Customer hangs up the phone call
- When the customer hangs up, there are no output variables since GenerativeAgent didn’t close out the conversation.
- No transfer is performed and no output context will be available for fetching.
The call completion detection is crucial for maintaining proper call flow control and ensuring you can fetch the conversation context before handling the next steps.
Step 3: Fetch the call context
After handling the return transfer in Step 2, retrieve the call transfer result and outputContext to understand what happened during the conversation.Only fetch call context when GenerativeAgent handed back the call: You can only retrieve meaningful output context when GenerativeAgent completed the conversation and transferred the call back to your system. If the customer hung up during the conversation, there will be no output context available for fetching.
call-transfers
with the id
of the original call transfer:
-
Status: Indicates if the call was completed successfully.
Call transfer status
Status Description ACTIVE The call transfer is active and the destination SIP URI is waiting to be connected. ONGOING The call was connected and GenerativeAgent is talking to the customer. COMPLETED The call transfer has completed. EXPIRED The call transfer has expired and the destination SIP URI is no longer valid for that conversation. -
outputContext: Contains the conversation results and any transfer variables
- transferType: Indicates the type of transfer that occurred. This can be either
AGENT
orSYSTEM
. - referenceVariables: Context information about the customer and conversation
- transferVariables: Data that should be passed to the next system or agent
- transferType: Indicates the type of transfer that occurred. This can be either
Handling customer reconnections
There may be scenarios where you want to reconnect a customer directly to where they left off with GenerativeAgent. For example, if the customer hangs up the phone, or after transferring back to your system, you want to transfer them back again to GenerativeAgent. To do this, ensure you use the sameexternalConversationId
to reconnect the customer to the same conversation. GenerativeAgent will resume the conversation where it left off.
Dynamic Transfer Configuration
By default, your transfer type is configured as part of your static setup with ASAPP. However, you can optionally override the transfer type for specific calls by including thesip.returnTransferType
parameter in your call transfer request.
Override Transfer Type
To use a different transfer type for a specific call, include thesip.returnTransferType
parameter:
Parameter | Description |
---|---|
sip.returnTransferType | Override the default transfer type for this specific call (BYE , REFER , or INVITE ). |
sip.returnInviteAuthentication.username | Username for authentication (optional for INVITE transfers). |
sip.returnInviteAuthentication.password | Password for authentication (optional for INVITE transfers). |
When using dynamic transfer configuration:
- The
sip.returnURI
is required for REFER and INVITE transfer types, but not for BYE transfers - For INVITE transfers, you may provide
sip.returnInviteAuthentication.username
andsip.returnInviteAuthentication.password
for authentication
Next Steps
Now that you have successfully implemented API-based SIP Transfers with GenerativeAgent, here are some important next steps to consider:Configuration Overview
Learn how to configure GenerativeAgent’s behaviors, tasks, and communication style
Connect your APIs
Configure your APIs to allow GenerativeAgent to access necessary data and perform actions
Review Knowledge Base
Connect and optimize your knowledge base to improve GenerativeAgent’s responses
Go Live
Follow the deployment checklist to launch GenerativeAgent in your production environment