Douglas Garstang
2006-Dec-19 14:45 UTC
[asterisk-users] Match a Numer - then continue with dialplan
Anyone know if there's a way to match a dialplan extension, execute some code, say set a variable, and then continue with the dialplan? I want to set a variable when the dialplan flows beyond a certain context. This would be a great feature. Doug.
David Thomas
2006-Dec-19 15:01 UTC
[asterisk-users] Match a Numer - then continue with dialplan
On 12/19/06, Douglas Garstang <dgarstang@oneeighty.com> wrote:> Anyone know if there's a way to match a dialplan extension, execute some code, say set a variable, and then continue with the dialplan? > > I want to set a variable when the dialplan flows beyond a certain context. This would be a great feature. > > Doug.Have you tried using the SetVar cmd? I haven't tried it but it sounds like it might work for this. http://www.voip-info.org/wiki/view/Asterisk+variables Regards, David
Douglas Garstang
2006-Dec-19 15:04 UTC
[asterisk-users] Match a Numer - then continue with dialplan
I just know someone is going to ask 'why would you ever want to do that?'. Here's my answer. We have two companies, each with a dialplan similar to what's below. In the event that the number being dialled does not match any number within our OWN company, we want to set the caller id to be a generic one for the company, NOT one for the user. This is a pretty normal requirement that most companies want. So, in the event that the logic flows beyond coo1_OnNet, we want to reset the caller id of say, 3254001 <Doug>, to 3254000 <Widgets Inc>. If there was a way to match against a number in the dialplan, and then continue execution after that point, we could put this statement at the end of the coo1_OnNet context and it would all be sweet. Without that, I don't have a clue how to do this... unless we stick with out current 3,000 line python script. [coo1_CallStart] include => coo1_OnNet include => syst_OnNet include => syst_OffNet [coo1_OnNet] exten => 3254101,1,Dial(SIP/3254101,20,tr) exten => 3254102,1,Dial(SIP/3254102,20,tr) exten => 3254103,1,Dial(SIP/3254103,20,tr) exten => 1000,1,Answer exten => 1000,2,Wait(1) exten => 1000,3,NoOp(${FOO}) [syst_OnNet] include => coo1_OnNet include => coo2_OnNet [syst_OffNet] exten => _X.,1,Dial(SIP/11${EXTEN}@pstngw1,180,tr) ~> -----Original Message----- > From: Douglas Garstang > Sent: Tuesday, December 19, 2006 2:46 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: [asterisk-users] Match a Numer - then continue with dialplan > > > Anyone know if there's a way to match a dialplan extension, > execute some code, say set a variable, and then continue with > the dialplan? > > I want to set a variable when the dialplan flows beyond a > certain context. This would be a great feature. > > Doug. > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
Douglas Garstang
2006-Dec-19 15:15 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: David Thomas [mailto:punknow@gmail.com] > Sent: Tuesday, December 19, 2006 3:01 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Match a Numer - then continue with > dialplan > > > On 12/19/06, Douglas Garstang <dgarstang@oneeighty.com> wrote: > > Anyone know if there's a way to match a dialplan extension, > execute some code, say set a variable, and then continue with > the dialplan? > > > > I want to set a variable when the dialplan flows beyond a > certain context. This would be a great feature. > > > > Doug. > > Have you tried using the SetVar cmd? I haven't tried it but it sounds > like it might work for this. > > http://www.voip-info.org/wiki/view/Asterisk+variables > > Regards, > DavidDavid, If I call setvar, my variable will be set, but dialplan processing will stop...
Watkins, Bradley
2006-Dec-19 16:16 UTC
[asterisk-users] Match a Numer - then continue with dialplan
Please correct me if I'm misunderstanding your requirements, but see below (inline) for what I would do:> -----Original Message----- > From: asterisk-users-bounces@lists.digium.com > [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of > Douglas Garstang > Sent: Tuesday, December 19, 2006 5:04 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: RE: [asterisk-users] Match a Numer - then continue > with dialplan > > I just know someone is going to ask 'why would you ever want > to do that?'. Here's my answer. > > We have two companies, each with a dialplan similar to what's > below. In the event that the number being dialled does not > match any number within our OWN company, we want to set the > caller id to be a generic one for the company, NOT one for > the user. This is a pretty normal requirement that most > companies want. So, in the event that the logic flows beyond > coo1_OnNet, we want to reset the caller id of say, 3254001 > <Doug>, to 3254000 <Widgets Inc>. If there was a way to match > against a number in the dialplan, and then continue execution > after that point, we could put this statement at the end of > the coo1_OnNet context and it would all be sweet. Without > that, I don't have a clue how to do this... unless we stick > with out current 3,000 line python script. > > [coo1_CallStart] > include => coo1_OnNet > include => syst_OnNet > include => syst_OffNetInstead of including your system-wide logic for offnet calling, introduce a per-company offnet and include that instead: [coo1_CallStart] include => coo1_OnNet include => syst_OnNet include => coo1_OffNet [coo1_OffNet] exten => _X.,1,Set(CALLERID(NUM)=3254000) exten => _X.,2,Set(CALLERID(NUM)=Widgets Inc.) exten => _X.,3,Goto(syst_OffNet,${EXTEN},1) The rest of this can stay untouched.> [coo1_OnNet] > > exten => 3254101,1,Dial(SIP/3254101,20,tr) > exten => 3254102,1,Dial(SIP/3254102,20,tr) > exten => 3254103,1,Dial(SIP/3254103,20,tr) > > exten => 1000,1,Answer > exten => 1000,2,Wait(1) > exten => 1000,3,NoOp(${FOO}) > > [syst_OnNet] > include => coo1_OnNet > include => coo2_OnNet > > [syst_OffNet] > exten => _X.,1,Dial(SIP/11${EXTEN}@pstngw1,180,tr)Regards, - Brad The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
Douglas Garstang
2006-Dec-19 17:19 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Watkins, Bradley [mailto:Bradley.Watkins@compuware.com] > Sent: Tuesday, December 19, 2006 4:16 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: RE: [asterisk-users] Match a Numer - then continue with > dialplan > > > Please correct me if I'm misunderstanding your requirements, but see > below (inline) for what I would do: > > > -----Original Message-----[snip]> > > > [coo1_CallStart] > > include => coo1_OnNet > > include => syst_OnNet > > include => syst_OffNet > > Instead of including your system-wide logic for offnet calling, > introduce a per-company offnet and include that instead: > > [coo1_CallStart] > include => coo1_OnNet > include => syst_OnNet > include => coo1_OffNet > > [coo1_OffNet] > > exten => _X.,1,Set(CALLERID(NUM)=3254000) > exten => _X.,2,Set(CALLERID(NUM)=Widgets Inc.) > exten => _X.,3,Goto(syst_OffNet,${EXTEN},1)Bradley, If I do this, then I can no longer continue with further extensions in my dialplan as Asterisk has already matched a number. I still need to check black/white lists, set pic codes and rate centers, 4 digit extensions etc within the company context. I just need to set the caller id and then move on. If I goto over to ${EXTEN} within syst_OffNet, I'd have to put ALL this logic within that extension, which would mean potentiall several hundred priorities. Asterisk really does need a way to match a number, execute some code, and then go back to looking for extensions.
Douglas Garstang
2006-Dec-19 18:57 UTC
[asterisk-users] Match a Numer - then continue with dialplan
Leo, sorry.... I completely don't follow you. I don't see how the registry (astdb) can help me here. -----Original Message----- From: Leo Ann Boon [mailto:leo@datvoiz.com] Sent: Tue 12/19/2006 6:15 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Cc: Subject: Re: [asterisk-users] Match a Numer - then continue with dialplan Douglas Garstang wrote:> I just know someone is going to ask 'why would you ever want to do that?'. Here's my answer. > > We have two companies, each with a dialplan similar to what's below. In the event that the number being dialled does not match any number within our OWN company, we want to set the caller id to be a generic one for the company, NOT one for the user. This is a pretty normal requirement that most companies want. So, in the event that the logic flows beyond coo1_OnNet, we want to reset the caller id of say, 3254001 <Doug>, to 3254000 <Widgets Inc>. If there was a way to match against a number in the dialplan, and then continue execution after that point, we could put this statement at the end of the coo1_OnNet context and it would all be sweet. Without that, I don't have a clue how to do this... unless we stick with out current 3,000 line python script. >If you're not using realtime to store your SIP registry, you should be able to look up the number in the family SIP/Registry (case sensitive) using the DB functions. If you're using realtime, then you'll have to do an SQL query. Leo _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/ms-tnef Size: 3525 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20061219/de1498a4/attachment.bin
Douglas Garstang
2006-Dec-20 08:16 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Tzafrir Cohen [mailto:tzafrir.cohen@xorcom.com] > Sent: Tuesday, December 19, 2006 10:18 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Match a Numer - then continue with > dialplan > > > On Tue, Dec 19, 2006 at 05:19:57PM -0700, Douglas Garstang wrote: > > > -----Original Message----- > > > From: Watkins, Bradley [mailto:Bradley.Watkins@compuware.com] > > > Sent: Tuesday, December 19, 2006 4:16 PM > > > To: Asterisk Users Mailing List - Non-Commercial Discussion > > > Subject: RE: [asterisk-users] Match a Numer - then continue with > > > dialplan > > > > > > > > > Please correct me if I'm misunderstanding your > requirements, but see > > > below (inline) for what I would do: > > > > > > > -----Original Message----- > > [snip] > > > > > > > > [coo1_CallStart] > > > > include => coo1_OnNet > > > > include => syst_OnNet > > > > include => syst_OffNet > > > > > > Instead of including your system-wide logic for offnet calling, > > > introduce a per-company offnet and include that instead: > > > > > > [coo1_CallStart] > > > include => coo1_OnNet > > > include => syst_OnNet > > > include => coo1_OffNet > > > > > > [coo1_OffNet] > > > > > > exten => _X.,1,Set(CALLERID(NUM)=3254000) > > > exten => _X.,2,Set(CALLERID(NUM)=Widgets Inc.) > > > exten => _X.,3,Goto(syst_OffNet,${EXTEN},1) > > > > Bradley, If I do this, then I can no longer continue with further > > extensions in my dialplan as Asterisk has already matched a number. > > An explicit WaitExten?No.... I don't want the user to have to enter another number. Processing should continue with the original number dialled. *sigh* Doug.
Douglas Garstang
2006-Dec-20 08:17 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Benny Amorsen [mailto:benny+usenet@amorsen.dk] > Sent: Wednesday, December 20, 2006 6:16 AM > To: asterisk-users@lists.digium.com > Subject: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > >>>>> "DG" == Douglas Garstang <dgarstang@oneeighty.com> writes: > > DG> So, in the event that the logic flows beyond > DG> coo1_OnNet, we want to reset the caller id of say, 3254001 <Doug>, > DG> to 3254000 <Widgets Inc>. > > DG> exten => 3254101,1,Dial(SIP/3254101,20,tr) > DG> exten => 3254102,1,Dial(SIP/3254102,20,tr) > DG> exten => 3254103,1,Dial(SIP/3254103,20,tr) > > > > [coo1_CallStart] > include => coo1_OnNet > > You want something which executes here, if coo1_OnNet didn't match? > > exten => _.,1,Set(CALLERID(all)=Widgets Inc <3254001>) > > will do that. > > > If you then want to continue in priority 1 instead of 2, you just do > > exten => _.,n,Goto(coo1_CallStart2,${EXTEN},1) > > [coo1_CallStart2] > include => syst_OnNet > include => syst_OffNetThat won't do it. Processing will continue in the current extension priority. I need it to continue looking for an extension to match against. Once Asterisk has matched the dialled number against an extension in the dialplan, your stuck in an extension.... you can never get out and get Asterisk to go back to looking for extensions to match against.
Douglas Garstang
2006-Dec-20 08:45 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Doug Crompton [mailto:doug@crompton.com] > Sent: Wednesday, December 20, 2006 8:36 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: RE: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > I haven't really been following this thread but doesn't the following > snipet kinda do this.... > > [out-international] > exten => _011,1,goto(process-international,s,1) > > [process-international] > > exten => s,1,playback(international-call) > exten => s,n,playback(please-enter-the) > exten => s,n,read(number,number) > exten => s,n,Dial(SIP/011${number}@gizmo,120,T) > exten => s,n,Macro(failann,${DIALSTATUS}) > > > This matches 011 then could do any number of things. Here I just goto, > then it looks for more numbers (the announcement is optional) and then > dials them. > > Maybe not what you are looking for but it is an example of Asterisk > matching an extension and then going on to take more digits that then > branch based on other digits. Here the 011 is prepended to the final > number.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. 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. Surely other people have hit the situation where they first check extensions within a company, and then if there's no match, you glue all the other companies dialplans together with this one. At that point, when one company dials another, the caller id that's sent should be the company caller id, not the caller id of the individual extension. It's a very common business requirement... at least that's what my boss, who has spend many years installing TDM pbx's tells me.> > BTW - what is a numer?A numer is a spelling mistake. I was going to change the title, but it would have broken the thread.
Douglas Garstang
2006-Dec-20 09:22 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Andreas Sikkema [mailto:andreas.sikkema@bbeyond.nl] > Sent: Wednesday, December 20, 2006 9:08 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: RE: [asterisk-users] Match a Numer - then continue with > dialplan > > > > [snip] > > > > > > > > [coo1_CallStart] > > > > include => coo1_OnNet > > > > include => syst_OnNet > > > > include => syst_OffNet > > > > > > Instead of including your system-wide logic for offnet calling, > > > introduce a per-company offnet and include that instead: > > > > > > [coo1_CallStart] > > > include => coo1_OnNet > > > include => syst_OnNet > > > include => coo1_OffNet > > > > > > [coo1_OffNet] > > > > > > exten => _X.,1,Set(CALLERID(NUM)=3254000) > > > exten => _X.,2,Set(CALLERID(NUM)=Widgets Inc.) > > > exten => _X.,3,Goto(syst_OffNet,${EXTEN},1) > > > > Bradley, If I do this, then I can no longer continue with > > further extensions in my dialplan as Asterisk has already > > matched a number. I still need to check black/white lists, > > set pic codes and rate centers, 4 digit extensions etc within > > the company context. I just need to set the caller id and > > then move on. If I goto over to ${EXTEN} within syst_OffNet, > > I'd have to put ALL this logic within that extension, which > > would mean potentiall several hundred priorities. Asterisk > > really does need a way to match a number, execute some code, > > and then go back to looking for extensions. > > Why not do something like this (in pseudo dialplan): > > <matching and initial dialplan stuff> > <decide the outgoing callerid should change>Ok...> SetVar(outgoing_callerid=1234567)Bzzt. In order to call SetVar, I have to match the extension dialled. When that happens, there is NO WAY to continue searching the dialplan after that point for another extension to match.> <continue with dialplan and do all kinds of weird things>Can only continue within the current proirity... which means that at this point, all my further logic has to be coded as priorities in the extension that called SetVar. Seeing as though I have several dozen more contexts to include, this isn't feesible.> Set(CALLERID(NUM)=${outgoing_callerid}) > Dial(outgoing destination) > > This will not screw up your extesnions matching, but you will > need to check that outgoing_callerid has been filled before setting > callerid (or make sure it is always filled with something sensible).Thanks for trying.
Peter Bowyer
2006-Dec-20 09:44 UTC
[asterisk-users] Match a Numer - then continue with dialplan
On 20/12/06, Douglas Garstang <dgarstang@oneeighty.com> wrote:> Bzzt. In order to call SetVar, I have to match the extension dialled. When that happens, there is NO WAY to continue searching the dialplan after that point for another extension to match.Can you not use either Goto or the Local channel, maybe a combination, to restart the dialplan with your variable set? (Might need a _ or two on the variable name to get it to survive) Peter -- Peter Bowyer Email: peter@bowyer.org
Douglas Garstang
2006-Dec-20 10:15 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Andreas Sikkema [mailto:andreas.sikkema@bbeyond.nl] > Sent: Wednesday, December 20, 2006 9:42 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: RE: [asterisk-users] Match a Numer - then continue with > dialplan > > > > Bzzt. In order to call SetVar, I have to match the extension > > dialled. When that happens, there is NO WAY to continue > > searching the dialplan after that point for another extension > > to match. > > You can't use a generic extension and search a database table for > $EXTEN <-> callerid relation and then set it?Yes, I can do that. However, in order to do all that, I have to match an extension first. Same problem as before.> > Your diallingplan is _so_ different to what we do, yet what you > want to do is pretty much the same to what we do all the time.I dunno about that. I think we're the only crazy ones offering company masked caller id, or else there'd be lots of people asking how to do it.> > But our Asterisk boxes have _no_ sip CPE's registered to them and > our diallingplan is littered with database lookups. We have no > static stuff in our dialingplan. And we have quite a number of > users.If you have no statuc stuff in your dialplan, how do you use the 'include =>' statement? We don't have users... we have companies. It's a hosted IPT service... and to make the problem even more insane, each company has multiple levels of organisational structure.
Eric "ManxPower" Wieling
2006-Dec-20 10:17 UTC
[asterisk-users] Match a Numer - then continue with dialplan
Douglas Garstang wrote:> Anyone know if there's a way to match a dialplan extension, execute some code, say set a variable, and then continue with the dialplan? > > I want to set a variable when the dialplan flows beyond a certain context. This would be a great feature.Match dialed digits of "668" exten => 669,1,Set(FNORD=bob) exten => 669,2,AGI(eris.pm) exten => 669,3,More Stuff Here/
Douglas Garstang
2006-Dec-20 10:18 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Peter Bowyer [mailto:peter@bowyer.org] > Sent: Wednesday, December 20, 2006 9:44 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Match a Numer - then continue with > dialplan > > > On 20/12/06, Douglas Garstang <dgarstang@oneeighty.com> wrote: > > Bzzt. In order to call SetVar, I have to match the > extension dialled. When that happens, there is NO WAY to > continue searching the dialplan after that point for another > extension to match. > > Can you not use either Goto or the Local channel, maybe a combination, > to restart the dialplan with your variable set? (Might need a _ or two > on the variable name to get it to survive)The Goto() command requires priority (extension, context). I'd need to jump to a context, without supplying an extension, which it won't accept. If I pass a priority, we're right back at square one, we're I'm stuck in a priority and can't get back to an extension. I tried putting a Dial(Local/${EXTEN}), but the problem was that Asterisk then went into an infinite when I tried to include all the company contexts together (because it was matching the Dial/Local again).
Douglas Garstang
2006-Dec-20 10:53 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Eric "ManxPower" Wieling [mailto:eric@fnords.org] > Sent: Wednesday, December 20, 2006 10:17 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Match a Numer - then continue with > dialplan > > > Douglas Garstang wrote: > > Anyone know if there's a way to match a dialplan extension, > execute some code, say set a variable, and then continue with > the dialplan? > > > > I want to set a variable when the dialplan flows beyond a > certain context. This would be a great feature. > > Match dialed digits of "668" > > exten => 669,1,Set(FNORD=bob) > exten => 669,2,AGI(eris.pm) > exten => 669,3,More Stuff Here/Ugh. 'More Stuff Here' isn't what I need Eric. I need to continue the dialplan. I need do be able to continue to search for extensions. All I want to do is set the callerid, so that later on, when we find a match, the extension can be dialled with the new caller id already set. This ain't gonna work... exten => 669,1,Set(FNORD=bob) exten => 669,2,AGI(eris.pm) exten => 669,3,include => blacklist exten => 669,3,include => blacklist exten => 669,3,include => blacklist exten => 669,3,include => blacklist
Douglas Garstang
2006-Dec-20 10:56 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Douglas Garstang > Sent: Wednesday, December 20, 2006 10:54 AM > To: 'Asterisk Users Mailing List - Non-Commercial Discussion' > Subject: RE: [asterisk-users] Match a Numer - then continue with > dialplan > > > > -----Original Message----- > > From: Eric "ManxPower" Wieling [mailto:eric@fnords.org] > > Sent: Wednesday, December 20, 2006 10:17 AM > > To: Asterisk Users Mailing List - Non-Commercial Discussion > > Subject: Re: [asterisk-users] Match a Numer - then continue with > > dialplan > > > > > > Douglas Garstang wrote: > > > Anyone know if there's a way to match a dialplan extension, > > execute some code, say set a variable, and then continue with > > the dialplan? > > > > > > I want to set a variable when the dialplan flows beyond a > > certain context. This would be a great feature. > > > > Match dialed digits of "668" > > > > exten => 669,1,Set(FNORD=bob) > > exten => 669,2,AGI(eris.pm) > > exten => 669,3,More Stuff Here/ > > Ugh. 'More Stuff Here' isn't what I need Eric. I need to > continue the dialplan. I need do be able to continue to > search for extensions. All I want to do is set the callerid, > so that later on, when we find a match, the extension can be > dialled with the new caller id already set. > > This ain't gonna work... > > exten => 669,1,Set(FNORD=bob) > exten => 669,2,AGI(eris.pm) > exten => 669,3,include => blacklist > exten => 669,3,include => blacklist > exten => 669,3,include => blacklist > exten => 669,3,include => blacklistDang it. My fat fingers posted too soon by mistake. As I was trying to say, This obviously won't work... exten => 669,1,Set(FNORD=bob) exten => 669,2,AGI(eris.pm) exten => 669,3,include => blacklist exten => 669,4,include => whitelist exten => 669,5,include => PIC_Code_Insertion exten => 669,6,include => Rate_Center_Insertion exten => 669,7,include => Findme/Followme
Douglas Garstang
2006-Dec-20 10:58 UTC
[asterisk-users] Match a Numer - then continue with dialplan
> -----Original Message----- > From: Eric "ManxPower" Wieling [mailto:eric@fnords.org] > Sent: Wednesday, December 20, 2006 10:19 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Match a Numer - then continue with > dialplan > > > Douglas Garstang wrote: > >> -----Original Message----- > >> From: David Thomas [mailto:punknow@gmail.com] > >> Sent: Tuesday, December 19, 2006 3:01 PM > >> To: Asterisk Users Mailing List - Non-Commercial Discussion > >> Subject: Re: [asterisk-users] Match a Numer - then continue with > >> dialplan > >> > >> > >> On 12/19/06, Douglas Garstang <dgarstang@oneeighty.com> wrote: > >>> Anyone know if there's a way to match a dialplan extension, > >> execute some code, say set a variable, and then continue with > >> the dialplan? > >>> I want to set a variable when the dialplan flows beyond a > >> certain context. This would be a great feature. > >>> Doug. > >> Have you tried using the SetVar cmd? I haven't tried it > but it sounds > >> like it might work for this. > >> > >> http://www.voip-info.org/wiki/view/Asterisk+variables > >> > >> Regards, > >> David > > > > David, > > > > If I call setvar, my variable will be set, but dialplan > processing will stop... > > Then something else is wrong. SetVar will not stop dialplan > processing. > In 1.4, I believe SetVar() was removed. Check upgrade.txt. > Use Set > in 1.4 instead.I was not clear. EXTENSION processing will stop. Once you've matched an extension, and your logic is running through priorities in an extension, you no longer have the ability to search for another extension to match against. That's what I need to do. Again, when control flows beyond a certain point, ie when all calls are now known to be extra-company, we need to set the callerid to the external company id... so that later on when we dial, the caller id presented to person in the other company is correct.
Douglas Garstang
2006-Dec-20 12:06 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Tony Mountifield [mailto:tony@softins.clara.co.uk] > Sent: Wednesday, December 20, 2006 11:47 AM > To: asterisk-users@lists.digium.com > Subject: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > In article > <645FEC31A18FE54A8721500CDD55A7B60350769C@mail.oneeighty.com>, > Douglas Garstang <dgarstang@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?Yes to the first sentence. Not quite sure what you mean after that.> > 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.That was my original question. I was asking if there was a way to set a variable and the continue, which doesn't seem like too strange a thing to have Asterisk support.> > 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.Don't follow you. When asterisk matches an extension, it starts interating through the priorities until there's none left, or you Goto() somewhere else.> > [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)You lost me here.> > [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 atCan't do that. The point at which a phone enters the dial plan needs to start with rather a long list of include=> statements, to grant/deny access to certain features.> priority 1 in _X. it > sets a variable like SRCCOMPANY to something specific to it. > It includes all the destination contexts. > > 2. Each destination context starts at priority 2 and sets a > variable like > DESTCOMPANY to something specific to that destination. > > 3. At priority 3 in each source context, SRCCOMPANY and > DESTCOMPANY are > compared, in order to decide whether to override the CallerID with the > source company's generic callerID. Let's say this uses priorities 3, 4 > and 5 (for the GotoIf doing the compare, then the SetCallerID, and the > NoOp target for the GotoIf when the callerID doesn't need rewriting). > The destination contexts do not have priorities 3, 4 and 5. > > 4. The destination contexts continue at priority 6 to route the call. > > I think by interleaving priorities between contxts like this > you should > be able to achieve what you are looking for. Please let us > know on the list > if you are successful - it encourages us to keep helping in > the future!I tried your example, which I completely don't follow, and it didn't seem to execute as you expected. Dialling 311 yields: *CLI> -- Executing NoOp("SIP/3254101-d10e", "this gets executed first for everything") in new stack -- Executing NoOp("SIP/3254101-d10e", "this gets executed second only if ctx31X or ctx3XX didnt match") in new stack -- Executing NoOp("SIP/3254101-d10e", "this gets executed third for everything") in new stack I need to make extensive use of the include=> directive, and I just can't see how getting stuck in priorities within an extension is going to allow me to do that. Doug.
Douglas Garstang
2006-Dec-20 12:16 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Tony Mountifield [mailto:tony@softins.clara.co.uk] > Sent: Wednesday, December 20, 2006 11:47 AM > To: asterisk-users@lists.digium.com > Subject: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > In article > <645FEC31A18FE54A8721500CDD55A7B60350769C@mail.oneeighty.com>, > Douglas Garstang <dgarstang@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.
Douglas Garstang
2006-Dec-20 13:14 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Benny Amorsen [mailto:benny+usenet@amorsen.dk] > Sent: Wednesday, December 20, 2006 1:04 PM > To: asterisk-users@lists.digium.com > Subject: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > >>>>> "DG" == Douglas Garstang <dgarstang@oneeighty.com> writes: > > DG> If I pass a priority, we're right back at square one, we're I'm > DG> stuck in a priority and can't get back to an extension. > > You ALWAYS have both a priority and an extension. There is no such > thing as "being stuck in a priority".Benny, lets say I have this... exten => _X.,1,NoOp(1) exten => _X.,2,NoOp(2) exten => _X.,3,NoOp(3) <- Current code execution location exten => 555,1,NoOp(1) exten => 555,2,NoOp(2) exten => 555,3,NoOp(3) How would I jump back into the dialplan from the current execution location and continue to search for matches? Doug
Douglas Garstang
2006-Dec-20 13:16 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> [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)Does this really work? I've never seen this behavior documented anywhere. Asterisk always searches the current context before looking in included ones for a start. Second, I don't see how it can just jump out of [example] into [ctx31X] and back again without being told to do so....
Douglas Garstang
2006-Dec-20 13:34 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Benny Amorsen [mailto:benny+usenet@amorsen.dk] > Sent: Wednesday, December 20, 2006 1:16 PM > To: asterisk-users@lists.digium.com > Subject: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > >>>>> "DG" == Douglas Garstang <dgarstang@oneeighty.com> writes: > > DG> Surely other people have hit the situation where they first check > DG> extensions within a company, and then if there's no match, you > DG> glue all the other companies dialplans together with this one. > > Of course we have. Just Goto(gluedtogethercontext,${EXTEN},1)After doing which, you can no longer use the include => directive.
Douglas Garstang
2006-Dec-20 13:40 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Benny Amorsen [mailto:benny+usenet@amorsen.dk] > Sent: Wednesday, December 20, 2006 1:14 PM > To: asterisk-users@lists.digium.com > Subject: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > >>>>> "DG" == Douglas Garstang <dgarstang@oneeighty.com> writes: > > >> -----Original Message----- From: Benny Amorsen > >> [mailto:benny+usenet@amorsen.dk] Sent: Wednesday, December 20, 2006 > >> 6:16 AM To: asterisk-users@lists.digium.com Subject: > >> [asterisk-users] Re: Match a Numer - then continue with dialplan > >> > >> exten => _.,n,Goto(coo1_CallStart2,${EXTEN},1) > >> > >> [coo1_CallStart2] include => syst_OnNet include => syst_OffNet > > DG> That won't do it. Processing will continue in the current > DG> extension priority. I need it to continue looking for an extension > DG> to match against. Once Asterisk has matched the dialled number > DG> against an extension in the dialplan, your stuck in an > DG> extension.... you can never get out and get Asterisk to go back to > DG> looking for extensions to match against. > > It looks for extensions to match against all the time. What you say > makes no sense. > > E.g. this code works, with EXTEN being 321 and starting in incoming. > > [incoming] > exten => _3XX,1,NoOp("We get to this place") > exten => _X2X,2,Goto(incoming,${EXTEN},700) > exten => _XX1,700,NoOp("We end up here") > > If EXTEN was 301, only priority 1 would run. If it was 320, priority 1 > and 2 would run.Ok, but how does that help me? All I want to do is set a variable to be used later on in the dialplan. Eg, if someone dialls 2944000, which is in a different company...: [co1_phone-start] include => co1_did include => sys_glue [co1_did] exten => 3254101,1,Dial(SIP/3254101,18,tr) exten => 3254102,1,Dial(SIP/3254102,18,tr) exten => 3254103,1,Dial(SIP/3254103,18,tr) ; No match, so now we want to use the external caller id variable for use later on, when ; we finally dial the dest number after performing all restriction and feature checks. ; Actually I just realised we want to SET the caller id. [sys-glue] include co1_did include co2_did
Douglas Garstang
2006-Dec-20 14:01 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Mike [mailto:mlists@bigrideau.com] > Sent: Wednesday, December 20, 2006 1:53 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > > >> DG> Surely other people have hit the situation where they > first check > >> DG> extensions within a company, and then if there's no match, you > >> DG> glue all the other companies dialplans together with this one. > >> > >> Of course we have. Just Goto(gluedtogethercontext,${EXTEN},1) > >> > > > > After doing which, you can no longer use the include => directive. > > > > Perhaps I can get a clarification before proceeding further... > > In reading the thread the situation seems to be: Company A > users has a > user with extension/callerid XXX, he calls someone in company > B and you > want to set the callerid to company A's "main number" rather than the > userr's default callerid? > > Is this correct?Mike, Exactamundo. Doug.
Douglas Garstang
2006-Dec-20 14:25 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
> -----Original Message----- > From: Mike [mailto:mlists@bigrideau.com] > Sent: Wednesday, December 20, 2006 2:18 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Re: Match a Numer - then continue with > dialplan > > > > >> Perhaps I can get a clarification before proceeding further... > >> > >> In reading the thread the situation seems to be: Company A > >> users has a > >> user with extension/callerid XXX, he calls someone in company > >> B and you > >> want to set the callerid to company A's "main number" > rather than the > >> userr's default callerid? > >> > >> Is this correct? > >> > > > > Mike, > > > > Exactamundo. > > > > Doug. > Ok. > > How about: > > ;outgoing context for company A > [companyA] > > ;Various include statements > include => foo > . > . > . > ;Handle calls from A -> B > ;Here BBBBXXXX will match company B numbers > exten => BBBBXXXX, 1, Set(CALLERID=CompanyAMain) > exten => BBBBXXXX, 1, Dial(${EXTEN} > > You can do the inverse for companyB, or you could l have a > single macro > that deals with calls to/from each company and decides what > do to based > on the callerid making the call. > > Mike.Mike, this is a hosted IPT solution. There's potentially going to be hundreds (we hope) of companies hosted and configured on this box. I'd have to write static code to compare every number in every company to every number in every other company, and that's just not feesible. Doug.
Benny Amorsen
2006-Dec-20 15:22 UTC
[asterisk-users] Re: Match a Numer - then continue with dialplan
>>>>> "DG" == Douglas Garstang <dgarstang@oneeighty.com> writes:DG> Ok, but how does that help me? All I want to do is set a variable DG> to be used later on in the dialplan. Eg, if someone dialls DG> 2944000, which is in a different company...: DG> [co1_phone-start] DG> include => co1_did DG> include => sys_glue DG> [co1_did] DG> exten => 3254101,1,Dial(SIP/3254101,18,tr) DG> exten => 3254102,1,Dial(SIP/3254102,18,tr) DG> exten => 3254103,1,Dial(SIP/3254103,18,tr) DG> ; No match, so now we want to use the external caller id variable for use later on, when DG> ; we finally dial the dest number after performing all restriction and feature checks. DG> ; Actually I just realised we want to SET the caller id. DG> [sys-glue] DG> include co1_did DG> include co2_did Change co1_phone-start to: include => co1_did exten => _.,1,Set(CALLERID(num)=12345) exten => _.,n,Goto(sys-glue,${EXTEN},1) /Benny