# Matching Extension numbers

Can someone tell me how I can do:

exten => 8003250071,1,Dial(SIP/user1,20,tr)
exten => 3250071,1,Dial(SIP/user1,20,tr)

in one line? I can’t quite work out how to get the number matching to work. I’m new at this! Thanks!

Doug.

[quote=“dgarstang”]Can someone tell me how I can do:

exten => 8003250071,1,Dial(SIP/user1,20,tr)
exten => 3250071,1,Dial(SIP/user1,20,tr)

in one line? I can’t quite work out how to get the number matching to work. I’m new at this! Thanks!

Doug.[/quote]

exten => _.3250071,1,Dial(SIP/user1,20,tr)

This gets any number that ends with 3250071. It doesn’t meather does number have 7, 10 or 15 digits.

Not quite!

_.3250071 does not match 3250071 - because that “.” after the underscore matches one or more characters. It doesn’t match no characters.

So it will match 13250071, 113250071, 1113250071 … 111111111113250071 , etc, but not 3250071 .

To do what you’re trying to do, it has to be _3250071 .

However, _.3250071 matches a lot more than just 8003250071 and 3250071 .

If you only want to match those two numbers, then you can’t do it on one line and you have to do it the way it is in the original message. I.e., in two lines:

exten => 8003250071,1,Dial(SIP/user1,20,tr)
exten => 3250071,1,Dial(SIP/user1,20,tr)

Say, if a dialled extension starts with 800, then remove the area code (ie the 800), and dial by the number without the prefix.

Can we do number stripping in extensions.conf?

exten => _800.,1,Goto(\${EXTEN:3})

exten => 3250071,1,Dial(SIP/user1,20,tr)

is probably what you’re looking for. That way, when someone dials 8003250071 it goes to exten 3250071 .

But you really need to explain what you’re trying to do - this is all very vague.

Why?

Quite simple really. I want users to have the option of specifying the area code when they dial a number. I want both numbers to dial the same SIP user (because after all, they’re the same number).

I would have thought that this would have been quite a common scenario.

-Doug.

Well, maybe it’s obvious if you happen to know that 800 is an area code. But it doesn’t look like an area code to me. In Britain and Australia, area codes start with a ‘0’, in Spain they start with a ‘9’. No doubt in other countries they start with other things.

I can only assume you must be in the US - and don’t realise that everywhere in the world is not the same as the US…

Yip, I’m in the US, and no I don’t think the US is the centre of the Universe. Why? I grew up in Australia and came to the US 5 years ago. So, I do realise there are other countries. And… the US’s long distance dialling prefix is 1, Australia’s is 0… and so on.

Ok, fair enough! Sorry, i’m a bit narky about that sometimes.

I just got the impression that you couldn’t understand why i couldn’t work out what you were trying to do - and thought that it should be obvious that the 800 was an area code. And i couldn’t work out why you thought it was obvious…

We don’t have area codes in Aus any more - unless you count 02, 03, 04, etc… as area codes. They’re more like state codes, really. Apart from 08 - which covers more than half of the continent (SA, WA, NT). It’s kinda weird really!