[Freeswitch-users] Routing based on CID Name

Stanislav Sinyagin ssinyagin at gmail.com
Fri Jul 24 05:04:24 MSD 2015


also with mod_perl, you can set a short HTTP timeout, so that your
system still works if the remote HTTP server stops responding.

Here's an example for CID lookup in LDAP:
https://github.com/voxserv/freeswitch-helper-scripts/blob/master/mod_perl/lookup_caller_ldap.pl



On Fri, Jul 24, 2015 at 2:31 AM, Stanislav Sinyagin <ssinyagin at gmail.com> wrote:
>  <condition field="effective_caller_id_name" expression="TM" >
>
> You need to use ${effective_caller_id_name} here.
>
> But I would do the whole logic in mod_lua or mod_perl, as it's much easier
> to program there.
>
> On Jul 23, 2015 11:45 PM, "David S. Dee" <dsdee at dsba.net> wrote:
>>
>> Hello;
>>
>> I've been a freeswitch user for some time, but I am finally getting around
>> to trying to get idea working again.
>>
>> I have an in-house CID lookup routine that works fine... it sets
>> caller_id_name and effective_caller_id_name and those modified names show up
>> fine on my telephones when the calls come in.
>>
>> That lookup routine adds a prefix of TM: if its a telemarketer, or VM: if
>> i want the caller to go directly to voicemail...  Basically, if the original
>> CID from my provider shows up as "FOO Marketing", then after the
>> cid-extension runs, the caller_id_name and effective_caller_name to "TM:FOO
>> Marketing"....
>>
>> What is -not- working is the routing.
>>
>> I have an extension right after the CID Lookup that I want to do the
>> routing directly to voicemail.   Watching the debug logs, it appears that
>> the field is already parsed and is set to the *original* callerid name that
>> was available when the call came in...   Trying different variations of
>> field="caller_id_name" and field="${caller_id_name}" (and same with
>> effective_caller_id_name) still yields no joy.
>>
>> Any guidance?   The snippets from my dialplan are below.
>>
>> Thanks!
>>
>>
>>    <extension name="CID Inbound Lookup" continue="true">
>>         <condition field="ani" expression="(\d{10})">
>>             <action application="log" data="INFO In CID Inbound Lookup
>> '$1' -- The Second Time"/>
>>             <action application="log" data="INFO CIDLookup(before): CID
>> Num: '${caller_id_number}' CID Name: '${caller_id_name}' Orig CID Name:
>> '${original_caller_id_name}' Dest: '${destination_number}'"/>
>>
>>             <action application="set"
>> data="url=num=${caller_id_number}&name=${url_encode(${caller_id_name})}&did=${destination_number}"/>
>>             <action application="log" data="INFO CIDLookup(before): url:
>> '${url}'"/>
>>
>>             <action application="curl"
>> data="http://MYDOMAIN.com/MYCIDLOOKUP.php?${url}"/>
>>             <action application="info"/>
>>
>>             <action application="log" data="INFO CIDLookup(after ):
>> curl_response_code: ${curl_response_code}"/>
>>             <action application="log" data="INFO CIDLookup(after ):
>> curl_response_data: ${curl_response_data}"/>
>>
>>             <action application="set"
>> data="caller_id_name=${curl_response_data}"/>
>>             <action application="set"
>> data="effective_caller_id_name=${curl_response_data}"/>
>>
>>
>>             <action application="log" data="INFO CIDLookup(after ): CID
>> Num: '${caller_id_number}' CID Name: '${caller_id_name}' Orig CID Name:
>> '${original_caller_id_name}' Dest: '${destination_number}'"/>
>>             <action application="log" data="INFO CIDLookup(after ):
>> caller_id_name: '${caller_id_name}', original_caller_id_name:
>> '${original_caller_id_name}', effective_caller_id_name:
>> '${effective_caller_id_name}'" />
>>
>>             <!-- This event will be picked up by HB-Bot for announcing -->
>>             <action application="event"
>> data="Event-Name=CUSTOM,Event-Subclass=CallAnnounce,ani=${destination_number},cidnum=${caller_id_number},cidname=${caller_id_name}"/>
>>
>>         </condition>
>>     </extension>
>> and here are my test cases that are *right* after the above... but yet
>> can't pick up the change in variables.  *ONE* of these (I expect '3b' or
>> '1') should fire... none do.
>>
>>
>>
>>     <extension name="cid_test_0" continue="true">
>>        <condition field="original_caller_id_name" expression="TM" >
>>             <action application="log" data="INFO cid_test_0: :
>> '${original_caller_id_name}'"/>
>>        </condition>
>>     </extension>
>>
>>     <extension name="cid_test_1" continue="true">
>>        <condition field="caller_id_name" expression="TM" >
>>             <action application="log" data="INFO cid_test_1: :
>> '${caller_id_name}'"/>
>>        </condition>
>>     </extension>
>>
>>     <extension name="cid_test_2" continue="true">
>>        <condition field="effective_caller_id_name" expression="TM" >
>>             <action application="log" data="INFO cid_test_2: :
>> '${effective_caller_id_name}'"/>
>>        </condition>
>>     </extension>
>>
>>     <extension name="cid_test_3" continue="true">
>>        <condition field='${caller_id_name}' expression="TM" >
>>             <action application="log" data="INFO cid_test_3: :
>> '${caller_id_name}'"/>
>>        </condition>
>>     </extension>
>>
>>     <extension name="cid_test_3b" continue="true">
>>        <condition field="${caller_id_name}" expression="TM" >
>>             <action application="log" data="INFO cid_test_3b: :
>> '${caller_id_name}'"/>
>>        </condition>
>>     </extension>
>>
>>     <extension name="cid_test_4" continue="true">
>>        <condition field='${effective_caller_id_name}' expression="TM" >
>>             <action application="log" data="INFO cid_test_4: :
>> '${effective_caller_id_name}'"/>
>>        </condition>
>>     </extension>
>>
>>     <extension name="cid_test_5" continue="true">
>>        <condition field='${effective_caller_id_name}' expression="TM" >
>>             <action application="log" data="INFO cid_test_5: :
>> '${effective_caller_id_name}'"/>
>>        </condition>
>>     </extension>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.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



Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list