[Freeswitch-users] Strip digits from incoming caller id

Paul Cupis paul at cupis.co.uk
Wed Sep 19 01:08:25 MSD 2012


On 18/09/12 21:53, georg at riseup.net wrote:
> My provider is sending me the phone numbers in the E.164 (I guess) format.
> I would like to remove the international prefix (on local fixed line and
> local mobile calls at least), and add a leading zero. I know how to add
> digits, but I've got problems to remove digits.

>    <regex field="caller_id_number" expression="^49(\d+)$2"/>
>    <action application="set" data="effective_caller_id_number=0$2"/>

Try this instead of the above:

<action application="set" 
data="effective_caller_id_number=${regex(${caller_id_number}|^49([0-9]{9})$|0%1)}"/>

You maybe want to adjust the {9} to reflect the correct number of digits 
in the national part of the caller ID.

The above is derived from:

http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_regex

Regards,



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list