Asterisk
Asterisk is a telephony service program.
In this article, we will learn how to set up a SIP trunk to transfer inbound calls from an Tovie DialogStudio bot to an Asterisk agent.
How does it work?
Let’s start with the transfer stages.
- You receive a client’s inbound call through Asterisk.
- The call is transferred to Tovie DialogStudio for IVR processing.
- If the client wants to talk directly to an agent, the Call transfer to agent block is selected from the script. The number of the agent or the group of agents is specified in the block settings.
Now let’s see how we can set up the connection.
Setting up telephony in Asterisk
Let’s get to setting up the SIP trunk on the Asterisk’s side. We will use a connection using SIP URI for identification, SIP URI being the IP address of a connected external server.
You will have to change two files on your server:
sip.conf
— the SIP channels configuration file;extensions.conf
— the file describing call routing rules.
Changes in sip.conf
In the file settings, add the following:
[general]
srvlookup=yes
[tovie]
host=188.34.156.160
fromdomain=188.34.156.160
insecure=invite,port
type=friend
disallow=all
allow=alaw
dtmfmode=auto
context=tovie-in
directmedia=no
nat=no
qualify=yes
Here:
host
— a Kamailio SIP proxy.context
— the name of the context that will be used inextensions.conf
. Entertovie-in
.directmedia
andnat
— these options allow you to establish a connection accounting for your network’s configuration.- Enter
no
, if your Asterisk service has an external IP address. - If you use an internal IP address, you must specify that you use NAT. Set the
nat
option toyes
.
- Enter
qualify=yes
— a periodic check of the Tovie DialogStudio server availability.
Changes in extensions.conf
[from_pstn_sip_provider]
exten => 14155550132,1, Dial(SIP/${EXTEN}@tovie)
[tovie-in]
exten => 666,1, Dial(SIP/101)
Here:
14155550132
— an example of a public number for customer calls.Dial
— the command for establishing a new outbound connection and linking it to the current channel that received the call.[tovie-in]
— the context with the settings for the Tovie DialogStudio SIP trunk.666
— an example of an Asterisk extension number to which calls from Tovie DialogStudio are transferred. When you want to transfer the call to an agent, you have to specify this number.101
— an example of an extension number referring to an Asterisk agent or a group of agents, which receives the transferred calls from Tovie DialogStudio.
Setting up telephony in Tovie DialogStudio
To connect Tovie DialogStudio to your configured SIP trunk, create a new SIP connection. What you need to do:
- Go to Tovie DialogStudio.
- Open Profile → Configuring telephony → Add a connection.
- Enter
match_trusted_ip_port
in the Login field. The Password field must be empty. - Specify the external IP address of your SIP PBX in the Host/IP field, and the port according to your settings in the Port field.
- Enable the Allow inbound calls switch.
- In the Extended settings section, disable the Registration is required parameter.
All done! Create a script and add the Call transfer to agent block to it. Now your bot can receive inbound calls from Asterisk and transfer them to an agent.