Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is there a simple way to match something like this:

exten => _+380XXXXXXXXX,1,NoOp(hint that)
exten => _0XXXXXXXXX,1,NoOp(hint that)

this two extensions matches same number with or without +38 prefix. is there any rule to mutch like _[(+38)]0XXXXXXXX that?

share|improve this question
up vote 1 down vote accepted

AFAIK Asterisk does not offer dialplan matching syntax which would accommodate this (FreeSWITCH does).

You have to sanitize the number so that you can match it in the canonical format further down the dialplan. I think something like this might work for you:

exten => _+380XXXXXXXXX,1,Goto(dialplan,${EXTEN:3:10},1)

This way you can convert international +380XX..XX numbers to the national(?) 0XX..XX format and just use a single match later on. (I did not try the example myself as I switched to FreeSWITCH some time ago, but it should give you a hint what you need to do).

Edited to add:

Obviously you can also do the opposite if you want to use the international format as your canonical number format:

exten => _0XXXXXXXXX,1,Goto(dialplan,+38${EXTEN},1)
share|improve this answer
Our goal is to store all contacts and work with contacts in international format. Easiest way was to parse all numbers in incoming agi script. All our numbers at DB are in international format. And we are already using dial(...+380${exten:x:x}) or similar. Ive already tested some string manipulations within asterisk, but they are huge. So we have stoped on agi scripts, and are waiting for some more rational way of solving this, if it exists. – MealstroM Sep 7 '11 at 12:23
agi scripts is bad idea. use fastAGI or not use agi at all. you will have huge scalibility problems in future. – arheops Sep 19 '11 at 9:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.