Integrating FortiVoice with Twilio
This section describes how to configure the FortiVoice phone system to provide a telephony service with Twilio’s elastic SIP trunking. The integration enables incoming calls to the FortiVoice phone system to be routed to Twilio for additional services such as interactive voice response (IVR) or speech recognition. After completing the user data collection and responses, the call control can be subsequently transferred to a telephone extension or an agent served by the FortiVoice phone system.
The FortiVoice dial plan provides digit translation and call routing for the system. Use the dial plan to customize the routing of calls to and from the Twilio platform. If Twilio uses a SIP REFER to implement a call back to FortiVoice, you do not have to configure an inbound dial plan.
The following diagram illustrates an example network topology of FortiVoice with Twilio.
Considerations about accessing and using Twilio:
-
A Twilio demo account does not allow you to call from and to numbers that you did not add to the FortiVoice phone system. Therefore, it is a good idea to upgrade your Twilio account to perform your testing.
-
Twilio treats a SIP trunk (in and out) as two separate items.
-
Twilio uses a specific number format (+1xxxyyyyyyy) where xxx is the area code and yyyyyyy is the phone number.
To complete the configuration tasks on Twilio
- Sign up for a Twilio paid account. The demo account has too many restrictions.
- Create and configure a Twilio elastic SIP trunk. After you complete this task, you will receive a uniform resource identifier (URI). Twilio's elastic SIP trunking uses an fully qualified domain name (FQDN) as a termination URI that is used by the FortiVoice phone system to direct SIP traffic towards Twilio.
- Take note of this URI because you will need this URI when you set the SIP server during the configuration of the FortiVoice SIP trunk.
To create a FortiVoice SIP trunk
- In the FortiVoice web-based manager, go to Trunk > VoIP > SIP.
- Click New.
- Configure the following parameters:
GUI field
Description
SIP
Name
Enter the trunk name. For example, Twilio.
Enable
Select to activate this SIP trunk.
Display name
Enter the caller ID that will appear on the called phone, such as Example Company.
Main number
Enter the number that will appear on the called phone.
SIP setting
SIP server
Enter the SIP URI that you have received from Twilio. For example, yourname.pstn.twilio.com.
SIP port
Keep the default value (5060).
Using SRV record
Keep this setting disabled.
User name
Enter the name that you have used during the creation of the Twilio elastic SIP trunk.
Password
Enter the password that you have used during the creation of the Twilio elastic SIP trunk.
Auth. user name
Enter the same user name that you have used during the creation of the Twilio elastic SIP trunk. The user name and auth. user name are the same.
Realm/Domain
Enter the same URL that you have entered in the SIP server field.
SIP settings
Keep the default setting (sip_trunk_default).
Max channel
Each trunk contains multiple channels. The number of channels you have in a trunk is controlled by your VoIP provider.
Max outgoing channel
With the known number of max channels, if you need to reserve incoming channels, you can enter the number of outgoing channels allowed and the remaining channels are for incoming calls.
User=Phone in SIP URI
Keep this setting disabled.
Inband ringtone (Early media)
Keep this setting disabled.
Caller ID Option
Keep the default settings.
Registration
Select Standard.
Outbound Proxy
Keep this setting disabled.
- Click Create.
To create a FortiVoice dial plan for inbound calls
- In the FortiVoice web-based manager, go to Call Routing > Inbound.
- Click New.
- Configure the following parameters:
GUI field
Description
Name
Enter a name for this plan.
Enable
Select to activate this dial plan.
From Trunk
Click +. From the list available entries, select the Twilio SIP trunk.
Call Handling
From the Action type list, select Dial Local Number to process incoming calls.
To route calls to a local extension number, create a match pattern.
- Click Create.
To create a FortiVoice dial plan for outbound calls
- In the FortiVoice web-based manager, go to Call Routing > Outbound.
- Click New.
- Configure the following parameters:
GUI field
Description
Name
Enter a name for this plan.
Enable
Select to activate this dial plan.
Dialed Number Match
Create a number pattern to match a number or a range of numbers for how the call handling will be applied to the respective calls.
Call Handling
The actions to process the incoming calls with matched dialed numbers and/or caller IDs.
- Click New.
- In Action, select Allow.
- In Outgoing trunk, select the Twilio SIP trunk.
- Click Create.