[Freeswitch-users] Strip digits from incoming caller id
Michael Collins
msc at freeswitch.org
Wed Sep 19 01:20:04 MSD 2012
Georg,
If you just want the phone number w/o the international prefix then it's
better to capture that correctly the first time:
<condition field="destination_number" expression="^(49)?(123456789)$">
The value you want is now in $2, and if it's international then you'll have
"49" in $1. However, you cannot use $1 or $2 in another condition. You'll
need to store them before you do anything else:
<extension name="Dispo Intern" continue="true">
<condition field="destination_number" expression="^(49)?(123456789)$">
<action application="set" data="international=$1" inline="true"/>
<action application="set" data="dialed_number=$2" inline="true"/>
</condition>
<condition field="${international}" data="^49$">
<action application="set"
data="effective_caller_id_number=0${dialed_number}"/>
<action application="set" data="effective_caller_id_name=_undef_"/>
<anti-action application="set"
data="effective_caller_id_number=${dialed_number}"/>
</condition>
</extension>
Try that. Standard disclaimer applies: I did that off the top of my head,
so if it doesn't work the first time please test and tinker a bit before
you report back. :)
-MC
On Tue, Sep 18, 2012 at 1:53 PM, <georg at riseup.net> wrote:
> Hi all,
>
> 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.
>
> My dialplan at the moment looks like this:
>
> <extension name="Dispo Intern" continue="true">
> <condition field="destination_number" expression="^(123456789)$">
> <regex field="caller_id_number" expression="^49(\d+)$2"/>
> <action application="set" data="effective_caller_id_number=0$2"/>
> <action application="set" data="effective_caller_id_name=_undef_"/>
> <anti action application="set"
> data="effective_caller_id_number=${original_caller_id_number}"/>
> </condition>
> </extension>
>
> What I'm trying to do:
> - Check if the call is a "local" one
> - If yes, alter the caller id
> - I thought, I'm able to save the stripped caller id in $2, and use it
> again in the next line; this is not true, or at least not in the way I did
> this
> - It seems that $2 is "empty", because the altered caller id is just 0
>
> Could someone point me into the right direction?
>
> Thanks in advance,
> Georg
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
--
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120918/efe8751d/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list