[Freeswitch-users] Setting effecting_caller_id_name

Michael Collins msc at freeswitch.org
Tue Jul 31 20:44:00 MSD 2012


Phil,
I have a question about this line from your trace:

Dialplan: sofia/external/4435551212 at 140.239.xx.x Regex (FAIL)
[fix_cidnam_plus] caller_id_name(4435551212) =~
/^\+1?([2-9]\d\d[2-9]\d{6})$/ break=on-false
Are you thinking that "4435551212" should match the regex in extension
"fix_cidnam_plus"? The reason I ask is that I think your regex may have a
small gotcha. It looks to my like you are making the leading "1" optional
by having "1?" in front of the rest of the regex. However, it looks to me
like the "+" is not optional, so unless the phone number is "+4435551212"
it won't match that regex. If the + is meant to be optional then the easy
way to test would be to add a "?" right after the "+":

<condition field="caller_id_name" expression="^\+?1?([2-9]\d\d[2-9]\d{6})$">

Of course, if you were banking on having the + in there then I'm all wet
and you can ignore me...

-MC

On Tue, Jul 31, 2012 at 9:19 AM, Phil Quesinberry <
philq at qsystemsengineering.com> wrote:

> **
>
> Ok, the problem here is that the variable caller_id_name contains the
> Caller ID number instead of the CNAM that was looked up.  Is there avariable to look at and change for
> the CNAM info?  Info shows the CNAM info in Caller-Caller-ID-Name but
> attempts to match on variations of that have failed.  Obviously I’m
> missing some basic piece of info here but I haven’t been able to find it,
> even within the FreeSwitch book.
>
> I’ve pasted a small section of the relevant console output below.
>
> I should also mention that I’m doing this check within public.xml since I
> want it to apply to all incoming calls.
>
> Thanks,
>
> - Phil
>
> 2012-07-31 11:33:30.800571 [INFO] mod_dialplan_xml.c:485 Processing
> 4435551212 <4435551212>->4105551212 in context public
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x parsing
> [public->outside_call] continue=true
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Absolute Condition
> [outside_call]
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Regex (PASS)
> [outside_call] ${module_exists(mod_cidlookup)}(true) =~ /true/
> break=on-false
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Regex (PASS)
> [outside_call] caller_id_name(4435551212) =~ /^4435551212$|^$/
> break=on-false
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Regex (PASS)
> [outside_call] caller_id_number(4435551212) =~
> /^1?([2-9]\d\d[2-9]\d{6})$/ break=on-false
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Action cidlookup(4435
> 551212)
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x parsing
> [public->fix_cidnam_plus] continue=true
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Regex (FAIL)
> [fix_cidnam_plus] caller_id_name(4435551212) =~
> /^\+1?([2-9]\d\d[2-9]\d{6})$/ break=on-false
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x parsing
> [public->currently_running] continue=true
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Absolute Condition
> [currently_running]
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Action info()
>
> Dialplan: sofia/external/4435551212 at 140.239.xx.x Regex (FAIL)
> [currently_running] caller_id_name(4435551212) =~ /^Currently running a
> lookup/ break=on-false
>
> Caller-Direction: [inbound]
>
> Caller-Username: [4435551212]
>
> Caller-Dialplan: [XML]
>
> Caller-Caller-ID-Name: [SMITH,JOHN]
>
> Caller-Caller-ID-Number: [4435551212]
>
> Caller-Network-Addr: [140.239.xx.x]
>
> Caller-ANI: [4435551212]
>
> Caller-Destination-Number: [4105551212]
>
> _____________________________________________
> *****From:* Phil Quesinberry
> *****Sent:* Thursday, July 26, 2012 10:29 PM
> *****To:* 'freeswitch-users at lists.freeswitch.org'
> *****Subject:* RE: Setting effecting_caller_id_name
>
> The reply is different each time, depending upon the number being looked
> up.  So, I just want to look at the first part of the string.  If FS can’t
> do a regex match without the trailing $, I’m guessing there’s a way to just
> do it in XML.
>
> I’ll try and see what I can find after the storm passes unless you have a
> better idea, I need to shut this computer down right now.
>
> Thanks,
>
> - Phil
>
> You can just not use a regex.
>
> Do you need to escape the spaces?
>
> Brian Foster
>
> Endigo Computer LLC
>
>  _____________________________________________
> *****From:* Phil Quesinberry
>
> *****Sent:* Thursday, July 26, 2012 5:46 PM
> *****To:* 'freeswitch-users at lists.freeswitch.org'
> *****Subject:* RE: Setting effecting_caller_id_name
>
> If you put the $ at the end then it will try to match the entire string
> instead of just the beginning of it, which won’t work in this case.  Is
> there a way to match just the beginning of the string in FS?
>
> Thanks,
>
> - Phil
>
> You need a $ after 'lookup' for it to be a regex.
>
> Brian Foster
>
> Endigo Computer LLC
>
>  _____________________________________________
> *****From:* Phil Quesinberry
> *****Sent:* Thursday, July 26, 2012 3:59 PM
> *****To:* 'freeswitch-users at lists.freeswitch.org'
> *****Subject:* Setting effecting_caller_id_name
>
> And while I’m asking dumb questions…
>
> When doing CNAM dips from opencnam.com, often you get a result of
> “Currently running a lookup for phone ‘xxxxxxxxxx’… on incoming calls,
> typically for wireless or other unknown name callers and I wanted to change
> that to “Wireless/Unknown”  Since caller_id_name is apparently read-only, I
> am attempting to set effective_caller_id_name.  I put the following in
> public.xml right below the “fix_cidnam_plus” entry, in other words after a
> CNAM lookup has been performed.
>
>    <extension name="fix_currently_running" continue="true">
>
>       <condition field="caller_id_name" expression="^Currently running a
> lookup">
>
>         <action application="set"
> data="effective_caller_id_name=Wireless/Unknown"/>
>
>       </condition>
>
>     </extension>
>
> If I crafted my regex properly, then it should be matching on the first
> part of the string and setting the variable appropriately.  Is
> ‘effective_caller_id_name’ the variable I should be setting?
>
> Many thanks,
>
> *******Phil Quesinberry*
>
> Q Systems Engineering, Inc.
>
> Electronic Controls and Embedded Systems Development
>
> (410) 969-8002
>
> ***http://www.qsystemsengineering.com*<http://www.qsystemsengineering.com>
>
>
> _________________________________________________________________________
> 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
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> 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/20120731/4d8edd60/attachment-0001.html 


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