[Asterisk-Users] extensions and regular expressions (
probablyan easy question )
Ryan Burke
burke at tailorhosting.com
Sat Dec 10 21:30:38 MST 2005
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" <radamson at routers.com>
To: "Asterisk Users Mailing List - Non-Commercial Discussion"
<asterisk-users at 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
More information about the asterisk-users
mailing list