Cannot call DIDs hosted on same PBX

I’m running Asterisk 11.7.0 on FreePBX version 2.11.0.43. I’ve tested this on newer and older versions of Asterisk/FreePBX with the same results. I’ve tried this with both hosted and premise based boxes. Each tested PBX has its own dedicated static, routable IP that is NATed to an internal IP. Ports 5060 and 10000-20000 are open to the world.

The issue is that when we call an external number that is hosted on the same PBX as the number that is being called, we receive the ringing on the called phone, but there is no audio when the call is answered in either direction. This was not a problem until recently when our SIP provider made a change to the way they handle routing.

Previously, if a call was made it would be passed out of the trunk to our SIP provider, the provider would set up the call to a media gateway, then that media gateway would pass the traffic back to the PBX. Now, the provider recognizes that the DID is hosted on their system and passes the traffic back to the originating IP, completely circumventing the media gateway (and the associated cost).

I’ve looked at our firewall, as I assumed this was a NAT no audio issue, but all of the rules appear to be correct and I’m not seeing anything being blocked in the firewall logs.

Trunk settings are here:

type=friend
qualify=yes
progressinband=no
insecure=very
host=xx.xx.xx.xx
dtmfmode=auto
disallow=all
context=trunk-in-strip1-custom
canreinvite=no
allow=ulaw

Any advice is greatly appreciated.

It could be achieved more cheaply by routing such calls to a trunk you build to localhost.

@dicko: I’m trying to setup a loopback trunk, but I cannot seem to get it to work. I’ve set the trunk peer as 127.0.0.1 and put the internal numbers in the dial plan for the trunk and outbound route. I’ve looked for articles on how to do this, but the few that I’ve found point to dead links.

Show us your configuration, trunk and routes.

For a loopback trunk, use a trunk of type “custom” with a dialstring of:

local/$OUTNUM$@from-trunk

Thanks. I think I got it figured out. I had to add 127.0.0.1 as a local network in Asterisk SIP Settings.

Is there a more elegant way of being able to have 7 and 10 digit dialing to the same number? In my testing I see I’m having to enter 2 entries for each DID. 1 for 10 digits and the other for 7 digits with a prepended area code. Our PBX is setup to automatically prepend our local area code for 7 digit dialing, but if I enter the full 10 digits in the outbound route, then only dial 7 digits, it doesn’t work.

In the “Dialed Number Manipulation Rules” of the trunk.