ASAPP’s Call Transfer over PSTN enables businesses to integrate GenerativeAgent Voice without being constrained by their existing telephony infrastructure.

We have dedicated connector integrations for some platforms (Genesys, Amazon Connect), but not every platform allows native integrations. Call transfers allow you to use PSTN (dialing a number) to connect your users to GenerativeAgent while keeping you in control of the call the entire time.

How it works

At a high level, call transfer over PSTN works by assigning a temporary phone number for a given customer that you can dial in for GenerativeAgent:

  1. Request a number: Your system requests a temporary phone number from ASAPP. Optionally you can provide context to the call.
  2. GenerativeAgent handles the conversation: Dial in GenerativeAgent via the temporary phone number so it can talk directly to the customer.
  3. Return control: When GenerativeAgent has completed the call, it will disconnect the call and your system will fetch the resulting context and handle the rest of the call flow.

Before you Begin

Before implementing PSTN Call Transfer, 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 call transfer over PSTN
    • This includes determining how many concurrent calls you need to support, phone number countries to support, etc.

Step 1: Request a temporary number

To transfer a call to GenerativeAgent, you need to create a call-transfer. A call transfer is the attempt to transfer a call to GenerativeAgent. This resource will include a temporary phone number from ASAPP that you can connect the customer to. This number will be assigned specifically for this customer interaction and will expire after a set time period, by default 1 minute.

To create a call transfer, you need to specify:

ParameterDescription
idYour unique identifier for the call transfer. You will use this later to fetch the call transfer result.
externalConversationIdYour unique identifier for the conversation. This allows you to reconnect the customer to the same conversation and is used in reporting.
typeSpecify a type of PHONE_NUMBER.
phoneNumber.countryThe country code for the phone number.
inputContextOptionally specify the taskName and inputVariables to trigger GenerativeAgent with specific task information and variables.
curl --location 'https://api.sandbox.asapp.com/generativeagent/v1/call-transfers' \
--header 'asapp-api-id: <API KEY ID>' \
--header 'asapp-api-secret: <API TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
    "id":"[Your Transfer Id]",
    "externalConversationId":"[Your Conversation Id]",
    "type": "PHONE_NUMBER",
    "phoneNumber":{
        "country": "US"
    },
    "inputContext": {
        "taskName":"call_routing",
        "inputVariables":{
            "accountNumber":"3434",
            "name": "John Doe"
        }
    }
}'

A successful request returns 200 with the call transfer data:

{
    "id": "[Your Transfer Id]",
    "externalConversationId": "[Your Conversation Id]",
    "status": "ACTIVE",
    "type": "PHONE_NUMBER",
    "inputContext": {
        "taskName": "AsappDemo",
        "inputVariables": {
            "accountNumber": "3434",
            "name": "sample_name"
        }
    },
    "phoneNumber": {
        "transferNumber": "+19991234",
        "country": "US",
        "expireAt": "2025-06-19T13:39:40Z"
    }
}

Save the phoneNumber.transferNumber; you will need to transfer to it before the phoneNumber.expireAt time. This is 1 minute by default.

Step 2: Make a supervised transfer

Perform a supervised transfer to the phoneNumber.transferNumber in the call transfer resource. Once you dial the number, GenerativeAgent is given the input context, if provided, and talks to the customer.

Once connected or expired, the number will be released and can be used by a subsequent call transfer.

The specific implementation on how to perform a supervised transfer depends on your call center system, but you must maintain call control throughout the transfer.

With the supervised transfer, your system is on the call the entire time. You can monitor the call and control the call flow while GenerativeAgent is talking to the user.

Step 3: Detect disconnect

With the supervised transfer, your system will be monitoring the call and two scenarios are possible during the conversation that you must handle accordingly:

  1. 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 disconnects from the call and the output context of the conversation can be retrieved; this is covered in the next step.
  2. Customer hangs up the phone call

    • When the customer hangs up, there are no output variables since GenerativeAgent didn’t close out the conversation.

The disconnect detection is crucial for maintaining proper call flow control and ensuring you can fetch the conversation context before handling the next steps.

Step 4: Fetch the call context

Once you detect the disconnect, you need to retrieve the call transfer result and resulting outputContext.

To retrieve the call transfer result, you need to fetch the call-transfers with the id of the original call transfer:

curl --location 'https://api.sandbox.asapp.com/generativeagent/v1/call-transfers/[Your Transfer Id]' \
--header 'asapp-api-id: <API KEY ID>' \
--header 'asapp-api-secret: <API TOKEN>'

A successful request returns 200 with call transfer data:

{
    "id": "[Your Transfer Id]",
    "externalConversationId": "[Your Conversation Id]",
    "status": "COMPLETED",
    "createdAt": "2025-06-19T13:38:40Z",
    "callReceivedAt": "2025-06-19T13:38:45Z",
    "completedAt": "2025-06-19T13:39:12Z",
    "inputContext": {
        "taskName": "AsappDemo",
        "inputVariables": {
            "accountNumber": "3434",
            "name": "sample_name"
        }
    },
    "type": "PHONE_NUMBER",
    "outputContext": {
        "transferType": "SYSTEM",
        "currentTaskName": "currentTaskName",
        "referenceVariables": {
            "reference_variable_1": "4343"
        },
        "transferVariables": {
            "transfer_variable_": "4343"
        }
    },
    "phoneNumber": {
        "transferNumber": "+19991234",
        "country": "US",
        "expireAt": "2025-06-19T13:39:40Z"
    }
}

Extract the key information:

  • Status: Indicates if the call was completed successfully.

  • outputContext: Contains the conversation results and any transfer variables

    • transferType: Indicates the type of transfer that occurred. This can be either AGENT or SYSTEM.
    • referenceVariables: Context information about the customer and conversation
    • transferVariables: Data that should be passed to the next system or agent

With this information, handle the call according to your own business logic, such as routing the call to an agent or handling call disposition.

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 same externalConversationId to reconnect the customer to the same conversation. GenerativeAgent will resume the conversation where it left off.

curl --location 'https://api.sandbox.asapp.com/generativeagent/v1/call-transfers' \
--header 'asapp-api-id: <API KEY ID>' \
--header 'asapp-api-secret: <API TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
    "id":"[Your New Transfer Id for this transfer attempt]",
    "externalConversationId":"[Your Original Conversation Id from the first conversation leg]",
    "type": "PHONE_NUMBER",
    "phoneNumber":{
        "country": "US"
    }
}'

Next Steps

Now that you have successfully implemented PSTN Call Transfer with GenerativeAgent, here are some important next steps to consider: