0

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?

Zypher
  • 37,405
  • 5
  • 53
  • 95
MealstroM
  • 1,517
  • 1
  • 17
  • 32

1 Answers1

1

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:

[dialplan]
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:

[dialplan]
exten => _0XXXXXXXXX,1,Goto(dialplan,+38${EXTEN},1)
snap
  • 1,251
  • 10
  • 18
  • 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 07 '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 09:16