RE: [Asterisk-Users] extensions and regular expressions ( probablyan easy question )
Or you can treat everything as a 10 digit number retaining in a variable whether the user dialed one or not exten = _1NXXNXX,1,SetVar(ONPRESSED=TRUE) *** skip this step if you don't care whether the one was pressed in any of your dialplans exten = _1NXXNXX,2,Goto(${CONTEXT},${EXTEN:1},1) exten = 8661234567,1,Goto(800-in) Can be your thing or not, depending on what you're using it for. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich Adamson Sent: December 10, 2005 8:08 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] extensions and regular expressions ( probablyan easy question ) Or, just do... exten = 18661234567,1,Goto(800-in) exten = 8661234567,1,Goto(800-in) It's kind of tough to truly understand what you are trying to accomplish (or ask for). Apparently you've got something more in mind that words are making it through the list. Reading between the lines, it would appear from the 800-in that calls are coming in from some external source, and you trying to do something with them. Can you be a little more explicit. Hi Dan, Thanks for the info, but what I'm after is the ability to match a digit/character 0 or 1 times at the beginning of the string. If I'm reading your example right, it'll match anything starting with 866, which doesn't work for me. I am trying to match: 18661234567 and 8661234567 Sean ps: The pdf doesn't have a good explaination of this either, although it occurs to me that this might not be possible with * if I'm having such a hard time finding it. Daniel Wright wrote: Sean Kennedy wrote: Hi all, I'm having a hard time finding information related to the regular expressions that can be used in a dialplan, specifically as an extension. For example, I have an 800 number which I'd like to jump directly to if my users dial it, instead of going over my pstn termination. Currently, it looks like this: exten = 8661234567,1,Goto(800-in) However, I'd like 1866123456 to match as well. I can't find in the wiki or sample configs how to say match this 0 or 1 times. Can anybody provide a link that would go over this? Again, I've been digging through the wiki, but I seem to be missing it. Thanks Sean You could do it like this: exten = _866.,1,GoTo(800-in) The period means match one or more characters. You can find reference to expressions and how they work in this pdf book http://www.nufone.net/downloads/asteriskdocs/AsteriskTFOT.zip ___ --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 ___ --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
RE: [Asterisk-Users] extensions and regular expressions ( probablyan easy question )
I just wanted to throw in here that I was intrigued by the question, so I went through the Asterisk, The Future of Telephony book, all the notes I've gathered, and every single link that looked even mildly promising. From what I see, you're asking if you can use a regular expression to match against the dialed number. You _COULD_ if you wanted to do something like this (on ALL calls being dialed by your users) exten = _X.,1,GotoIf($[${REGEX(YOUR_REGEX_HERE ${EXTEN})} = 1]?800-in,s,1:2) Easy-read format (how I design stuff before writing it fully) exten = anynumber If the number dialed matches the regex pattern, goto the 800-in context, at the s extension, priority 1 Otherwise, continue on to priority 2 in this extension context. If you'd like to save a minute amount of cpu/mem/time, you can match against 10+ numbers only, using _XX. as the pattern to match against, which will match against any set of numbers 10 or more digits long. Hope this was somewhat helpful SKM From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sean Kennedy Sent: Saturday, December 10, 2005 11:33 PM To: [EMAIL PROTECTED]; Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] extensions and regular expressions ( probablyan easy question ) Rich, It's kind of tough to truly understand what you are trying to accomplish Ack, sorry! It's hard to post to the list on a saturday when my 2year old is wanting to play with the keyboard as well. Best I can do is half a mind, most of the time that's enough. Not always, however. :) (or ask for). Apparently you've got something more in mind that words are making it through the list. Reading between the lines, it would appear from the 800-in that calls are coming in from some external source, and you trying to do something with them. Can you be a little more explicit I have an 800 number from teliax. When my local users dial it, they will dial 1866... instead of the 866 I have in my dial plan. I do not want the call to use one of my external sources to terminate the call ( in essence, dialing out via voicepulse, and recieving the call via teliax ). I know I can do two seperate exten patterns, but I was hoping for a single pattern. To that end, I was wondering if there was a way of saying Match this 0 or 1 times, something I'm used to in perl and the like. If there isn't, there isn't. Won't kill me to add the second exten match. Sean Rich Adamson wrote: Or, just do... exten = 18661234567,1,Goto(800-in) exten = 8661234567,1,Goto(800-in) It's kind of tough to truly understand what you are trying to accomplish (or ask for). Apparently you've got something more in mind that words are making it through the list. Reading between the lines, it would appear from the 800-in that calls are coming in from some external source, and you trying to do something with them. Can you be a little more explicit. Hi Dan, Thanks for the info, but what I'm after is the ability to match a digit/character 0 or 1 times at the beginning of the string. If I'm reading your example right, it'll match anything starting with 866, which doesn't work for me. I am trying to match: 18661234567 and 8661234567 Sean ps: The pdf doesn't have a good explaination of this either, although it occurs to me that this might not be possible with * if I'm having such a hard time finding it. Daniel Wright wrote: Sean Kennedy wrote: Hi all, I'm having a hard time finding information related to the regular expressions that can be used in a dialplan, specifically as an extension. For example, I have an 800 number which I'd like to jump directly to if my users dial it, instead of going over my pstn termination. Currently, it looks like this: exten = 8661234567,1,Goto(800-in) However, I'd like 1866123456 to match as well. I can't find in the wiki or sample configs how to say match this 0 or 1 times. Can anybody provide a link that would go over this? Again, I've been digging through the wiki, but I seem to be missing it. Thanks Sean You could do it like
RE: [Asterisk-Users] extensions and regular expressions ( probablyan easy question )
You just need separate extensions. Hi Dan, Thanks for the info, but what I'm after is the ability to match a digit/character 0 or 1 times at the beginning of the string. If I'm reading your example right, it'll match anything starting with 866, which doesn't work for me. I am trying to match: 18661234567 and 8661234567 Sean ps: The pdf doesn't have a good explaination of this either, although it occurs to me that this might not be possible with * if I'm having such a hard time finding it. Daniel Wright wrote: Sean Kennedy wrote: Hi all, I'm having a hard time finding information related to the regular expressions that can be used in a dialplan, specifically as an extension. For example, I have an 800 number which I'd like to jump directly to if my users dial it, instead of going over my pstn termination. Currently, it looks like this: exten = 8661234567,1,Goto(800-in) However, I'd like 1866123456 to match as well. I can't find in the wiki or sample configs how to say match this 0 or 1 times. Can anybody provide a link that would go over this? Again, I've been digging through the wiki, but I seem to be missing it. Thanks Sean You could do it like this: exten = _866.,1,GoTo(800-in) The period means match one or more characters. You can find reference to expressions and how they work in this pdf book http://www.nufone.net/downloads/asteriskdocs/AsteriskTFOT.zip Dan ___ --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 ___ --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
RE: [Asterisk-Users] extensions and regular expressions ( probablyan easy question )
Definitely should just copy the 18661234567 extension set and then remove the 1. I do not believe you can use regular expressions (I take it you _do_ mean regex, and not the standard pattern matching) That's all I got... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sean Kennedy Sent: Saturday, December 10, 2005 5:59 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] extensions and regular expressions ( probablyan easy question ) Hi Dan, Thanks for the info, but what I'm after is the ability to match a digit/character 0 or 1 times at the beginning of the string. If I'm reading your example right, it'll match anything starting with 866, which doesn't work for me. I am trying to match: 18661234567 and 8661234567 Sean ps: The pdf doesn't have a good explaination of this either, although it occurs to me that this might not be possible with * if I'm having such a hard time finding it. Daniel Wright wrote: Sean Kennedy wrote: Hi all, I'm having a hard time finding information related to the regular expressions that can be used in a dialplan, specifically as an extension. For example, I have an 800 number which I'd like to jump directly to if my users dial it, instead of going over my pstn termination. Currently, it looks like this: exten = 8661234567,1,Goto(800-in) However, I'd like 1866123456 to match as well. I can't find in the wiki or sample configs how to say match this 0 or 1 times. Can anybody provide a link that would go over this? Again, I've been digging through the wiki, but I seem to be missing it. Thanks Sean You could do it like this: exten = _866.,1,GoTo(800-in) The period means match one or more characters. You can find reference to expressions and how they work in this pdf book http://www.nufone.net/downloads/asteriskdocs/AsteriskTFOT.zip Dan ___ --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 ___ --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
Re: [Asterisk-Users] extensions and regular expressions ( probablyan easy question )
Steve, Yeah, that's what I've been doing, but I was hoping to make it a little clearer in the dial plan. Ah well, you win some and lose some. Thanks! Sean Steve Totaro wrote: You just need separate extensions. Hi Dan, Thanks for the info, but what I'm after is the ability to match a digit/character 0 or 1 times at the beginning of the string. If I'm reading your example right, it'll match anything starting with 866, which doesn't work for me. I am trying to match: 18661234567 and 8661234567 Sean ps: The pdf doesn't have a good explaination of this either, although it occurs to me that this might not be possible with * if I'm having such a hard time finding it. Daniel Wright wrote: Sean Kennedy wrote: Hi all, I'm having a hard time finding information related to the regular expressions that can be used in a dialplan, specifically as an extension. For example, I have an 800 number which I'd like to jump directly to if my users dial it, instead of going over my pstn termination. Currently, it looks like this: exten = 8661234567,1,Goto(800-in) However, I'd like 1866123456 to match as well. I can't find in the wiki or sample configs how to say "match this 0 or 1 times". Can anybody provide a link that would go over this? Again, I've been digging through the wiki, but I seem to be missing it. Thanks Sean You could do it like this: exten = _866.,1,GoTo(800-in) The period means match one or more characters. You can find reference to expressions and how they work in this pdf book http://www.nufone.net/downloads/asteriskdocs/AsteriskTFOT.zip Dan ___ --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 ___ --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 ___ --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
Re: [Asterisk-Users] extensions and regular expressions ( probablyan easy question )
I was reading the pdf and found a command that might be of some use: Prefix() ex. exten = 8661234567,1,Prefix(1) exten = 18661234567,1,NoOp() exten = 18661234567,2,Goto(800-in) After the Prefix() the the next exten is n+1 (which is 2 in this example) with the new extension (which is 18661234567 instead of 8661234567 which was originally dialed). Personally I think this is a bit more elegant than having a bunch of Goto's for each extension, but they do the same thing. Personal preference I guess. Ryan - Original Message - From: Rich Adamson [EMAIL PROTECTED] To: Asterisk Users Mailing List - Non-Commercial Discussion asterisk-users@lists.digium.com Sent: Saturday, December 10, 2005 7:08 PM Subject: Re: [Asterisk-Users] extensions and regular expressions ( probablyan easy question ) Or, just do... exten = 18661234567,1,Goto(800-in) exten = 8661234567,1,Goto(800-in) It's kind of tough to truly understand what you are trying to accomplish (or ask for). Apparently you've got something more in mind that words are making it through the list. Reading between the lines, it would appear from the 800-in that calls are coming in from some external source, and you trying to do something with them. Can you be a little more explicit. Hi Dan, Thanks for the info, but what I'm after is the ability to match a digit/character 0 or 1 times at the beginning of the string. If I'm reading your example right, it'll match anything starting with 866, which doesn't work for me. I am trying to match: 18661234567 and 8661234567 Sean ps: The pdf doesn't have a good explaination of this either, although it occurs to me that this might not be possible with * if I'm having such a hard time finding it. Daniel Wright wrote: Sean Kennedy wrote: Hi all, I'm having a hard time finding information related to the regular expressions that can be used in a dialplan, specifically as an extension. For example, I have an 800 number which I'd like to jump directly to if my users dial it, instead of going over my pstn termination. Currently, it looks like this: exten = 8661234567,1,Goto(800-in) However, I'd like 1866123456 to match as well. I can't find in the wiki or sample configs how to say match this 0 or 1 times. Can anybody provide a link that would go over this? Again, I've been digging through the wiki, but I seem to be missing it. Thanks Sean You could do it like this: exten = _866.,1,GoTo(800-in) The period means match one or more characters. You can find reference to expressions and how they work in this pdf book http://www.nufone.net/downloads/asteriskdocs/AsteriskTFOT.zip ___ --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 ___ --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