Transfer to the agent
Use $response.replies
with the switch
type to transfer a call to an agent.
Syntax
$response.replies
.push({
type: "switch",
phoneNumber: "16123456789", // phone number to transfer to
// sipUri: "16123456789@yourcompany.sip-us.nexmo.com", // you can pass the SIP URI instead
headers: { // SIP headers
"Remote-Party-ID": remotePartyId ,
testheader: "header"
},
transferChannel: "237-test-237-VDQ-28334674", // botId
continueCall: false,
continueRecording: false
});
Agent transfer parameters for the phone channel:
Parameter | Type | Description |
---|---|---|
phoneNumber |
String | The phone number the call will be transferred to. Transfer to extension phone numbers is not supported. |
sipUri |
String | The SIP URI the call will be transferred to. If you pass sipUri , you do not need to pass phoneNumber . |
headers |
Object | You can configure SIP headers when a call is transferred to an agent over the phone channel. These headers will be sent in the SIP INVITE message to the specified number. This feature is usually used to transmit client’s caller ID details. |
transferChannel |
String | Specify botId in the field to route the call over the SIP trunk connected to the channel. The parameters of the enabled SIP trunk will be applied. |
continueCall |
Boolean | When true , the customer will be redirected back to the bot after the conversation with the agent ends or if the agent is not available. The default value is false . |
continueRecording |
Boolean | When true , conversation recording continues, including conversation with the agent and conversation with the bot after the client has returned to it. The call recording will be saved to conversation logs. The default value is false . |
Agent transfer status
Use the $dialer.getTransferStatus()
method to monitor the status of the transfer of a customer to an agent.
The $dialer.getTransferStatus()
method returns an object with the following fields:
status: "SUCCESS" | "FAIL"
— agent transfer status.hangup: true | false
—true
means the customer has ended the conversation.false
means the customer is still online and was re-directed to the bot (ifcontinueCall: true
).number
— the phone number the call was transferred to.
For example:
theme: /
state: Start
q!: *start
a: Start new call
state: SwitchStateContinue
q!: transfer to agent
script:
$response.replies.push({
"type": "switch",
"phoneNumber": "16123456789",
"continueCall": true,
"continueRecording": true
});
state: TransferEvent
event: transfer
script:
var status = $dialer.getTransferStatus();
log(status);
An entry in the following format will be added to the log:
17:14:40.459 [main] INFO js - {"status":"SUCCESS","hangup":false,"number":"16123456789"}
17:14:40.482 [main] INFO js - {"status":"FAIL","hangup":true,"number":"16123456789"}
Agent is unavailable
If the transfer to an agent failed (e.g. the transfer number is busy), the customer may be re-directed back to the bot. To do so, specify continueCall: true
in $response.replies
and monitor event: transfer
in your script.
For example:
theme: /
state: Start
q!: *start
a: Start new call
state: SwitchStateContinue
q!: transfer to agent
script:
$response.replies.push({
"type": "switch",
"phoneNumber": "16123456789",
"continueCall": true,
"continueRecording": true
});
state: TransferEvent
event: transfer
if: $dialer.getTransferStatus().status === 'FAIL'
a: The agent is currently busy. We will reach out to you later.
else:
a: Thank you for contacting us. Please rate our service.
Note that the customer will be returned to the state where the event: transfer
event is monitored. Here you can add bot replies or reactions.
Phone number display
When transferring a call to an agent, you can configure the display of the actual client number, instead of the bot number. To do this, you need to create a telephone connection and configure a SIP trunk without registration and password:
- go to SIP server connection on the side left tab > Add new connection;
- in the Main settings > Password leave the field blank;
- in the Extended settings > Registration is required leave the switch inactive;
- follow the instructions to fill in the rest of the fields.
Note that the SIP trunks of the Beeline provider do not allow the use of these settings. Therefore, the display of the actual client number is not available for them.