Mitel 5000 / Asterisk Integration

Mitel 5000 to Free PBX (Asterisk) Trunk
The first dependency is to have licensing for the number of SIP trunks you would like to create on the Mitel 5000 system. We will be creating a SIP Trunk Group that will require these trunk licences. Each trunk needs a license at the cost of something like $125 a piece for small quantities.
The Mitel 5000:
First, go into System–>Devices and Features–>SIP Peers–>SIP Trunk Groups
Create a SIP trunk Group with just a single extension number. It will probably be something like 9200X. Mine was 92003 but yours could end up being different. Open up the configuration and edit the settings. My configuration looks like this:

The main thing here is just the IP address of the remote system. You are also going to need to go into the authentication options and enter an incoming and outgoing usernames and passwords.

Edit the call configuration for this trunk. Do this at:
System–>IP-Related Information–>Call Configurations
Create a new configuration. You will want to set DTMF Encoding to RFC2833 and Speech Encoding to G.729.

That’s about it for the Mitel side of the trunk. Let’s now jump to FreePBX and configure the trunk on that side.
My trunk settings are as follows:

Name: mitel-a

User Context: from-mitel-a



You can now test your calling from the Mitel system to the asterisk system by dialing the SIP trunk group number (9200X from above) then a valid extension on the Asterisk. (This setup does not require you to read DIDs off the asterisk side but the Mitel does; more on this in just a bit.) The call should go through. If it does not work verify the call is arriving on the trunk by using the asterisk command shell: asterisk –r

Once you have the call going through from Mitel to Asterisk with the manual trunk dial it is time to add the trunk to the ARS (Automatic Route Selection) table. Get into the numbering plan at: System/Numbering Plan.
Create a new Route Group. Call it something like SIP Trunk Internal. Be warned you can screw up your calling if you not sure what you’re doing… I warned you… Remember the route groups are processed in the order they are listed. The SIP group has to be first to collect a more specific pattern of digits than the other groups. My patterns are as shown below:

The Mitel uses typical pattern matching.
As you can see, I am sending all of the 3000s, 4000s, 5000-6999, and the 8675309 number out the trunk to the asterisk system.
We now have to go to Facility Groups, also under the numbering plan, and create a new group there as well. Facility Groups typically start with a “P” in their extension numbering. Under dial rules in your new Facility Group you will need at least rule number 3 and 4 for typical calling. The Trunk Groups/Nodes category will need to have the SIP Trunk Group added to it. Finally, go back to your Route Group you created a bit ago and add the new Facility Group there.
Since all of that sounds very confusing to someone no-so-familiar with Mitel (as I was when I started this…) I will attempt to explain it all in terms of how the call traverses the groups.
Mitel Extension dials out (with 8 for ARS) –> the call hits route group –> “Yes, the destination phone number matches one of our patterns!” –> Send the call to the facility group defined for this Route Group –> The call will go out the first available trunk listed in the Facility Group.
At this point you should ensure you can call out with “8” and the 4 digit extension on the Asterisk system. Asterisk, however, is a little more flexible and does not require a dialing prefix.

To finish up your FreePBX / Asterisk configuration you will need to do something fairly similar just with a different user interface. We are going to want to create an outgoing route in Asterisk. Simple create a new outbound route and configure it as shown below. The extensions on my Mitel system are in the 2000’s, 2100’s and 2200’s. Yours may be different of course. Be sure to specify a trunk for this rule to use at the bottom then!

At this point we should be able to leave our Asterisk system. The final piece is handling incoming calls on the 5000. SIP configuration on the Mitel 5000 is only going to see a SIP trunk as if it were coming from a CO. Basically what we need to do is run the incoming calls through a routing table like we would with any other CO trunk. Yes, this is a little bit of a hack because of the limits of the 5000. It works and actually increases your flexibility though if you care to be positive…

Go into:
System –> Devices and Feature Codes –>SIP Peers –> Your SIP trunk Group –> Trunk Group Configuration
You should see something like the image below.

We want to change the Ring-In Types. Change the value to Call Routing Table and then select a new call routing table (I chose 2). Go then and edit that call routing table to suite your needs. My table can be seen below. As you can see my table is a one to one match as far as patterns to extensions. This makes it fairly easy to keep track of everyone’s number but you can get creative if you would like…

If you routing table turns out to be a one to one match like mine I would actually suggest an even simpler approach. Change the “Ring-in Type” field to be “Collected Digits” This simply takes the destination digits and preserves them as the call enters into the system. So in the call coming in on the trunk is destin for “2000” the collected digits will be preserved and extension “2000” will ring.

A few settings worth tweaking on the Mitel side are the dial timers. The two I looked at are the “inter digit” long and short timers. These are found at:
System–> Timers and Limits
These dictate the time it takes for the dialed digits to be sent. I shortened the “Long” timer so that when we dialed “8” for ARS and then dial a four digit number, for instance, it doesn’t take forever to commit the number and dial SIP trunk.

That’s about it (I say that as if that whole process was simple). I will be posting troubleshooting tips in the near future to help anyone who is tweaking settings or having trouble getting this to work.

This entry was posted in Networking, Telephony and tagged , , , . Bookmark the permalink.

12 Responses to Mitel 5000 / Asterisk Integration

  1. Jake says:

    This guide was quite helpful on a project I’m working on (trying to get Lync to communicate with my Mitel 5000)… between this and a couple other guides, I’ve managed to get 90% of the way there. The one component I’m missing is being able to initial a call to the outside world from Asterisk. Is this a problem you’ve solved or are your Asterisk extensions only able to dial internal DNs?

    • schaeffer says:

      This is very possible but the actual configuration will vary wildly since every call routing situation is different. I would do some reading on the Asterisk dial plan to get this ironed out. Also, is you log into the terminal on the asterisk box and do an asterisk -r to see the dial plan as its processed that could be very helpful.

    • TBurton says:

      How did your project turn out? I am trying to connect Lync to Mitel5000 also. (Not a lot of help out there for this)

      • schaeffer says:

        I would love to write some stuff about Lync and the Mitel. If anyone has a Mitel system laying around I would be glad to accept it and do a ton of how toos in that regard!

        • TBurton says:

          If you guys find any documentation for the Mitel 5000 CP and Microsoft Lync 2010 I would be surprised. Jake how did your project turn out? Schaeffer have you found anything else out there speaking to the Mitel 5000 CP integration with MS Lync 2010 or 2013?

          • schaeffer says:

            I have not… Still trying to get my hands on a Mitel 5000 to hack at. Watch the SIP messages with wireshark / watch the log files is about all I can say still at this point…

  2. Mark says:

    schaeffer, I rolled this out and it works great.
    Thanks for taking the time to write and post this.
    I shall refer to you in the future as ZEN MASTER!

  3. Luis says:

    I use this guide to config asterisk with mitel 3300 and works perfect.
    But I need help on the caller ID, when an extension from mitel calls to a extension on asterisk always shows the extension number that we created and use as credentials to connect the mitel to asterisk.

    If asterisk extension call a mitel extension the caller Id from pass without issues, the problem is calling from mitel to asterisk.

    Any suggestion how to fix this issue?

  4. Corey Gashlin says:

    I was unable to get this working on my 5000. It does nothing. I check my asterisk and it does not show the trunk being registered. Perhaps I am doing something wrong in my Mitel. It is as the Mitel is not even reaching out to the Asterisk system.

    • Schaeffer says:

      Sorry Corey, I don’t have one of these systems to experiment with anymore… I would review the logs on the Mitel / Asterisk and see if you see errors. Something will be logged particularly if your making test calls that time out.

Leave a Reply to Corey Gashlin Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.