Third-party large model integration for intelligent outbound calls
Integration solution

API definition
To integrate, follow the four interface conventions below.
Function Compute proxies these APIs, primarily handling signature authentication and forwarding.
On the intelligent outbound bot page, configure the bot by following the process described below.
/proxy/beginSession: Begin session
Description
Starts a session.
Protocol
Server-Sent Events (SSE)
Request parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
UUID
A unique ID for the request.
tenantId
Long
Yes
378210
The tenant ID, which is your Alibaba Cloud UID.
instanceId
String
Yes
n1
The instance ID.
scriptId
String
Yes
The scene ID.
sessionId
String
Yes
UUID
The session ID.
streamId
String
Yes
UUID
The dialog turn ID.
vendorParams
Map
Yes
Passthrough parameters.
callingNumber
String
Yes
The calling number.
calledNumber
String
Yes
The called number.
Other fields
String
No
Customer-defined passthrough fields.
Response parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
1
The unique ID of the original request.
httpStatusCode
Int
Yes
200
The HTTP status code.
code
String
Yes
OK
The business response code. A value of 'OK' indicates success.
message
String
No
The error message that is returned if the request fails.
data
Object
Yes
streamEnd
Boolean
Yes
Indicates whether the stream has ended.
updatedTime
Long
Yes
The time of the last update, in milliseconds.
sessionId
String
No
The session ID.
streamId
String
No
The dialog turn ID.
answer
String
No
The text of the bot's response.
controlParamsList
List<ControlParams>
No
A list of bot speech control parameters.
type
String
Yes
HangUp
The control type.
-
HangUp: Disconnects the call.-
Transfer: Transfers the call.-
GatherDtmf: Collects DTMF input.-
Voice: Plays a voice prompt.
/proxy/dialogue
Description
Manages conversational turns in a dialogue.
Protocol
SSE
Request parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
UUID
The request ID.
tenantId
Long
Yes
231232121
The tenant ID. This is the Alibaba Cloud UID.
instanceId
String
Yes
n1
The instance ID.
scriptId
String
Yes
The script ID.
sessionId
String
Yes
UUID
The session ID.
streamId
String
Yes
UUID
The stream ID.
utterance
String
Yes
Check phone bill
The user's utterance.
extras
List<Map>
Additional data.
dataType
String
DTMF
The data type. Valid values:
DTMForSilence.dtmf
String
1234
The DTMF digits.
Response parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
1
The request ID.
httpStatusCode
Int
Yes
200
The HTTP status code.
code
String
Yes
OK
The response code.
message
String
No
The error message.
data
Object
Yes
streamEnd
Boolean
Yes
Indicates whether the stream has ended.
updatedTime
Long
Yes
The update timestamp.
sessionId
String
No
The session ID.
streamId
String
No
The stream ID.
answer
String
No
The bot response.
controlParamsList
List<ControlParams>
A list of control parameters.
type
String
Yes
HangUp
The control type.
-
HangUp: Disconnects the call.-
Transfer: Transfers the call.-
GatherDtmf: Gathers DTMF input.-
Voice: Plays a voice prompt./proxy/abortDialogue
Description
Aborts the current dialogue turn. This operation returns any text that has already been played and stops all subsequent actions.
Protocol
HTTPS
Request parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
UUID
The request ID.
tenantId
Long
Yes
123232123
The tenant ID. This is the Alibaba Cloud UID.
instanceId
String
Yes
n1
The instance ID.
scriptId
String
No
The script ID.
sessionId
String
Yes
UUID
The session ID.
streamId
String
Yes
UUID
The stream ID.
answer
String
No
The text that was played before the interruption.
type
String
Yes
Canceled
Canceled: The turn is canceled.Interrupted: The bot is interrupted.Response parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
1
The request ID.
httpStatusCode
Int
Yes
200
The HTTP status code.
code
String
Yes
OK
The response code.
message
String
No
The error message.
/proxy/endSession
Description
Ends the session.
Protocol
HTTPS
Request parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
UUID
The request ID.
tenantId
Long
Yes
12321231
The tenant ID. This is the Alibaba Cloud UID.
instanceId
String
Yes
n1
The instance ID.
scriptId
String
Yes
The script ID.
sessionId
String
Yes
UUID
The session ID.
Response parameters
Parameter
Type
Required
Example
Description
requestId
String
Yes
1
The request ID.
httpStatusCode
Int
Yes
200
The HTTP status code.
code
String
Yes
OK
The response code.
message
String
No
The error message.
Common control parameters
HangUpControlParams
Parameter
Type
Required
Example
Description
delay
Int
No
0
The hang-up delay in seconds. The default value is 0.
Constraints: The value must be an integer from 0 to 10.
reason
String
No
The reason for hanging up.
TransferControlParams
Parameter
Type
Required
Example
Description
transferType
String
Yes
SkillGroup
The transfer type.
-
SkillGroup: Transfers to a skill group.-
Agent: Transfers to an agent (currently unsupported).-
External: Transfers to an external number (currently unsupported).transferee
String
Yes
skg-1234*****
The transfer destination.
transferor
String
No
The transferor's phone number, which is required when transferring to an external number.
DtmfControlParams
Parameter
Type
Required
Example
Description
terminator
String
Yes
#
The terminator for DTMF collection.
Constraints: Only the
#character is supported.maxDigits
Int
Yes
The maximum number of digits to collect.
Constraints: The value must be an integer from 1 to 100.
timeout
Int
Yes
The timeout, in seconds, between digit presses.
Constraints: The value must be an integer from 1 to 10. A value of 5 is recommended.
disableVoiceInput
boolean
No
Specifies whether to disable voice input during DTMF collection.
Default value:
true.VoiceControlParams
Parameter
Type
Required
Example
Description
interruptible
Boolean
No
false
Specifies whether the bot's speech can be interrupted. The default value is
false.silenceDetectionTimeout
Int
No
The timeout, in seconds, for detecting user silence. The default value is 5.
Constraints: The value must be an integer from 1 to 10. A value of 5 is recommended.
synthesizerConfig
Object
No
Parameters for controlling the bot's synthesized voice.
The following providers are supported:
Alibaba Cloud small models
Alibaba Cloud CosyVoice large models
Doubao large models
voice
String
Yes
The voice for speech synthesis.
For a list of available voices, refer to the documentation of the corresponding provider.
volume
Double
No
The speech volume. The default value is 50.
For the supported value range, refer to the documentation of the corresponding provider.
pitchRate
Double
No
The pitch rate. The default value is 0.
For the supported value range, refer to the documentation of the corresponding provider.
speechRate
Double
No
The speech rate. The default value is 0.
For the supported value range, refer to the documentation of the corresponding provider.
Note
Create a Function Compute instance in the China (Shanghai) region. This lets you use a private IP address to reduce network overhead. You can disable the public IP address for enhanced security.
Each type of ControlParams has specific requirements:
Voice: This parameter must be sent in the initial packet. It is ignored in subsequent packets.
GatherDtmf: This parameter must be sent in the initial packet. It is ignored in subsequent packets.
Transfer: This parameter can be sent at any time during the conversation.
HangUp: This parameter can be sent at any time during the conversation.
Although the beginSession interface is designed for streaming, it is currently implemented as a synchronous blocking call. Therefore, the API response time must be under 200 ms.
To ensure a low-latency conversation, the large language model's time to first byte must be under 600 ms.
Consider the following for text-to-speech (TTS) playback of the large language model's responses:
Format numbers in the text output to ensure they are read correctly by the text-to-speech engine.
Some text-to-speech engines may struggle with the intonation of words with multiple pronunciations.
Function Compute demo
Configuration procedure
Prerequisites
Enable Function Compute.
Enable Cloud Outbound Bot.
Function Compute
Go to the Function Compute console: https://fcnext.console.aliyun.com/cn-shanghai/functions. In the top navigation bar, select China (Shanghai) as the region.

Create a Web function. This example uses a demo written in Java. The following figure shows the configuration:

Configure the function on its details page.
In the trigger configuration, set the authentication method to signature method and enable the Disable public network access URL setting.
Configure the Reserved Instance and horizontal scaling policies based on your business requirements. Set the number of Reserved Instances to at least 1 to prevent the first invocation from timing out.
Obtain the Web function's configuration.
Function name
Function region
Trigger address. To minimize invocation latency, use the internal access address (HTTP).
Configure Cloud Outbound Bot
In large model scenario management, create a scenario and enter the function service parameters.

After creating the scenario, open it and configure the voice & VUI settings.

After completing the configuration, click voice debugging to run a test.

Return to the large model scenario list and click publish. Once published, you can use the scenario when creating a new outbound call task.


