[Freeswitch-users] Conditional testing on caller_id_name

Michael Collins msc at freeswitch.org
Thu Aug 2 20:42:21 MSD 2012


Phil,

Perhaps you could try running the action inline? Change:
<action application="set"
data="cid_name=${cidlookup(${caller_id_number})}"/>

to:
<action application="set" data="cid_name=${cidlookup(${caller_id_number})}"
inline="true"/>

And see what happens...

-Michael

On Thu, Aug 2, 2012 at 9:35 AM, Phil Quesinberry <
philq at qsystemsengineering.com> wrote:

> **
>
> Thanks Brian,
>
>
>
> I think the lights just came on...
>
>
>
> I think I finally see what’s going on here.  Looking through the wikisome more,
> I came across the following:
>
> “The XML Dialplan has the ability to test a number of conditions based
> upon variables with expressions; however, it needs to be understood that
> some variables may not be available for conditional testing until the first
> transfer or execute_extension is performed.”
>
>
>
> When I do a conditional test such as the following:
>
> <condition field="caller_id_name" expression="^Currently running a lookup">
>
> the console output shows the ani instead of the CNAM in parentheses as shown,
> and fails:
>
> Dialplan: sofia/external/4105551212 at 140.239.xx.xx Regex (FAIL)
> [currently_running] caller_id_name(4105551212) =~ /^Currently running a
> lookup/ break=on-false
>
> BUT when I ask for the variable as follows:
>
> <action application="log" data="${caller_id_name}"/>
>
> I get the expected value in the console output:
>
> EXECUTE sofia/external/4105551212 at 140.239.xx.xx log(SMITH,JOHN)
>
> 2012-08-02 12:12:50.679592 [DEBUG] mod_dptools.c:1458 SMITH,JOHN
>
> (the names and numbers have been changed to protect the clueless)
>
> So just to be sure, is this in fact what's going on here?  I learned
> something today... now that I understand it, I can deal with it.  By next
> year I'm bound to comprehend things well enough to get something useful
> from ClueCon.
>
> Thanks!
>
> The rest of the message that follows was written before I came across
> this little tidbit of information but I’m keeping it in here for reference:
>
>
>
> <clueless banter follows>
>
> I have no idea how to use Perl in FS but after a bit of looking around it
> appears that I would need to do something like:
>
> <action application="perl" data="/usr/src/freeswitch/scripts/perl/cnam.cgi
> $1"/>
>
>
>
> Is that correct?
>
>
>
> Better yet, is there any way to get to the CID name variable without
> having to resort to Perl?  Doing an ‘info’ in the dialplan during an
> incoming call shows the following:
>
> Caller-Caller-ID-Name: [JOHN SMITH]
>
>
>
> How can I get to that data?  ‘caller_id_name’ just seems to contain the
> number instead of the CNAM info, which doesn’t make any sense.
>
>
>
> The wiki shows the following example to set a variable directly:
>
> <action application="set"
> data="cid_name=${cidlookup(${caller_id_number})}"/>    and this looks like
> it might work, but I’d like to understand why the variables aren’t already
> set after the cidlookup is done in public.xml.
>
> <clueless banter ends/>
>
>
>
> Phil Quesinberry
>
> Q Systems Engineering, Inc.
>
> Electronic Controls and Embedded Systems Development
>
> (410) 969-8002
>
> *http://www.qsystemsengineering.co**m*<http://www.qsystemsengineering.com>
>
> ----------
>
>
>
> [Freeswitch-users] Setting effecting_caller_id_name
>
> Brian West
>
> Sat Jul 28 17:46:14 MSD 2012
>
>
>
> Sounds like your doing openCNAM, check the cnam.cgi in tree, you should be
>
> checking the response code and not the text returned.  I built the wrapper
>
> to clean up the input before I query because of this.
>
>
>
> --
>
> Brian West
>
> brian at freeswitch.org
>
> FreeSWITCH Solutions, LLC
>
> PO BOX PO BOX 2531
>
> Brookfield, WI 53008-2531
>
> Twitter: @FreeSWITCH_Wire
>
> T: +1.213.286.0410  |  F: +1.213.286.0401  |  M: +1.918.424.WEST
>
> iNUM: +883 5100 1286 0410
>
>
>
> On Jul 27, 2012, at 10:06 AM, Ken Rice <krice at freeswitch.org> wrote:
>
>
>
> Re: [Freeswitch-users] Setting effecting_caller_id_name This exmaple should
>
> be correct provided that caller_id_name containts “Currently runnint a
>
> lookup” with this pinned to that start of the field...
>
>
>
> On that extension in your dialplan toss a <anti-action application=”info”/>
>
>
>
> If your regex isnt matching on the caller_id_name field the above will show
>
> you whats in there (along with every thing else too heh)
>
>
>
> K
>
> _________________________________________________________________________
> 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/20120802/c119355d/attachment-0001.html 


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