Description
This article describes the most common scenarios of VOIP implementation in FortiGate when SIP is used.
There are three general scenarios in which the FortiOS session initiation protocol (SIP) solution is usually deployed, and a common practice for ISP/multi-vdom scenarios, where NAT is needed.
Solution
For the ease of understanding, the green highlight covers the network part that is managed.

- Phones need to register to the SIP server, in order to place calls through it. So port 5060 needs to be open through FortiGate by a VIP.

- FortiGate must apply Source-NAT to the outgoing packets, including the SDP content, to hide the internal network.

- The NAT will only change the content of the IP headers, leaving the SDP content (IPs) unchanged. This causes problems in the SIP process.

SIP clients may or may not be behind a SIP-aware NAT unit.
Neither the clients, nor the server is on the local/private network.
Firewall Policy Configuration for SIP traffic:
Note: This will be the sample for SIP configuration. Check the SIP provider documentation for requirements
Topology:
Internal phone network (Test-Phone VLAN) --- Internal Phone Server (Test-Server VLAN) --- FGT (WAN) --- Internet --- SIP provider
(If the phone server is in the same VLAN as the phone system, you can skip the first step of the policy configuration below)
- Make sure to establish the connections between the phones and the internal phone server by creating 2 firewall policies for the VLAN traffic with NAT disabled:
config firewall policy
edit 1
set name "Phone-to-Server"
set srcintf "Test-Phone"
set dstintf "Test-Server"
set action accept
set srcaddr "all"
set dstaddr "all"
set schedule "always"
set service "ALL"
next
edit 2
set name "Server-to-Phone"
set uuid c25ad7ee-d4b2-51ed-cc97-a28410b79310
set srcintf "Test-Server"
set dstintf "Test-Phone"
set action accept
set srcaddr "all"
set dstaddr "all"
set schedule "always"
set service "ALL"
next
end
- Create a new VIP object mapping the WAN IP address to the internal phone server’s IP address. Enable 'Optional Filters' and 'Source address' to type the IP address of the SIP provider. This means that only traffic from the SIP provider will be able to reach the internal phone server through the WAN IP address.
config firewall vip
edit "SIP-to-Server-VIP"
set uuid deafae72-d4b4-51ed-665a-f03753be03dd
set src-filter "<SIP-provider-public-IP>"
set extip "<WAN-IP-address>"
set mappedip "<Test-Server-VLAN-address>"
set extintf "any"
next
end
It is optionally possible to enable services to further restrict the traffic through port(s) to be able to reach the internal address and enable port forwarding to map the external port(s) to internal port(s).
- In the firewall policy configuration page (either 'IPv4 Policy', 'Firewall Policy' or 'Security Policy' for NGFW mode), create 2 firewall rules for traffic from the internal phone server VLAN to the Internet and vice versa:
config firewall policy
edit 4
set name "SIP-to-Server"
set srcintf "WAN"
set dstintf "Test-Server"
set action accept
set srcaddr "all"
set dstaddr "SIP-to-Server-VIP"
set schedule "always"
set service "ALL"
next
edit 3
set name "Server-to-SIP"
set srcintf "Test-Server"
set dstintf "WAN"
set action accept
set srcaddr "Test-Server address"
set dstaddr "SIP Provider"
set schedule "always"
set service "ALL"
set nat enable
next
end
- (Optionally) it is possible to configure any UTM features as needed and/or restrict the policies to only allow traffic for a certain port(s) by adding service(s) (for example, UDP port 5060)
IMPORTANT NOTE.
In a SIP VoIP scenario, it is desirable to perform the least necessary NAT operations, and only if absolutely needed.
It has to be considered in this order: VIP (most common), VIP (ranges of IPs), SIP-ALG (it is performing NAT), IP-pool (least desirable, only when absolutely needed, otherwise SIP-ALG or VIP are a better solution).
Based on: https://docs.fortinet.com/document/fortigate/6.2.3/cookbook/667795/general-use-cases
Related Articles
Technical Tip: VOIP calls (using SIP)
Technical Tip: Disabling VoIP Inspection
Techincal Tip: SIP useful Commands
Technical Tip: Enabling the SIP Application Layer Gateway (ALG)
Technical Tip: How to confirm if FortiGate is using SIP Session Helper or SIP ALG
Technical Tip: How to use the SIP ALG to prevent unwanted calls
Technical Tip: FortiGate Hosted NAT Traversal for SIP
SIP and SCCP Traffic is Handled by the VoIP ALG/Proxy by default in FortiOS 5.2
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is a really important article for more sophisticated sip implementations. Great work!