Interoffice Extensions

I’m configuring FreePBX for use across two sites but I cannot get one extension at one site to call another extension at the other site. I have been following this guide:

The sites are connected via site-to-site VPN, which works fine. I have created an IAX2 trunk, which registers and appears healthy. I have created one extension on each PBX (1001 and 7001). I have added all networks connected via VPN to the local networks section of the SIP settings. I have made sure the SIP and IAX settings allow my codecs.

My trunk looks like this:

secret=password (changed for this post)

My outbound route looks like this (as per the docs):

But I have also tried without the +

When dialed, I get the message “Your number cannot be completed as dialed…”. The logs show:
Connected to Asterisk 13.18.5 currently running on FreePBX-Gui (pid = 11410)
== Setting global variable ‘SIPDOMAIN’ to ‘’
== Using SIP RTP Audio TOS bits 184
== Using SIP RTP Audio TOS bits 184 in TCLASS field.
== Using SIP RTP Audio CoS mark 5
– Executing [[email protected]:1] ResetCDR(“PJSIP/1001-00000007”, “”) in new stack
– Executing [[email protected]:2] NoCDR(“PJSIP/1001-00000007”, “”) in new stack
– Executing [[email protected]:3] Progress(“PJSIP/1001-00000007”, “”) in new stack
– Executing [[email protected]:4] Wait(“PJSIP/1001-00000007”, “1”) in new stack
– Executing [[email protected]:5] Playback(“PJSIP/1001-00000007”, “silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer”) in new stack
– <PJSIP/1001-00000007> Playing ‘silence/1.ulaw’ (language ‘en’)
– <PJSIP/1001-00000007> Playing ‘cannot-complete-as-dialed.ulaw’ (language ‘en’)
– <PJSIP/1001-00000007> Playing ‘check-number-dial-again.ulaw’ (language ‘en’)
– Executing [[email protected]:6] Wait(“PJSIP/1001-00000007”, “1”) in new stack
– Executing [[email protected]:7] Congestion(“PJSIP/1001-00000007”, “20”) in new stack
== Spawn extension (from-internal, 7001, 7) exited non-zero on ‘PJSIP/1001-00000007’
– Executing [[email protected]:1] Macro(“PJSIP/1001-00000007”, “hangupcall”) in new stack
– Executing [[email protected]:1] GotoIf(“PJSIP/1001-00000007”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [[email protected]:3] ExecIf(“PJSIP/1001-00000007”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [[email protected]:4] NoOp(“PJSIP/1001-00000007”, " monior file= ") in new stack
– Executing [[email protected]:5] AGI(“PJSIP/1001-00000007”, “attendedtransfer-rec-restart.php,”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/attendedtransfer-rec-restart.php
– <PJSIP/1001-00000007>AGI Script attendedtransfer-rec-restart.php completed, returning 0
– Executing [[email protected]:6] Hangup(“PJSIP/1001-00000007”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 6) exited non-zero on ‘PJSIP/1001-00000007’ in macro ‘hangupcall’
== Spawn extension (from-internal, h, 1) exited non-zero on ‘PJSIP/1001-00000007’

There is nothing in the logs of the other PBX.

I’m not sure what’s going wrong - any hints what else I should be checking?

I e never done specific thing before however reading your post, first thing to mind is if you created an outbound route that terminates to that trunk.

Thanks for the response frankb - I think so, but I’m not very good at dialplans. I have this:

And this for the dilplan:

Does that look ok?


Upon installation, I was offered the Extension Routing module for free if I registered the install, which I did. Unbeknownst to me, for better or worse, this blocks all extensions from using any outbound routes unless specifically enabled in the Outbound Route’s Additional Settings tab. I disabled the extension because I can’t be manually enabling every new extension across all outbound routes.

I also did’t recognize that corresponding inbound settings are required on the trunk on each side - the wiki article does not mention this. Another guide that I found is better in that respect:

Now those issues are fixed the extensions can reach each other, but no audio is sent in either direction by either extension, so that’s my next hurdle. Any tips on what could cause that?

I have not been able to resolve my “no audio” issues. After googling, it looks like running an IAX trunk over an openvpn connection with different subnets at each end is problematic - the recommendation is to use SIP trunks instead.

What is the recommended way of setting up a pjsip trunk between two FreePBX servers for interoffice extension use? I’ve tested some configurations, but I am getting

Reload failed because retrieve_conf encountered an error: 255
exit: 255

when trying to apply the settings, with no further information in any of the logs. I was not able to find any good examples of such a configuration.

Almost every time I have had a no audio issue it had been caused by the NAT someway or another. I don’t know if that is common in general, but it has definitely happened to me on quite a few new installs.

Both of these points (in my experience) are true.

I’m pretty sure that IAX2 requires the connected phone to be on the same subnet as the server when served through a VPN. The good news is that IAX2 doesn’t require a VPN, so you could try moving the IAX2 part of the connection out of the VPN.

Thanks all. Yes, lack of audio is usually NAT related, I’ve had the same experiences.

We already have the VPNs between the sites set up, so I would prefer just to use a trunk over the VPN connection. I’m happy to use SIP rather than IAX2 (which we are already using in another set up), but I was hoping to be able to set it up using PJSIP instead of Chan SIP. I’ve found a few guides on how to convert the configs from Chan SIP to PJSIP, but they are all for registering trunks with VOIP providers or phones, not interoffice trunks.

Since your VPN is working, and IAX2 has problems crossing the VPN, using SIP would certainly be a good test to see if you can get this working.

I’ve tested this with chan_sip, it works fine. Was hoping to use pjsip but can’t fund any useful documentation for setting up such a trunk.

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