Skip to main content

Call routing

When configuring telephony, it is possible to create multiple connections that will use different logins but the same host, protocol, or port, as well as have active registration and allowed inbound calls.

Routing is performed for such connections. Calls to numbers specified in the login are distributed to the corresponding SIP trunks and then to different bot channels.

The call routing method is set in the method property:

  • invite — call transfer with the connection preserved. This is the default value.
  • refer — call transfer with the connection terminated.

Via invite

Call routing via invite allows you to preserve the connection while the agent is talking to the customer. After that, the customer can switch to the dialog with the bot and continue the conversation with it.

Use the transferChannel property:

state: TransferToAgent
intent!: /TransferToAgent
random:
a: Transferring you to the agent. Please stay on the line.
a: Putting you through to an agent. Please stay on the line.
script:
$response.replies.push({
type: "switch", // Bot reply type.
phoneNumber: "16123456789", // The phone number the call will be transferred to.
// You can send a SIP URI (SIP number) instead of phone number:
// sipUri: "16123456789@sip.voximplant.com",
transferChannel: "237-test-237-VDQ-28334674", // botId. The call will be routed over the SIP trunk connected to the channel.
continueCall: true, // Redirect the customer back to the bot after the conversation with the agent.
continueRecording: true // Continue recording the conversation.
});
tip
Specify botId in the transferChannel field to route the call over the SIP trunk connected to the channel. The parameters of the enabled SIP trunk will be applied.

You can copy the botId value from the Tovie Platform interface:

  1. Go to the project.
  2. Select Channels in the control panel.
  3. Copy botId under the necessary channel name.

If an incorrect botId is specified or the field is empty, the call will be transferred through the SIP trunk where the phone call was established.

Via refer

Call routing via SIP REFER allows you to transfer the call to the SIP provider and immediately terminate the connection. The connection ends regardless of whether an agent answered the call or not, and the customer will not be able to switch to the dialog with the bot.

caution
Not all providers support call routing via SIP REFER. For example, when connecting a SIP trunk issued by Zadarma, it will not work. Check if your provider supports this functionality or use your own PBX.

Use the method property:

state: TransferToAgent
intent!: /TransferToAgent
random:
a: Transferring you to the agent. Please stay on the line.
a: Putting you through to an agent. Please stay on the line.
script:
$response.replies.push({
type: "switch", // Bot reply type.
phoneNumber: "16123456789", // The phone number the call will be transferred to.
// You can send a SIP URI (SIP number) instead of a phone number:
// sipUri: "16123456789@sip.voximplant.com",
method: "refer" // Call transfer without preserving the connection.
});
tip
When you route calls via SIP REFER, the headers, transferChannel, continueCall, and continueRecording properties will be ignored.