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 a variable 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@140.239.xx.x parsing [public->outside_call] continue=true
Dialplan: sofia/external/4435551212@140.239.xx.x Absolute Condition [outside_call]
Dialplan: sofia/external/4435551212@140.239.xx.x Regex (PASS) [outside_call] ${module_exists(mod_cidlookup)}(true) =~ /true/ break=on-false
Dialplan: sofia/external/4435551212@140.239.xx.x Regex (PASS) [outside_call] caller_id_name(4435551212) =~ /^4435551212$|^$/ break=on-false
Dialplan: sofia/external/4435551212@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@140.239.xx.x Action cidlookup(4435551212)
Dialplan: sofia/external/4435551212@140.239.xx.x parsing [public->fix_cidnam_plus] continue=true
Dialplan: sofia/external/4435551212@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@140.239.xx.x parsing [public->currently_running] continue=true
Dialplan: sofia/external/4435551212@140.239.xx.x Absolute Condition [currently_running]
Dialplan: sofia/external/4435551212@140.239.xx.x Action info()
Dialplan: sofia/external/4435551212@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@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@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@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