Big challenge dialing

I’m having a big challenge trying to set up a special dial plan for my country.
Someone can help me?

For some reason in my country I’m having a different dial plan to dial celphones from a local number number you dial aaNXXXXXXX where aa=local cel prefix, if you dial a long distance cell phone then the dial plan is bbaaNXXXXXXX or bbbaaNXXXXXX or bbbbaaNXXXXX
However if you dial from outside the country you dial plan after country code is:

cbbNXXXXXXX for aaNXXXXXXX where c is different number than a and is a single digit
cbbbNXXXXXX for bbbaaNXXXXXX
cbbbbNXXXXX for bbbbaaNXXXXX

I have an IP provider who has offer local plans with US dial plan that means every time I dial a local cell phone in my system 9aaNXXXXXXX it has to dial to the SIP provider 011+country code+cbbNXXXXXXX or long distance 90bbbaaNXXXXXX

I don’t know (and couldn’t find) a way to strip two middle digits “aa” in the “outbound route” freepbx module.

Anyone know how to do it?

how’s your php or perl language ability.

Using a regular expression (regex) pattern string code(aa)([2-9][0-9]{5,7})[/code] will separate the one number into three groups of numbers – “b” and “a” and “nx” strings. Then, in either language (or others), you can concatenate the “c” + “b” + “nx” back together.


More simply, if the bb, bbb, and bbbb are fixed number sets, doesn’t the following get the job done?

Outbound Route	->	Trunk Dial Rules
Outbound Route	->	Trunk Dial Rules
bbbaa|NXXXXXX 	->	011CCcbbb+NXXXXXX
Outbound Route	->	Trunk Dial Rules
bbbbaa|NXXXXXXX ->	011CCcbbbb+NXXXXX

Where “CC” is your country code.