1 Integrating Asterisk FreePBX with Lync Server 2010 Author: Baaskar R 1 www.baaskarcharles.com
2 Integrating Asterisk FreePBX with Lync Server 2010... 1 AsteriskNow package Source... 3 Installing AsteriskNow... 3 Configure AsteriskNow... 3 Add Extensions... 3 Lync Stress Tool Incoming call Extension... 4 Add SIP Trunk... 5 Add Inbound Routes... 7 Add Outbound Route... 8 Configure PSTN Gateway in Lync Server 2010... 8 Create Dial Plan, Voice Policy and Trunk Configuration... 9 Testing / Troubleshooting the Configuration... 12 AsteriskNow Configuration... 12 2 www.baaskarcharles.com
3 AsteriskNow package Source Download the latest AsteriskNow 2.0.2 Here Installing AsteriskNow Boot the VM with AsteriskNOW-2.0.2-x86_64-DVD.iso image In the Setup options, type 1 and press Enter (By Default, the installation would continue with Option 1. Option 1 installs AsteriskNow with FreePBX GUI) Follow the install wizard, installation wiill complete without the any interruption Login to the server as root and password provided during the installation Configure AsteriskNow Type Setup to configure Network configuration Make sure you provide proper gateway and DNS server IP addresses Reboot the server using command shutdown r now Now, Login to AsteriskNow web GUI using http://x.x.x.x ( IP address of AsteriskNow server) Default user name and password for Web GUI is admin Add Extensions Click Extension and select Generic SIP Device and Click Submit Type the User Extension and Display Name as shown below. I have extensions starting with 2 and XXX digits, example 2000. Under Device Options, enter the secret (password for the user extension) 3 www.baaskarcharles.com
4 Click Submit Note: I am not configuring Voice mail or DID number for now so have not configured remaining sections in the Extension tab. Lync Stress Tool Incoming call Extension Need to create extension 0000 with different target routing to handle all the Incoming calls genrated from Lync stress tool and via Mediation server to PBX system. Follow the steps below: Under FreePBX main Console, Click Applications -> Select Generic SIP Device -> Click Submit Add following information as in the below screenshot: 4 www.baaskarcharles.com
5 Add Extension as 0000 and Secret as0000 Under Optional Destionations -> No Answer, select Feature Code Admin and Directory# Type 1 in the CID Prefix; As shown below: Leave remaining options to Default. Add SIP Trunk Click Connectivity and Select Trunks In the Right side of the window, click Add Trunk - > SIP Trunk In General Settings, under Trunk Name, provide name for your SIP Trunk 5 www.baaskarcharles.com
6 Under Outgoing Settings,type values as in screenshot below: Click Submit Changes. 6 www.baaskarcharles.com
7 Brief description of Outgoing Settings (Peer details): host=10.10.1.16 if Mediation server is collated. transport=tcp,udp port=5068 Server type=friend outgoing calls and messages context=from-internal qualify=yes still Online insecure=invite ; IP address of the Lync Mediation Server or Front-End Server ; Trasmission protocol add both TCP and UDP ; Listening port of Mediation Server or Collated Front-End ; Friend variable indicates Host allows both incoming & ; Default context generated by FreePBX GUI ; Yes allows Asterisk server to check if Peer (Lync Server) is ; Do not require authentication of incoming INVITEs Add Inbound Routes Click Connectivity -> Inbound Route In Description Field: Provide name for the incoming Route In Set Destination, select Trunks and then select SIP Trunk created earlier. 7 www.baaskarcharles.com
8 Click Submit Add Outbound Route In Route name, Enter a name In Set Patterns that will use this Route, enter 7XXX (I planned to assign 7XXX series for Lync extensions hence, this pattern will allow all the extensions dailed with starting 7 and followed by 3 digits will get routed to SIP Trunk) In Trunk Sequence for Matches Routes. Select SIP Trunk created earlier Click Submit Changes This ends the configuration of AsteriskNow. Configure PSTN Gateway in Lync Server 2010 Open the Lync Topology Builder and download the deployed topology In the section PSTN Gateway, right click New PSTN Gateway Enter AsteriskNow IP address Type Listening Port as 5060 8 www.baaskarcharles.com
9 Under SIP Transport Protocol, select TCP and click OK Right Click PSTN Gateway newly added in the Topology, publish the topology. Create Dial Plan, Voice Policy and Trunk Configuration First, lets create dial plan and assign the PSTN Gateway, voice policy to dial plan. Open the Lync Control Panel, click on Voice Routing Under Dial Plan, double click, Global Now under Normalization Rules, click New and enter values similar to below screenshot: 9 www.baaskarcharles.com
10 I have imcoming calls from Asterisk PBX to Lync with 7XXX extensions, creating normalization rules to check starting digit as 7 and add + infront of 7XXX extension to make the dialed number as e.164 format. Click Ok twice. In the main Dial Plan main window, select Global and click Commit and select Commit All Now Click on Voice Policy Click on Voice Policy and downlob click Global In Associated PSTN Usages, click New Enter the name for Voice Policy In Assoicated Routes, click New Under Name section, Enter Name Click Add and enter 7 (my Lync extentions starts with 7) Under Associated gateways, click Add and select PSTN listed CLick Ok 3 times to come back to main window Select GLobal and select Commit - > Commit All Click on Trunk Configuration Double click Global Under Assoicated Transliation Rules, Click new Under Name field, Enter Name Add remaining as per screenshot. This rule is created for allowing outgoing call from Lync, Normalization is required for outgoing calls. For examples, Lync client will dial out 3000 as +3000. Normalizatin rule is created to remove "+" and send 3000 to PBX system CLick OK twice Select Global and Commit All. 10 www.baaskarcharles.com
11 Configuration of Lync Policies to handle Lync Stress Tool Outgoing Calls Note: You need to remove the above rule Call from Lync to PSTN and add below rule to make Lync Server work for Stress tool. To check the End to End Connectivity, don t create the rule below yet. To handle the outgoing call (Number +14250000000) from Lync Stress tool and route it to PBX system, create addition Rule in the Trunk Configuration as below: 11 www.baaskarcharles.com
12 This ends the Lync configuration. Configure 3CX Softphone & add Extension Download and install 3CX latest version from Here Open the 3CX soft phone and Right on the Display Screen Select Accounts and Click New Add the information as shown in the screenshot below: Note: You need to create Extension 0000 in the Asterisk PBX system before configuring 3CX softphone. Testing / Troubleshooting the Configuration AsteriskNow Configuration 1. To test the connectivity between AsteriskNow and Lync Mediation Server [root@pbx ~]# telnet <IP address of Lync Mediation Server> 5068 If result shows Not Connected then Lync Mediation Server is not listening on port 5068. Check your Lync topology on what port is configured for Lync Mediation Listening Port (Don t get confused with PSTN Gateway listening Port) Go to Lync mediation server and open Command Prompt, type Netstat a This gives all listening ports and respective IP address of Mediation Server. 2. Check AsteriskNow service running [root@pbx ~]# service asterisk status asterisk (pid 4652) is running... 12 www.baaskarcharles.com
13 OR [root@pbx ~]# /etc/init.d/asterisk status asterisk (pid 4652) is running... 3. How to enable debugging in AsteriskNow [root@pbx ~]# asterisk r [root@pbx ~]# sip set debug on If you want to enable debug on specific peer then follow below command: [root@pbx ~]# sip set debug peer <peername> To List Peer names added in your PBX: [root@pbx ~]# sip show peers 4. Check SIP peers and SIP Trunk status and registration in AsteriskNow [root@pbx ~]# sip show peers [root@pbx ~]# sip show registry 13 www.baaskarcharles.com