Dialling DID from internal

Hi all,

As from what I’ve experienced, FreePBX usually sends calls to DIDs (external numbers) dialled internally out a Trunk if the pattern matches.
If you want to keep this kind of calls local, how do you usually do this?

  • Create outbound routes with matching patterns and an (internal) Trunk for this
  • (Manually) include ext-did in the internal context (from-internal)
    My problem is that the patterns to match (and the patterns / rules to change the number from external to internal) are becoming a bit complicated with my installation…

Or should I post a feature request to include this functionality configurable in FreePBX?

Thanks,
Philipp

Do you mean restrict?

cosmicwombat,

Sorry, my OP might have been unclear: (And sorry for my bad english)
I’m not talking about restricting calls. This is about what happens if an internal user dials an external number (as configured as a DID or inbound route).
Usually, the external number dialled would match to be dialled out using a Trunk, but I want the FreePBX/Asterisk to go to the part of the dialplan where external numbers are being processed.
(Is this a bit clearer now?)

If I’m interpreting this correctly, what you mean is that when one of your internal users dials one of your PSTN telephone numbers, you do not want the call to go out to a provider and then come back - you want it to stay internal. I can think of a couple ways that MIGHT work although I have not tested either - let me know if one works for you.

The first is to simply create Misc Applications with the “Feature Code” being the same as the PSTN number, then make the destination your IVR or wherever you’d send an incoming call. This would (hopefully) work well if you only had a few numbers.

The second would be to create a new outbound route in which you’d include ONLY your PSTN numbers. Put it above (higher in priority than) your other routes that handle outgoing calls. Send it to a CUSTOM trunk, and make the destination of the custom trunk Local/[email protected] (Note I’m guessing here - I THINK that will work but I’m not entirely sure. Also note that for this to have any chance of working, the number dialed must match one of your DID’s exactly, or if necessary you can strip or add digits at the route or trunk level so it does match your DID exactly).

If you try either of these, let us know if they work.

Thanks for the input, wiseoldowl.

Yeah, you got it correctly: I don’t want calls to go out to a provider (and then come back) when one of my internal users dials one of my PSTN telephone numbers. The call should be fully handled by my internal dialplan - to stay internal / on my Asterisk/FreePBX box.

What I’m currently doing is - as described as the second way - using an Outbound route (which matches my PSTN numbers and is configured as the route with the highest priority and “Intra Company”) and a custom trunk (which uses “Local/[email protected]” as the dial string and will strip off/replace parts of the PSTN numbers in order to “convert” it to a local/internal numer).
That works fine if you just have to replace / strip of some parts of the PSTN numbers, but if you have more complicated replacement rules, that won’t work.
Additionally, you’ll be only able to dial PSTN numbers configured as a user’s direct DID, if you have an inbound route going, e.g. to a day/night “switch” which has no internal number, that won’t work.
The Misc application way to do this seems not feasible because I have quite a lot of PSTN numbers.
And also, you will possibly run into problems if you make changes to the dialplan, e.g. when you change a DID/extension “mapping”, the you’ll have to also change the corresponding MiscApp.

And since all the dialplan logic for handling the PSTN numbers is already there in [ext-did], I really would like to use this in some way…

Can you give us an example of one of your “more complicated” replacement rules? You can do quite a bit at the trunk level if you think about what you want to do.

Also, probably a dumb question, but did you try using Local/[email protected] (in your custom trunk) and if so, what happened?

Don’t forget that you can always put a bit of custom dialplan (that you write yourself) in extensions_custom.conf to change the numbers as you need, then send the call on to from-trunk (or wherever), then send your custom trunk to that custom context instead of from-trunk.

One other tip (regarding the first method I suggested), you can use patterns rather than individual numbers in Misc Applications, by using the underscore prefix (for example _55523XX to match any number from 555-2300 through 555-2399). Don’t know if that would help you any. I’m not sure why the time conditions aren’t showing up as possible destinations under Misc Applications, although I’ve never set up any time conditions so I may not understand quite how they work.

Guys -

Its been a while since I had this but recall way back in [email protected], I had the context for the DID’s ( from-did? )included in one of the other contexts and was able to achieve what pwalker is requesting. Its been too long for me to remember exactly how I did this but does it ring a bell with anyone?

I don’t use prefixed (i.e. “Dial 9”) outbound dialing so this worked out quite nicely in my system. I just don’t remember how I managed it before and don’t have it now.

This method is very much like what phillip originally mentions.

I have configured my ddi numbers at e164.org and chosen enum as my first choice trunk.
Dialing the ddi number gets translated into the sip url which maps back to the PABX.
Works very well.
E164 is free to use and also allows others to call you directly using a sip url instead of calling via a pstn provider :slight_smile:

HTH
Mike

Hi Mike,

I’m facing a problem with a similar set-up to yours (more details at http://www.freepbx.org/forum/freepbx/general-help/problem-with-enum-freepbx-and-asterisk)

How did you set up the trunk as the ‘first choice trunk’? Currently I have an outbound route directing calls to an ENUM trunk, but it seems that when my PBX gets the sip uri from the enum server, it tries to make another call when the uri (the part after the @) actually indicates the PBX itself. What am I doing wrong?

Thanks!