<div dir="ltr">The dialplan is run in two stages - hunting and execution.<div><br></div><div>In hunting it will look through the extensions for any where the the conditions match and puts the actions together into a list. It then executes that list of actions in order. As a result it&#39;s checking the effective_caller_id_name condition before the action that sets the variable has been executed.</div><div><br></div><div>As a workaround if you run &#39;transfer&#39; that will perform a new dialplan hunt generating a new list of actions to execute. If you set the variable then transfer, then the conditions in the new hunt will have the variable already set.</div><div><br></div><div>Another option is using inline=&quot;true&quot; on the set action. That will execute the action during the hunt itself.</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 23 July 2015 at 22:36, David S. Dee <span dir="ltr">&lt;<a href="mailto:dsdee@dsba.net" target="_blank">dsdee@dsba.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>




<div><div>Hello;<br></div>
<div> </div>
<div>I&#39;ve been a freeswitch user for some time, but I am finally getting around to trying to get idea working again.<br></div>
<div> </div>
<div>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.<br></div>
<div> </div>
<div>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 &quot;FOO Marketing&quot;, then after the cid-extension runs, the caller_id_name and effective_caller_name to &quot;TM:FOO Marketing&quot;....<br></div>
<div> </div>
<div>What is -not- working is the routing.<br></div>
<div> </div>
<div>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=&quot;caller_id_name&quot; and field=&quot;${caller_id_name}&quot; (and same with effective_caller_id_name) still yields no joy.<br></div>
<div> </div>
<div>Any guidance?   The snippets from my dialplan are below.<br></div>
<div> </div>
<div>Thanks!<br></div>
<div> </div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">   &lt;extension name=&quot;CID Inbound Lookup&quot; continue=&quot;true&quot;&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">        &lt;condition field=&quot;ani&quot; expression=&quot;(\d{10})&quot;&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO In CID Inbound Lookup &#39;$1&#39; -- The Second Time&quot;/&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO CIDLookup(before): CID Num: &#39;${caller_id_number}&#39; CID Name: &#39;${caller_id_name}&#39; Orig CID Name: &#39;${original_caller_id_name}&#39; Dest: &#39;${destination_number}&#39;&quot;/&gt;<br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;set&quot; data=&quot;url=num=${caller_id_number}&amp;name=${url_encode(${caller_id_name})}&amp;did=${destination_number}&quot;/&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO CIDLookup(before): url: &#39;${url}&#39;&quot;/&gt;<br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;curl&quot; data=&quot;</span><a href="http://www.dsba.net/voip/cidlookup.php?$%7Burl%7D%22/" target="_blank"><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">http://MYDOMAIN.com/MYCIDLOOKUP.php?${url}&quot;/</span></a><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;info&quot;/&gt;<br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO CIDLookup(after ): curl_response_code: ${curl_response_code}&quot;/&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO CIDLookup(after ): curl_response_data: ${curl_response_data}&quot;/&gt;<br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;set&quot; data=&quot;caller_id_name=${curl_response_data}&quot;/&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_name=${curl_response_data}&quot;/&gt;<br></span></div>
<div> </div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO CIDLookup(after ): CID Num: &#39;${caller_id_number}&#39; CID Name: &#39;${caller_id_name}&#39; Orig CID Name: &#39;${original_caller_id_name}&#39; Dest: &#39;${destination_number}&#39;&quot;/&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO CIDLookup(after ): caller_id_name: &#39;${caller_id_name}&#39;, original_caller_id_name: &#39;${original_caller_id_name}&#39;, effective_caller_id_name: &#39;${effective_caller_id_name}&#39;&quot; /&gt;<br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;!-- This event will be picked up by HB-Bot for announcing --&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;event&quot; data=&quot;Event-Name=CUSTOM,Event-Subclass=CallAnnounce,ani=${destination_number},cidnum=${caller_id_number},cidname=${caller_id_name}&quot;/&gt;<br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">        &lt;/condition&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;<br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">and here are my test cases that are *right* after the above... but yet can&#39;t pick up the change in variables.  *ONE* of these (I expect &#39;3b&#39; or &#39;1&#39;) should fire... none do.<br></span></div>
<div> </div>
<div> </div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;extension name=&quot;cid_test_0&quot; continue=&quot;true&quot;&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;condition field=&quot;original_caller_id_name&quot; expression=&quot;TM&quot; &gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO cid_test_0: : &#39;${original_caller_id_name}&#39;&quot;/&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;/condition&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;extension name=&quot;cid_test_1&quot; continue=&quot;true&quot;&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;condition field=&quot;caller_id_name&quot; expression=&quot;TM&quot; &gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO cid_test_1: : &#39;${caller_id_name}&#39;&quot;/&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;/condition&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;extension name=&quot;cid_test_2&quot; continue=&quot;true&quot;&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;condition field=&quot;effective_caller_id_name&quot; expression=&quot;TM&quot; &gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO cid_test_2: : &#39;${effective_caller_id_name}&#39;&quot;/&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;/condition&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;extension name=&quot;cid_test_3&quot; continue=&quot;true&quot;&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;condition field=&#39;${caller_id_name}&#39; expression=&quot;TM&quot; &gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO cid_test_3: : &#39;${caller_id_name}&#39;&quot;/&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;/condition&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;extension name=&quot;cid_test_3b&quot; continue=&quot;true&quot;&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;condition field=&quot;${caller_id_name}&quot; expression=&quot;TM&quot; &gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO cid_test_3b: : &#39;${caller_id_name}&#39;&quot;/&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;/condition&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;extension name=&quot;cid_test_4&quot; continue=&quot;true&quot;&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;condition field=&#39;${effective_caller_id_name}&#39; expression=&quot;TM&quot; &gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO cid_test_4: : &#39;${effective_caller_id_name}&#39;&quot;/&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;/condition&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div> </div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;extension name=&quot;cid_test_5&quot; continue=&quot;true&quot;&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;condition field=&#39;${effective_caller_id_name}&#39; expression=&quot;TM&quot; &gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">            &lt;action application=&quot;log&quot; data=&quot;INFO cid_test_5: : &#39;${effective_caller_id_name}&#39;&quot;/&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">       &lt;/condition&gt;</span><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif"><br></span></div>
<div><span style="font-family:menlo,consolas,&quot;courier new&quot;,monospace,sans-serif">    &lt;/extension&gt;</span><br></div>
</div>

<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div></div>