[asterisk-users] Normalizing called numbers

Rémi Philippe ml at remiphilippe.fr
Sun May 30 12:12:05 CDT 2010


Thanks for the replies. I went with the simple matching and goto and
it works great!

Remi

2010/5/29 Johann Hoehn <johann.hoehn at ecommerce.com>:
> Rémi Philippe wrote:
>> Hi,
>> I'm working on my dial plan and I'd like to parse all dialed numbers
>> to convert them to the format I want.
>> For example if someone dials 0112345678 or 0033112345678 I would like
>> to convert it to +33112345678 and then match the number to my exten =>
>> +33XXXXXXXX statements.
>>
>> Is this possible with asterisk? I tried different ways (using _., s,
>> ...) but I can't seem to get that working right...
>>
>> Thanks for your help,
>>
>> Remi
>>
>>
>
> Assuming you are using a version with AEL, this can be done in a cleaner
> way with the pattern part of a switch statement:
>
> switch(${CALLERID(num)}) {
>    pattern 011XXXXXXX:
>        CALLERID(num)="+3311XXXXXXX";
>        break;
>    pattern 003311XXXXXXX:
>        CALLERID(num)="+3311XXXXXXX";
>        break;
>    default:
>        LOG(NOTICE, Callerid ${CALLERID(num)} not normalized);
>        break;
>  }
>
>
> You will likely want to put this into a macro and tweak it further based
> other patterns that you encounter.
>
> --johann
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> 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