[asterisk-users] [OT-FreePBX] Outbound calls check inbound routes to see if destination is local?

A J Stiles asterisk_list at earthshod.co.uk
Thu Sep 16 11:32:51 CDT 2010


On Thursday 16 Sep 2010, Tim Nelson wrote:
> I have a system running Asterisk 1.4.27 (see... relevance!!!) and FreePBX
> 2.6.0. There are a large number of inbound routes configured for the
> various DID's coming in via PRI, SIP, etc. If a user calls outbound to one
> of these numbers, it goes out to the PSTN (using one channel of $0.0x/min),
> then comes back in on another channel (using another $0.0x/min).
>
> Obviously, the one call is costing 2x the per minute rate when it could be
> costing nothing. Is there a way to tell FreePBX to check the inbound routes
> for a match, and if found, route locally instead of using the default PSTN
> routes?

Create a context to use as the default for any extension which can do 
a "straight through" call  (i.e. not via the PSTN);  and which routes calls 
that can be routed straight through, straight through.

Include within this, a second context for extensions which need to go out via 
the PSTN.

Have a third context for incoming calls from the PSTN, with all "inside" 
extensions in it.  Optionally include the out-via-pstn context within this; 
although, logically, if someone arrived via the PSTN, they already have PSTN 
access and so should not need to go back out via the PSTN.

Note that when an extension could match one of several possible targets, 
Asterisk always prefers the most specific  (hardest to match)  over the 
vaguest.

So you should have something like this  (very very minimal example);

[in-via-pstn]
include=>internal-phones
exten=>00.,1,Play(int-barred)
.
.
.
[straight-through]
exten=>012345678[89][0-9],1,Dial(SIP/2${EXTEN}:9)
include=>internal-phones
include=>out-via-pstn
.
.
.
[internal-phones]
exten=>[2-6]XX,1,Dial(SIP/${EXTEN})
.
.
.
[out-via-pstn]
exten=>0[123]XX.,1,Dial(${TRUNK}/${EXTEN})
exten=>07XX.,1,Dial(${MOBILES}/${EXTEN})

-- 
AJS



More information about the asterisk-users mailing list