MS Lync FireWall Settings with PSTN functionality

To use MS Lync as an PSTN access gateway you need to set some FireWall rules to give Lync outbound access. This could be a thing to give you a pain in the ass. So here some settings I used in my environment that could help you to set up Lync for outbound calls, Remote acces to Lync an IM. I Use an MS TMG FireWall to publish Lync.

FireWall Settings LYNC External Access Rules (Web Access Rules)

External SIP Trunk settings
protocol UDP 5000/30000 Port Range 5000-30000 UDP Send Recieve
From Lync Mediation Server
TO SIP Trunk Provider
Exetrnal SIP access
protocol SIPS Portrange 5061 TCP Outbound
(SIP over TLS – An encrypted outbound protocol used for establishing VOIP and IM sessions.)
FROM Internal
To External
External STUN Access
Protocol STUN Port Range 3478 UDP Send
From Lync Mediation Server
To SIP Trunk Provider
External RTP Access
Protocol RTP Correction Port 5060 TCP Outbound
From Lync Mediation Server
TO SIP Trunk Provider

FireWall Settings Lync Server Publishing Rules

Server Publishing rule SIP Trunk Provider
Action Allow
Traffic UDP 5000-30000 Server
From SIP Trunk Provider
TO Mediation server
Network External
Server Publishing rule RTP
Action Allow
Trafic RTP Server
FROM Sip Trunk Provider
TO Mediation Server
Network External
Server Publishing rule STUN
Action Allow
Protocol Stun Server
FROM External
TO Mediation server