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 Aimylogic 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 Aimylogic 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
[aimylogic]
host=82.202.218.130
fromdomain=82.202.218.130
insecure=invite,port
type=friend
disallow=all
allow=alaw
dtmfmode=auto
context=aimylogic-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
. Enteraimylogic-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 Aimylogic server availability.
Changes in extensions.conf
[from_pstn_sip_provider]
exten => 88001234567,1, Dial(SIP/${EXTEN}@aimylogic)
[aimylogic-in]
exten => 666,1, Dial(SIP/101)
Here:
88001234567
— 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.[aimylogic-in]
— the context with the settings for the Aimylogic SIP trunk.666
— an example of an Asterisk extension number to which calls from Aimylogic 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 Aimylogic.
Setting up telephony in Aimylogic
To connect Aimylogic to your configured SIP trunk, create a new SIP connection. What you need to do:
- Go to Aimylogic.
- 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.