FreePBX to Adtran PRI to Mitel SX-200


I have FreePBX setup and I am trying to connect my Mitel SX-200 to FreePBX so we can do 4 digit dialing and use our Vitelity sip trunks we have setup on the FreePBX, and get rid of our POTs lines on the Mitel.

I have an Adtran 924e Gen 2 that I am using for this. I believe I have the Adtran unit setup correctly but I am having trouble getting it to connect to FreePBX.

When I try to make an outbound call from the Mitel to my cell phone I get “The number you have dialed is not in service…”

Here is the output I am receiving from asterisk (note xxxxxxx is my cell phone number that I have replaced for security purposes):

== Setting global variable ‘SIPDOMAIN’ to ‘’
– Executing [[email protected]:1] NoOp(“PJSIP/anonymous-00000001”, “Received incoming SIP connection from unknown peer to 0009xxxxxxx”) in new stack
– Executing [[email protected]:2] Set(“PJSIP/anonymous-00000001”, “DID=0009xxxxxxx”) in new stack
– Executing [[email protected]:3] Goto(“PJSIP/anonymous-00000001”, “s,1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [[email protected]:1] GotoIf(“PJSIP/anonymous-00000001”, “1?setlanguage:checkanon”) in new stack
– Goto (from-sip-external,s,2)
– Executing [[email protected]:2] Set(“PJSIP/anonymous-00000001”, “CHANNEL(language)=en”) in new stack
– Executing [[email protected]:3] GotoIf(“PJSIP/anonymous-00000001”, “1?noanonymous”) in new stack
– Goto (from-sip-external,s,5)
– Executing [[email protected]:5] Set(“PJSIP/anonymous-00000001”, “TIMEOUT(absolute)=15”) in new stack
– Channel will hangup at 2019-08-25 23:14:58.937 EDT.
[2019-08-25 23:14:43] WARNING[30130][C-00000001]: func_channel.c:460 func_channel_read: Unknown or unavailable item requested: ‘recvip’
– Executing [[email protected]:6] Log(“PJSIP/anonymous-00000001”, "WARNING,"Rejecting unknown SIP connection from “”) in new stack
[2019-08-25 23:14:43] WARNING[30130][C-00000001]: Ext. s:6 @ from-sip-external: "Rejecting unknown SIP connection from "
– Executing [[email protected]:7] Answer(“PJSIP/anonymous-00000001”, “”) in new stack
– Executing [[email protected]:8] Wait(“PJSIP/anonymous-00000001”, “2”) in new stack
– Executing [[email protected]:9] Playback(“PJSIP/anonymous-00000001”, “ss-noservice”) in new stack
– <PJSIP/anonymous-00000001> Playing ‘ss-noservice.ulaw’ (language ‘en’)
– Executing [[email protected]:1] Hangup(“PJSIP/anonymous-00000001”, “”) in new stack
== Spawn extension (from-sip-external, h, 1) exited non-zero on ‘PJSIP/anonymous-00000001’

The sip trunk from the FreePBX to the Adtran is configured as:
Outbound Settings:
Trunk Name: PRI_Trunk_Mitel

Peer Details:
host= (Adtran IP)

All inbound settings are blank.

Can someone help point me in the right direction? I have never created a sip trunk between two devices before, only between a PBX and a VOIP carrier.


Recent versions of FreePBX / Asterisk have two SIP drivers: pjsip and chan_sip. By default, pjsip is considered primary and listens on port 5060; chan_sip listens on 5160.

The immediate issue is that you set up the Adtran trunk as chan_sip, but the device is connecting to Asterisk on port 5060, so it goes to the pjsip driver which doesn’t recognize it. You should either configure the Adtran to connect to port 5160, or change the pjsip “port to listen on” and chan_sip “bind port”. However, if you do the latter, you’ll also have to change any other devices (extensions or trunks) to agree with the new settings. A third possibility is changing the Adtran trunk to use pjsip.

Once you get past that, the 0009xxxxxxx won’t be recognized by the default from-trunk context, so you’ll need to add
(or some special context) to the Peer Details of the Adtran Trunk.

Then, the number 0009xxxxxxx will likely not be recognized by your Outbound Routes, so you’ll need a route that translates that number into a format that Vitelity will accept. For example, if your area code is 212, you could use:
Prepend: 1212
Prefix: 0009
Match Pattern: NXXXXXX

You may need to change some settings so calls from the Mitel send the proper outbound caller ID.

Last, but certainly not least, add appropriate routing for 911. You will probably want to route 811 (Vitelity’s test number for emergency calling) the same as 911, so you can do thorough testing without actually calling 911.


Thank you for your help! I have it working now. I changed the port to 5160 on the Adtran and updated some of the ARS programming in the Mitel to make it stop sending 000 (that’s supposed to make the Mitel do some fancy footwork, but instead it was acutally sending the zero’s). It now works perfectly.

Thanks again!



Thanks for your help so far on this!

I had it working for a couple of days and has now stopped working. When trying to dial from the Mitel to FreePBX I get a busy signal and the following error message:

[2019-08-29 21:17:50] WARNING[9401][C-00000013]: chan_sip.c:17266 check_auth: username mismatch, have <5001>, digest has <>
[2019-08-29 21:17:50] NOTICE[9401][C-00000013]: chan_sip.c:26364 handle_request_invite: Failed to authenticate device "BEDSIDE" <sip:[email protected]:5160;transport=UDP>;tag=52b8a68-7f000001-13c4-e6a7d-cef3a76d-e6a7d

5001 is one of the FXS ports that is on the Adtran that I also have registered to the FreePBX. The FXS ports are working correctly. However, the PRI is now giving me the above message. The only way that I have been able to fix this is to delete both the trunk and outbound route from FreePBX and then recreate them. Once I do that it seems to work for a day or so before it starts throwing this error again.

Below is the config of the trunk in FreePBX:
General Tab:
Trunk Name: Mitel
Hide Caller ID: No
Outbound Caller ID: “out” (main DID)
CID Options: Allow Any CID
Max Channels: (blank)
Asterisk Trunk Dial Options: T (system)
Continue if busy: No
Disable Trunk: No
Monitor Trunk Failures: No

Dialed Number Manipulation Rules:
I have a couple of rules to convert DIDs to 4 digits from 10

SIP Settings Tab:
Outgoing Tab:
Trunk Name: PRI_to_Mitel
Peer Details:

Incoming tab is all blank.

Hoping someone will be able to help with this. I have the trunks in FreePBX setup as CHAN_SIP and the extensions that the FXS ports are registering to are also using CHAN_SIP. If it would be better to convert everything over to PJSIP I am happy to do so, but I may need a little guidance on what settings to use as I was not able to figure it out when I tried the other day.


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.