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
On 18/09/12 21:53, georg@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,
Hi Paul,
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.
Thank you. I've found this aswell in the wiki 2 minutes after my post, and wanted to test first. Everything works as expected! :) Cheers, Georg P.S.: Before my post I googled aroung for sth. like two hours. Should I wikify this somewhere (if yes, where?) to make it easier to find?
Where on the wiki were you looking for this information? It sounds like it is related to caller id handling. My guess is that the best place to put it would be: http://wiki.freeswitch.org/wiki/Variable_effective_caller_id_number if you put it inside of the <onlyinclude> tags then it will also display on the main channel variables page. -MC On Tue, Sep 18, 2012 at 2:20 PM, <georg@riseup.net> wrote:
Hi Paul,
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.
Thank you. I've found this aswell in the wiki 2 minutes after my post, and wanted to test first. Everything works as expected! :)
Cheers, Georg
P.S.: Before my post I googled aroung for sth. like two hours. Should I wikify this somewhere (if yes, where?) to make it easier to find?
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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
Whoa. I did NOT know about this onlyinclude stuff. It looks like there's quite a few vars on channel vars page that aren't using an include like this. -Avi On Wed, Sep 19, 2012 at 12:33 AM, Michael Collins <msc@freeswitch.org>wrote:
Where on the wiki were you looking for this information? It sounds like it is related to caller id handling. My guess is that the best place to put it would be: http://wiki.freeswitch.org/wiki/Variable_effective_caller_id_number
if you put it inside of the <onlyinclude> tags then it will also display on the main channel variables page.
-MC
On Tue, Sep 18, 2012 at 2:20 PM, <georg@riseup.net> wrote:
Hi Paul,
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.
Thank you. I've found this aswell in the wiki 2 minutes after my post, and wanted to test first. Everything works as expected! :)
Cheers, Georg
P.S.: Before my post I googled aroung for sth. like two hours. Should I wikify this somewhere (if yes, where?) to make it easier to find?
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On Tue, Sep 18, 2012 at 2:45 PM, Avi Marcus <avi@avimarcus.net> wrote:
Whoa. I did NOT know about this onlyinclude stuff. It looks like there's quite a few vars on channel vars page that aren't using an include like this.
-Avi
This is a great janitorial project if anyone wants to help. It's very easy to do - it's just tedious. -MC
Hi,
Where on the wiki were you looking for this information? It sounds like it is related to caller id handling. My guess is that the best place to put it would be: http://wiki.freeswitch.org/wiki/Variable_effective_caller_id_number
Allright, will put it there. Is it undesired to store the same information twice? Because if not, I would also add it to the dialplan examples, maybe next to [1]. Cheers, Georg [1] http://wiki.freeswitch.org/wiki/FreeSwitch_Dialplan_XML#Example_3:_Stripping...
if you put it inside of the <onlyinclude> tags then it will also display on the main channel variables page.
-MC
On Tue, Sep 18, 2012 at 2:20 PM, <georg@riseup.net> wrote:
Hi Paul,
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.
Thank you. I've found this aswell in the wiki 2 minutes after my post, and wanted to test first. Everything works as expected! :)
Cheers, Georg
P.S.: Before my post I googled aroung for sth. like two hours. Should I wikify this somewhere (if yes, where?) to make it easier to find?
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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 _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
We prefer not to store same info in multiple places unless there's no elegant way around it. In this case you're fine just to put this tidbit into both pages. -MC On Tue, Sep 18, 2012 at 2:46 PM, <georg@riseup.net> wrote:
Hi,
Where on the wiki were you looking for this information? It sounds like it is related to caller id handling. My guess is that the best place to put it would be: http://wiki.freeswitch.org/wiki/Variable_effective_caller_id_number
Allright, will put it there. Is it undesired to store the same information twice? Because if not, I would also add it to the dialplan examples, maybe next to [1].
Cheers, Georg
[1]
http://wiki.freeswitch.org/wiki/FreeSwitch_Dialplan_XML#Example_3:_Stripping...
if you put it inside of the <onlyinclude> tags then it will also display on the main channel variables page.
-MC
On Tue, Sep 18, 2012 at 2:20 PM, <georg@riseup.net> wrote:
Hi Paul,
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.
Thank you. I've found this aswell in the wiki 2 minutes after my post, and wanted to test first. Everything works as expected! :)
Cheers, Georg
P.S.: Before my post I googled aroung for sth. like two hours. Should I wikify this somewhere (if yes, where?) to make it easier to find?
Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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 _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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
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@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@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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
Hi Michael,
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)$">
Yes. Problem is that the number after expression is not the incoming caller id (which I would like to alter), but instead a DID. I tried to circumcent this, but with no luck. To clarify this: This number is not the not the number I would like have shown on my phones. It's my own number, not the number the calling party is calling from. Anyway, the other way round is working great. Thank you, Georg
participants (4)
-
Avi Marcus
-
georg@riseup.net
-
Michael Collins
-
Paul Cupis