[asterisk-users] Re: Match a Numer - then continue with dialplan

Douglas Garstang dgarstang at oneeighty.com
Wed Dec 20 12:16:45 MST 2006


> -----Original Message-----
> From: Tony Mountifield [mailto:tony at softins.clara.co.uk]
> Sent: Wednesday, December 20, 2006 11:47 AM
> To: asterisk-users at lists.digium.com
> Subject: [asterisk-users] Re: Match a Numer - then continue with
> dialplan
> 
> 
> In article 
> <645FEC31A18FE54A8721500CDD55A7B60350769C at mail.oneeighty.com>,
> Douglas Garstang <dgarstang at oneeighty.com> wrote:
> > 
> > Don't get offended Doug, but I get really frustrated when I 
> try to explain what I am trying
> > to do with Asterisk, and people don't seem to quite get it. 
> Your about the 4th person who's
> > replied to this post, and hasn't quite grasped my question. 
> :) <--- smiley.. see...we're all
> > cool.
> 
> Perhaps its the terminology you used that is confusing 
> people. See below:
> 
> > I don't want Asterisk to go on to ask for more digits. I 
> want to do a very simple thing. I
> > want to set a variable when call flow continues beyond a 
> certain point (without asking the
> > user for more digits), and then continue on, and use that 
> variable later. It's a very simple
> > thing, I can't work out why Asterisk doesn't let me do that.
> 
> To almost all people "call flow" would mean executing one 
> priority after
> another for a given extension.
> 
> After reading and re-reading your posts trying to work out 
> what you are
> trying to do, it seems to me that when *you* say "call flow", 
> you mean the
> act of trying to find an extension. And what your looking for 
> is a way to
> do things a different points in the *search*, while it is 
> still trying to
> decide on a statement to land on. Is that correct?
> 
> If so, I think you need to re-think the strategy a bit. The only way a
> command gets executed in a dialplan is when Asterisk has 
> matched an extension
> and a priority. Then once it has executed that command, it 
> increments the
> priority (unless it was a Goto or something) and starts 
> searching again.
> 
> However, don't forget that it searches for matching 
> extensions every time
> the priority changes. You are not locked into a particular pattern or
> extension number from priority 1 onwards. You can mix and 
> match patterns
> with literal extensions, even across includes, e.g.
> 
> [example]
> include => ctx31X
> include => ctx3XX
> 
> exten => _X.,1,NoOp(this gets executed first for everything)
> exten => _X.,2,NoOp(this gets executed second only if ctx31X 
> or ctx3XX didnt match)
> exten => _X.,3,NoOp(this gets executed third for everything)
> 
> [ctx31X]
> exten => _31X,2,NoOp(this gets executed second for 310-319)
> 
> [ctx3XX]
> exten => _3XX,2,NoOp(this gets executed second for 300-309 
> and 320-399)
> 
> So you might be able to do something along these lines by 
> being creative
> with priorities and includes, and setting or testing 
> variables. Something
> along these lines:
> 
> 1. Each company starts off in its own context, and at 
> priority 1 in _X. it
> sets a variable like SRCCOMPANY to something specific to it.
> It includes all the destination contexts.

I think that's the deal breaker right there. I can't start a company within an extension. The starting point for each phone within a company needs to make extensive use of the include=> directive. Features will be disabled by default, so there will be a list of includes to block unpurchased features. Then we'll include contexts for 911, voicemail retrieval and general numbers, ie:

[coo1_CallStart]
include => syst_FeaturePersonalMeetmeBlock
include => syst_FeatureIntercomBlock
include => syst_FeatureIDDBlock
include => syst_Emergency
include => syst_VMRetrieve
include => coo1_General 
include => syst_GeneralInternal
include => syst_ExportedApps
include => syst_Route

Finally, when we're finished scanning for blocked services, and asterisk terminated extensions, we try to route the call from this phone to the destination number, either OnNet or OffNet. That's where syst_Route comes in.

For managability, we have to use lots of includes. We can't have our entire dialplan as one big _X. extension match.


More information about the asterisk-users mailing list