UPDATE: 3CX version 18 has discontinued Exchange voicemail support.
The steps outlined in this article will enable 3CX v18 to work with Exchange UM voicemail!

The Problem

A client needs to be able to use two different voicemail systems simultaneously on the 3CX phone system.


3CX has two mutually exclusive choices for voicemail:

  1. Use the internal voicemail system.  This is enabled by default and works great.
  2. Use Exchange Server for voicemail (this is enabled by a simple check box) and also works great!

But what if a client needs some users on one voicemail system and other users elsewhere?  This scenario happened recently when a client acquired another organization and wanted to bring the new staff into the same PBX, but not the same voicemail system.

If the Exchange checkbox is chosen then 3CX voicemail will no longer function, you can’t use both.  When that checkbox is selected, 3CX creates a SIP trunk in the background with a few unique properties.  Most of these can be replicated with a standard SIP trunk, but not all!

  1. Uses TCP for transport.  This works on a standard SIP trunk!
  2. Requires using port 5065.  This works on a standard SIP trunk!
  3. Requires a diversion header to be sent so that Exchange knows which mailbox to send the message to.  This CANNOT be done on a standard SIP trunk!

The diversion header is simple, it’s a single line that indicates the extension of the mailbox.  Exchange requires the following for extension 101.

Diversion: <tel:101>;reason=user-busy;screen=no;privacy=off


The Solution

Since we could not alter the behavior of the SIP trunk to include the diversion header, we decided to bounce the call off of a device that has great flexibility for handling SIP manipulation – an Adtran router!  We love using Adtrans as voice gateways because they are rock solid, flexible, inexpensive and ubiquitous.  We typically use the Total Access 924E which has a pair of PRI ports, 24 FXS ports and functions as a Session Border Controller (SBC) that bridges between TSPs and the PBXs.  Here are the steps:

  1. 3CX
    • First create a SIP trunk in 3CX that points to the Adtran.
    • Then create an outbound rule to point to the new trunk.  For example we used 8XXX.
    • On the extensions, point unanswered calls to a number matching the outbound rule.  Extension 101 would point to 8101.
  2. Adtran
    • In the Adtran create a SIP trunk and trunk group for 3CX to receive calls.
    • Also create a SIP trunk and trunk group for Exchange.
    • On the SIP trunk for Exchange add a Header Manipulation Rule (HMR) that will add the diversion header required.
  3. Exchange
    • Complete the Exchange side of the SIP trunk by adding the IP address of the Adtran to the UM IP gateways

Below are the relevant portions of the Adtran config.

voice trunk T01 type sip
   description "3CX"
   sip-server primary

voice grouped-trunk 3CX
   trunk T01
   accept 1XX cost 0

voice trunk T02 type sip
   description "Exchange"
   match dnis "8XXX" substitute "XXX"
   sip-server primary tcp 5065
   hmr ExchangeFix out

voice grouped-trunk EXCHANGE
   trunk T02
   accept 8XXX cost 0

hmr policy ExchangeFix
   rule-set ExchangeFix 10

hmr rule-set ExchangeFix
   message-rule Diversion message-type any 100
      match header to
      set private-variable mailbox header to position first match-value /.*sip:(\d{3})(.*)/ new-value /\1/ 10
      add header diversion position last new-value <tel:%private.mailbox%>;reason=user-busy;screen=no;privacy=off 20

The Results

Both 3CX and Exchange voicemail systems can now be used simultaneously!  To change an extension from 3CX to Exchange voicemail, simply point the forwarding rules for no answer to the Exchange extension.

The diversion header is there!