Calling inbound routes without going out via an outbound trunk?

So i’ve noticed that when I call a DID that has been defined in an inbound route, my system first dials out over an outbound trunk (in this particular case a pri) and back in again to reach the inbound route.

This makes no sense to me, why would FreePBX not simply realize the DID you are calling is local and send you right into the inbound route directly?

I’d like to modify the code/extensions_additional.conf to include ext-did as one of the local context includes, but I figured i’d post the question here to figure out if there is some bigger reason for this, or an easier way to enable it?

voxter

As far as I know the inbound route DID setting only checks when a call is coming in.
You can hard code that sort of thing by creating an extension with the same number and routing it however you want.

Im sure there are multitudes of workarounds, it just doesnt seem to make much sense to me that ext-did is not included in from-internal to begin with. I dont see any upside to calling out a trunk and back in to reach a number local to you, nor a downside to including your own DID’s in the local dial plan?

The easiest way to make this happen (and I don’t know which versions of FreePBX this is available in, but it works in 2.9), is to specify both contexts:

context=from-trunk&outbound-allroutes

This will effectively make it act like both an outbound trunk and an inbound trunk.

Don’t expect this to work in vanilla Asterisk, because it probably won’t. But it definitely works in FreePBX.

Btw…fwiw, I wouldn’t want inbound routes to automatically be included in the from-internal context. Often times you’ll have extensions that you’ll want to have very limited access to the dialplan from; i.e. only 911 for customers that haven’t paid their bills