ShoreTel LLDP Followup

A while ago I wrote a post about the experience I had setting up LLDP on Cisco switches with ShoreTel phones. Since then I have learned a trick or two and though I’d give a little update.

In the post I mentioned changing the configuration files for the phones on the ShoreTel server in order to correctly set the language and country, thus making the dial tone etc sound correct to end users. Unfortunately, this approach is broken. While it works to start with, we found that ShoreTel overwrites the configuration files periodically and removes the custom settings enter, which is a pain un the UK when the default country for ShoreTel is USA.

To get around this, there are some other configuration files which I was made aware of by our ShoreTel partner. Fortunately though ShoreTel provide some custom configuration files for each phone which are included in the main configuration file. The table below shows which custom configuration file you need for each model of phone.


So within the c:\inetpub\ftproot\sevgcustom.txt file for the IP 230g phones we use, all we have to do is add the following to the file.

# Please consult Shoreline support before editing or deleting this file

Include “Country_7.txt”
Include “Language_4.txt”

And done. If you reboot a phone, you will see it downloads the sevgcustom.txt file from the server and the language and country settings are all correct.

Don’t forget to change the configuration files for any other model phones you have!

Trunking From Skype for Business to Shoretel via FreePBX

Recently I was tasked with setting up Dial-in conferencing in Skype for Business using a Shoretel voip system and the PSTN Gateway. Seems simple, until you do some digging and find out that Shoretel 14 doesn’t support SIP over TCP, and S4B doesn’t support SIP over UDP.

I looked at the recommended option from Shoretel, which is a Mediant Session Border Controller to proxy between the two voip systems. I’m sure that would work fine if money was no object, but when the budget for the project is minimal, another option is required. The option I settled on was an open source PBX platform in the form of FreePBX, which is essentially a gui for Asterisk.

After a lot of research, posts with missing information and trial and error I finally got the solution working by following multiple guides for various products connecting to other products until I finally found a configuration that worked. The solution has been in place for roughly a month now and seen a reasonable amount of load while remaining stable. We haven’t had any call quality issues over PSTN either.

I should point out here though that this particular installation wasn’t configured to support enterprise voice and user extensions would still remain in Shoretel. If User Extensions on Skype is your end game, then maybe this solution isn’t for you. Feel free to follow along though.

Disclaimer: Some of the configuration detailed in this post is quite advanced and shouldn’t be attempted on a live system unless you are confident you know what you are doing. I am not responsible for any damage you cause to your own systems. The settings in this post are the settings used in our setup and work for us. The settings required for your setup may differ.

The version numbers of the components used are as follows.

  • Shoretel – 19.42.8801.0
  • FreePBX –
  • Skype For Business – 6.0.9319.0

FreePBX Installation

To start with I followed a guide on PowerPBX to get Asterisk installed on Ubuntu Server. I’d recommend doing the same if you don’t already have a FreePBX installation or are as new to FreePBX as I am. Some of the settings later in this post may conflict with settings currently in use if you already have a FreePBX installation that you intend to use.

Shoretel Trunk Setup

Next you need to make sure your Shoretel system is ready to use SIP trunks. This involves allocating switch ports for SIP trunks. To do this, you need to do the following:

  1. Open up Shoreware Director.
  2. Navigate to Platform Hardware > Voice switches > Primary.
  3. Click the name of the switch you want to allocate the SIP Trunks on.
  4. Change one (or more) of the ports to 5 SIP Trunks.
  5. Click Save.

Next you need to configure a Trunk Group on the Shoretel system. To do this you need to navigate to Trunks > Trunk Groups. Select the site that contains your switch with the SIP trunk port(s) configured and select SIP from the Type drop down before clicking Go.

I’ll list the settings used by our setup below. You may need to tweak these for your own deployment.

  • Name – Skype for Business.
  • Enable SIP Info for G.711 DTMF Signalling – Unchecked.
  • Profile – Default Tie Trunk.
  • Digest Authentication – {None}.
  • Username – siptrunkusername (Not my actual username).
  • Password – siptrunkpassword (Not my actual password).
  • Number of Digits from CO – 4.
  • DNIS – Unchecked.
  • DID – Unchecked.
  • Extension – Checked
    • Translation Table – Checked []
    • Prepend Dial In Prefix – Unchecked
    • Use Site Extension Prefix – Unchecked
  • Tandem Trunking – Checked
    • User Group – Skype (This is a custom user group we created to force outbound calls through a certain ISDN trunk group. If you need to change this from the default you will probably know how to create a new user group anyway.)
    • Prepend Dial In Prefix – 9
  • Destination – 1700: Default.
  • Outbound – Checked.
  • Access Code – 9.
  • Local Area Code – 1670 (Yours will be different).
  • Carrier Code – Blank.
  • Billing Telephone Number – Blank.
  • Trunk Services Section
    • Local – Unchecked
    • Long Distance – Unchecked
    • National Mobile – Unchecked
    • International – Unchecked
    • Enable Origin Called Information – Unchecked
    • Caller ID not blocked by default – Checked
    • Enable Caller ID – Checked [Blank]
    • Emergency – Unchecked
  • Trunk Digit Manipulation Section
    • Dial Local Numbers in National Form – Unchecked
    • Dial in E.164 Format – Checked
    • Prepend Dial Out Prefix – Blank
    • Off System Extensions – Click Edit
      • Click New
      • Enter an extension range to be used by Skype. We used a range of 50 extensions to allow for future expansion, one will do usually though. Make sure the range of extensions are not in use else where on your system. They don’t need to have a DDI on a different trunk as we will be using a DNIS map later to route a DDI to the off system extension. We used 8500-8550
      • Click OK
    • Translation Table – {None}
  • Click Save.

Next you will need some individual trunks within the trunk group:

  1. Navigate to Trunks > Individual Trunks.
  2. Select the same site as the Trunk Group you have just created, and then select the Trunk Group from the drop down menu, followed by Go.
  3. Enter a Name for the trunks. Shoretel will increment the name with numbers if there is more than one individual trunk.
  4. Select the switch to use for the SIP trunks. This will be the switch you configured earlier.
  5. Enter the number of individual trunks you want in the group. A trunk is required for each phone call or participant of a conference. Don’t exceed your licensed amount of SIP Trunks unless you know how the licensing on Shoretel works..
  6. Enter the IP address of your Free PBX server.
  7. Click Save.

FreePBX System SIP Configuration

Now for the FreePBX configuration. Providing you followed the guide mentioned earlier, and didn’t have any problems, you should have a working FreePBX server installed and running. You will need to tweak some of the system SIP settings to make this solution work.

  1. Login to FreePBX Administration.
  2. Navigate to Settings > Advanced Settings.
  3. Scroll down to the Dialplan and Operations section.
  4. Set SIP Channel Driver to chan_sip.
  5. Navigate to Settings > Asterisk SIP Settings.
  6. Set Allow Anonymous Inbound SIP Calls to Yes.
  7. Enter your internal networks. For Example / 24.
  8. Click Submit (bottom) followed by Apply Config.
  9. Click Chan SIP at the top right of the page.
  10. Set NAT to no.
  11. Set IP Configuration to Static IP.
  12. Set Override External IP to the IP address of your FreePBX server.
  13. Scroll down to Other SIP Settings and click Add Field once. In the two sets of fields add the following:
    • tcpenable = yes
    • tlsenable = yes
  14. Click Submit Changes followed by Apply Config.
  15. Reboot the FreePBX server.

FreePBX Trunk Configuration (Shoretel)

Once the server has rebooted ensure you can log back in to FreePBX and that you have no errors displayed on the home page. If everything is OK, then it is time to create the Trunks on the FreePBX end.

  1. Navigate to Connectivity > Trunks.
  2. Click Add SIP (chan_sip) Trunk.
  3. Enter a name for the Trunk. Ours is simply Shoretel.
  4. Set Maximum Channel to the number of individual trunks you created in Shoretel earlier.
  5. In the top Dialed Number Manipulation Rules row add a dot (.) in the match pattern field.
  6. In the Outgoing Settings section specify the Trunk Name Again.
  7. In the PEER Details section you need to add the following information, substituting anything in () for your details setup earlier. I’d recommend pasting the text into notepad to edit it.


  8. Click Submit Changes followed by Apply Config.

Now, hopefully, if you navigate back to Reports > System Status you should see the graph line for Trunk Reg has increased to 1 from 0.

FreePBX Trunk Configuration (Skype)

Next you need to create the trunk in FreePBX that connect to Skype for Business. The steps are similar to the steps for the Shoretel trunk with a few tweaked settings.

  1. Navigate to Connectivity > Trunks.
  2. Click Add SIP (chan_sip) Trunk.
  3. Enter a name for the Trunk. Ours is simply Skype.
  4. In the top Dialed Number Manipulation Rules row add a pattern that matches your Off-System Extension range added in Shoretel earlier in the match pattern field. Ours is set to 85XX which will match any four digit extension starting with 85.
  5. In the Outgoing Settings section specify the Trunk Name Again.
  6. In the PEER Details section you need to add the following information, substituting anything in () for your details setup earlier. I’d recommend pasting the text into notepad to edit it.


  7. Click Submit Changes followed by Apply Config.

Skype PSTN Gateway Configuration

Now you will need to make a topology change to your Skype for Business installation. You probably have some form of change control in place for these kind of changes so go and grab the required signatures and head back here.

Open up Skype Topology Builder and load your current topology ready to edit it. I won’t go into detail on how to do this here as any Skype Admin should know how to do it. Once open, you need to tweak the settings of your Mediation Pool in order to support this type of configuration. Heres how:

  1. Expand Skype For Business > Site Name > Skype for Business Server 2015 > Mediation Pools.
  2. Right-Click the mediation pool you want to use and click Edit Properties.
  3. Ensure Enable TCP Port is Checked.
  4. Set TLS: to 5067 – 5067.
  5. Set TCP: to 5060 – 5060.
  6. Click OK.

Next you need to add the PSTN Gateway to your Skype topology. Follow the steps below to add the PSTN Gateway:

  1. Expand Skype For Business > Site Name > Shared Components and select PSTN Gateways.
  2. Right-Click the Container and select New IP/PSTN Gateway.
  3. For FQDN enter the IP address of your FreePBX server, then click Next.
  4. Click Next unless you need to change any settings for your environment.
  5. Set Trunk Name to FreePBX.
  6. Set Listening Port to 5067.
  7. Set SIP Transport Protocol to TLS.
  8. Select the Skype pool you want to associate as the Mediate Server.
  9. Set Associated Mediation Server Port to 5067.
  10. Click Finish.

Next it’s time to create a trunk in Skype:

  1. Expand Skype For Business > Site Name > Shared Components and select Trunks.
  2. Right-Click the Container and select New Trunk.
  3. Enter a Trunk Name.
  4. Select your PSTN Gateway from the drop down menu.
  5. Set Listening port for IP/PSTN gateway to 5061.
  6. Set SIP Transport Protocol to TCP.
  7. Select your Associated Mediation Server to the pool you want to use.
  8. Set Associated Mediation Server port to 5060.
  9. click OK.

Now you need to publish your topology in order to make the changes. I’ll leave that part up to you again incase you cause undesirable downtime or break something.

In theory, your trunks should come up shortly after the topology is published. You can check this from the home page of the FreePBX administration portal by checking the graph line for Trunk Rag has increased from 1 to 2.

Coffee Break

You’re probably getting bored with this post by now so I’d recommend a nice strong cup of coffee. I know I’m heading to grab one now while I’m typing it! I might even watch an episode of The Grand Tour while I drink it…

Skype Configuration

For the next part of the configuration you will need access to the Skype For Business Admin portal. Specifically the Voice Routing and Conferencing sections.

All of the steps in this section were performed on a Skype installation with no previous voice configuration. If your system already uses voice features I’d recommend leaving this bit to somebody that knows what they are doing if you don’t already.

First of all you need to create a Voice Policy:

  1. Navigate to Voice Routing > Voice Policy.
  2. Double click Global.
  3. Check all check boxes in the Calling Features section.
  4. Under Associated PSTN Usages section click New.
  5. Set Name to Shoretel and click OK.
  6. Set Call forwarding and simultaneous ringing PSTN usages to Route using the call PSTN Usages.
  7. Click OK.

Next comes a Route. Navigate to Voice Routing > Route. If you already have routes listed then I suggest you stop following this post and consult the person responsible for voice routing in Skype if you don’t understand how it works. If you don’t have any routes, go ahead and follow these steps:

  1. Click New.
  2. Type a Name of your choice. We chose Shoretel.
  3. Type .* (DotAsterisk) into the Match this pattern field.
  4. In the Associated trunks section click Add…
  5. In the Associated PSTN Usages section click Select…
  6. Click Shoretel Followed by OK.
  7. Click OK.
  8. Click Commit > Commit All.

Now comes some Trunk Configuration:

  1. Navigate to Voice Routing > Trunk Configuration.
  2. Double click Global.
  3. Ensure Encryption support level is set to Optional.
  4. In the Associated PSTN Usages section click select…
  5. Click Shoretel and click OK.
  6. Click OK.
  7. Click Commit > Commit all.

Time for the Dial Plan:

  1. Navigate to Voice Routing > Dial Plan.
  2. Double click Global.
  3. Specify a Dial-In Conferencing Region. We chose UK since that is where we are.
  4. Chose an External access prefix if you desire. We went with 9.
  5. In the Associated Normalization Rules section click new.
  6. Specify a Name of your choice.
  7. In the Build a Normalization Rule section input the following settings (you will need to click the edit button to modify the final two settings)
    • Starting digits – Blank
    • Length – At least 1
    • Digits to remove – 0
    • Digits to add – Blank
    • Pattern to match – ^(\d+)$
    • Translation Rule – $1
  8. Uncheck Internal extension.
  9. Click OK.
  10. Remove any other normalization rules.
  11. Click OK.
  12. Now click Commit > Commit all.

Skype Dial-In Access Number

While you are still in Skype you may as well configure the dial-in conferencing number. It won’t work yet but by doing so you will at least get some audible feedback to use to test your configuration while you complete the FreePBX and Shoretel routing later.

  1. Navigate to Conferencing > Dial-In Access Number.
  2. Click New.
  3. Enter the Display number as a the DDI you plan to use for your dial-in conferencing number for external parties. e.g. +441618444444.
  4. Add a Display name of your choice.
  5. in Line URI add tel:#### to represent the extension you want to use. In our case it reads tel:8500.
  6. In SIP URI add the sip address you want to assign. we went with sip:conferencing @
  7. Select your Pool.
  8. Select the Primary Language for this particular number.
  9. In the Associated Regions section click Add…
  10. Select the region created in the dial plan and click OK.
  11. Click Commit.

Don’t forget your users will need to be allowed to use Dial-In conferencing in the conferencing policy applied to them.

FreePBX Routes

Now you need to head on over to the FreePBX admin portal again to create some routes. This is another part that caused a lot of confusion when I was initially trying to get this to work thanks to some other guides not being accurate. Again the settings here may differ slightly depending on your setup.

The easiest way I found to route all calls through the Shoretel trunk unless they were specifically for an extension I knew existed in Skype. First of all I created the Incoming route to catch the calls for Skype.

  1. Navigate to Connectivity > Inbound Routes.
  2. Click Add Incoming Route in the top right of the page.
  3. Populate the settings below. Any I miss assume they are left as default:
    • Description – ShortelIn8500
    • DID Number – 8500
    • Set Destination – [Trunks][Skype (sip)]
  4. Click Submit.

Then I created an Incoming Route for anything else:

  1. Navigate to Connectivity > Inbound Routes.
  2. Click Add Incoming Route in the top right of the page.
  3. Populate the settings below. Any I miss assume they are left as default:
    • Description – SkypeIn
    • Set Destination – [Trunks][Shoretel (sip)]
  4. Click Submit and then Apply Config.


Now in theory internal users should now be able to dial the extension assigned to Skype PSTN Conferencing and hear the auto attendant saying “Welcome to the audio conferencing center.”

You should also be able to start a Skype Meeting using the meet now feature in Skype and add a recipient by typing in their extension or telephone number and hitting enter.

Assigning a DDI

Since Shoretel allows you to add other internal people to a call anyway this solution won’t be much use unless you map a DDI to the extension setup for Skype. I did this using a DNIS mapping on the ISDN trunk that the DDI belongs to. To do this follow these steps:

  1. Login to Shoreware Director.
  2. Navigate to Trunks > Trunk Groups.
  3. Select the trunk group that carries the DDI you wish to use. This was one of our ISDN groups.
  4. Click Edit DNIS Map.
  5. In the Received Digits field, enter the DDI in local format, ie excluding the country code and area code.
  6. In the next field add a name for the map. We went with Skype conferencing.
  7. Next select the Off System radio button and select the range you created in your SIP Trunk Group Extensions earlier.
  8. In the next field type the extension number used by Skype. 8500 in our case.
  9. Leave the Music on Hold as default.
  10. Click Add this record to the left of the row you have just filled in.
  11. Click Save.
  12. click Save again.

At this point you should be able to dial the DDI you have just configured from a mobile phone and hear the same audio prompt from the Skype auto attendant.


No doubt this post was a little tedious to follow. Unfortunately there isn’t a technique I’m aware of to make SIP an interesting subject. I do hope it might have helped somebody though at the end of the day. Or prevented any premature hair loss.

Shoretel, LLDP and DHCP headache

During the process of migrating to new DHCP servers my colleague noticed a lot of inactive leases in the DHCP scope for our data subnets. After cross referencing MAC addresses it became apparent that the leases belonged to our Shoretel IP phones. All of the phones also have active leases in the VoIP DHCP Scope.

First of all we took a look at the DHCP scope options. Option 156 was enabled on both scopes, containing the following.


We decided to break out trusty Wireshark to try and figure out what was going on. From here we could see what was going on. When the phones were booting up they were doing the following:

  1. Trying LLDP
  2. Requesting DHCP lease from the untagged vlan on the switchport they were plugged into (data subnet)
  3. Retrieving option 156 from the data scope and reconfiguring themselves to tag voice traffic with vlanid.
  4. Requesting DHCP lease from the tagged vlan on the switchport they were plugged into (voice vlan)
  5. Continuing normal boot.

Step 2 is where the phones were getting the lease in the data subnet.

We decided to try lldp-med on the Cisco 2960S switches that we use for access.

This is probably a good time to mention that all of this was tested thoroughly in a controlled environment before it was rolled out to end users. We are not responsible if you break your phone system after reading about our investigations here.

conf terminal
interface range Gi1/0/1-48
switchport mode access
switchport access vlan 100
switchport voice vlan 200

I won’t go into detail about the QoS config we are running. It is there though, just not shown here.

Next we removed option 156 from the data scope and changed the string in option 156 on the voice scope to the following.


After rebooting the phones they did the following.

  1. Negotiated LLDP with the switch.
  2. Requested DHCP lease from the tagged vlan on the switchport they were plugged into (voice vlan)
  3. Retrieved option 156 from the voice scope and reconfigured themselves NOT to tag voice traffic.
  4. Requested DHCP lease from the untagged vlan on the switchport they were plugged into (data subnet)
  5. Used a cached config file and continued booting.

Strange. We did some more tinkering and found that if we added the layer2tagging=1,vlanid=200 options back to the option 156 string and rebooted the phone they stayed in the correct vlan. From this we took an educated guess that the phones were assuming the defaults of layer2tagging=0,vlanid=0 if the option were not specified in the option 156 string.

Next we removed option 156 from the voice scope and added option 66, which it a Boot Server Address, and set it to the ftpservers address from the option 156 string, 192.168.***.***.

We rebooted the phones and they did the following.

  1. Negotiated LLDP with the switch.
  2. Requested DHCP lease from the tagged vlan on the switchport they were plugged into (voice vlan)
  3. Retrieved option 66 from the voice scope.
  4. Contacted the FTP server.
  5. Continued booting normally.

Success! Or so we thought. The country and language of the phones had both reverted to 1 and 1, meaning the dial tone was different, although the language was still English.

To get around this we changed the config files for the phones on the FTP server. The files were stored in c:inetpubftproot on the Shoreware Director server. The file names are shore_model.txt, where model is referred to on the white label on the back of every model. The original config file looked like this.

There is an updated method to accomplish this, whcih you can find in my newwer post ShoreTel LLDP Followup.


We changed it to the following.


After a quick reboot the phones were back to their normal selves.


Setting up a MediaTrix 4104/4108 on a Shoretel system using SIP

Recently we started looking for an alternative method to distribute our analogue lines between our on-site buildings other than pulling fifty pair analogues under ground to our central building where our SG90’s are located. We found the solution in a product from Media 5 called a MediaTrix.

The MediaTrix units are a 19″ rack-mount unit that is available in a 4-port, 8-port, 16-port and 24-port version, although the 24-port version required 2u of rack space. They connect to your network through a 10/100 RJ45 ethernet port (the newer models have 2) and present the analogue lines on RJ11 ports on the front of the unit. Each port can be configured to connect to an IP based PBX using the SIP protocol and can be authenticated individually, which is how we have the units configured.

The units, although a great device, do have some minor bugs in the administration interfaces which, if unknown, can cause problems during configuration. Hopefully this post will help somebody configure a MediaTrix on a Shoretel telephone system.

To start with you need to install the management software (Unit Management Network) which may have been included on a CD with your MediaTrix. If not it can be downloaded from the Media 5 support site.

Once installed you need to plug the unit into your network and power it up. We will find the unit using the UMN utility. Once it is powered up open the UMN Client and click the find unit icon on the toolbar (second from left). This will open up the following dialogue box.

Insert the IP range of your network and click start. The utility will find the unit and list it in the box at the bottom of the dialogue. Select the unit from the list and click OK.

Now that you have the IP address of the unit we can start to configure it.

Hint: If you cannot find the IP of the unit you can plug an analogue phone into one of the ports and dial *#*0 and the unit will announce it’s IP address over the receiver.

This is where the configuration starts to get buggy. We need to perform configuration steps in both the UMN and the web interface of the unit as certain features don’t work in certain interfaces. First of all we will do the configuration in the web interface. Open up your browser and type in the IP of the Unit.

Hint: the default user name is “Admin” and the default password is “1234”. you may want to change these.

Once logged in click on the SIP link at the top of the page and then click “Authentication” on the sub menu.

For index 1 of each port change the “Validate Realm” option to disabled. Click “Submit” when done. It should look like the screen shot above.

Login to your Shoreware Director web interface and create a new user (or modify an existing one). Ensure the option to “Allow use of Soft Phone” is set and select “Soft Phone” for the default phone for the user. Scroll down to the bottom of the page and enter a User name and SIP Password for the user. We have chosen to use the extension number of the user in Director as the user name to make things easier to manage. Save the User.

Now go back to UMN and expand your unit from the left hand pane. Right-click the “SIP” object and click Edit.

Uncheck the “Use DHCP” option and enter the address of the SIP server to use. This might be the IP of your SG90 or the Shared IP of multiple SG90’s with SIP proxy enabled. Unless you have an advances setup you should enter the same address for both the SIP Registrar and the SIP proxy.

Double-click the line where the value in # corresponds to the port you wish to configure. In “User name” enter the SIP user name setup earlier in ShoreWare Director. “Friendly Name” can be set to anything that will help identify the device that is connected.

While the line is highlighted click on the Authentication button.

In the user column enter the same value as the User name in the previous screen. Password should be set to the password configured earlier in Shoreware Director.

Click OK and then OK again.

Now restart the unit. This can be done by right-clicking the unit in the left hand pane and selecting “Actions > restart (Graceful)”. Once the unit if back up you can check the status of the port you have just configured by single left-clicking the SIP object from the left hand pane. In the right hand pane it will display “Registered” next to the port that you have just configured.

Hint: This took roughly five minutes on our system before the port will register. Once registered it is instant the next time the unit is restarted.

Just remember that you cannot disable realm validation from the UMN and for some reason the unit will not register ports that were configured in the web interface. Hopefully this will be fixed with the next software update.