<p dir="ltr">Or try parse curl response in lua script.</p>
<br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 15, 2015, 19:59 Ken Rice &lt;<a href="mailto:krice@freeswitch.org">krice@freeswitch.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">If you are going to go thru all this trouble why not just use mod_xml_curl and get back the dialplan that needs to be executed in the first place… the dialplan is not meant to be a scripting language itself.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Ximo Peral<br><b>Sent:</b> Thursday, October 15, 2015 11:54 AM<br><b>To:</b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br><b>Subject:</b> [Freeswitch-users] Freeswitch - Regular Expression in Condition<u></u><u></u></span></p></div></div></div></div><div lang="EN-US" link="#0563C1" vlink="#954F72"><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal" style="margin-bottom:12.0pt;line-height:14.65pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">I have this condition on a dialplan:<u></u><u></u></span></p><pre style="background:#eeeeee;max-height:600px;word-wrap:normal;overflow:auto"><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&lt;condition</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">field</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;${curl_response_data}&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">expression</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;^(\+)?(\d{6})?(\d{4,15}|anonymous),(\d{6})?(\d{4,17}),(\d{3,5}),(\d{3,5}),(NP\d{3}|RG\d{4,8}|OP\d{6}|CUB\d{6}|CF\d{1}|ANF\d{3}|TLSIOS),?(NP\d{3}|OP\d{6}|CUB\d{6}|CF\d{1}|ANF\d{3})?,?(NP\d{3}|OP\d{6}|CUB\d{6}|CF\d{1}|ANF\d{3})?,?(NP\d{3}|OP\d{6}|CUB\d{6}|CF\d{1}|ANF\d{3})?,?(NP\d{3}|OP\d{6}|CUB\d{6}|CF\d{1}|ANF\d{3})?$&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">break</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;on-true&quot;</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&gt;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"><u></u><u></u></span></span></pre><pre style="background:#eeeeee"><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&lt;action</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">application</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;set&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">inline</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;true&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">data</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;auto_hunt=true&quot;</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">/&gt;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"><u></u><u></u></span></span></pre><pre style="background:#eeeeee"><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&lt;action</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">application</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;transfer&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">data</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;${num_dest} XML routing.Saliente&quot;</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">/&gt;</span></span><span style="font-family:Consolas;color:#393318"><u></u><u></u></span></pre><p class="MsoNormal" style="margin-bottom:12.0pt;line-height:14.65pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">And this curl response:<u></u><u></u></span></p><pre style="background:#eeeeee;max-height:600px;word-wrap:normal;overflow:auto"><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">+</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">34987654321</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">,</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">971234567</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">,</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">000</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">,</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">00001</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">,</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">CUB281281</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">,</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">CUB301993</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">,</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">OP024000</span></span><span style="font-family:Consolas;color:#393318"><u></u><u></u></span></pre><p class="MsoNormal" style="margin-bottom:12.0pt;line-height:14.65pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">But I do not get the transfer, the regular expression is not working.<u></u><u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;line-height:14.65pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">I tried this and if it works:<u></u><u></u></span></p><pre style="background:#eeeeee;max-height:600px;word-wrap:normal;overflow:auto"><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&lt;condition</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">field</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;${curl_response_data}&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">expression</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;^(\+)?(\d{6})?(\d{4,15}|anonymous),(\d{6})?(\d{9}),(\d{3,5}),(\d{3,5})(,(\w*))*$&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">break</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;on-true&quot;</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&gt;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"><u></u><u></u></span></span></pre><pre style="background:#eeeeee"><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&lt;action</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">application</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;set&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">inline</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;true&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">data</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;auto_hunt=true&quot;</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">/&gt;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"><u></u><u></u></span></span></pre><pre style="background:#eeeeee"><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">&lt;action</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">application</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;transfer&quot;</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in"> </span></span><span><span style="font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in">data</span></span><span><span style="font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in">=</span></span><span><span style="font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in">&quot;${num_dest} XML routing.Saliente&quot;</span></span><span><span style="font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in">/&gt;</span></span><span style="font-family:Consolas;color:#393318"><u></u><u></u></span></pre><p class="MsoNormal" style="margin-bottom:12.0pt;line-height:14.65pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">The problem is from the fourth comma<u></u><u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;line-height:14.65pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">Desperate, I tried it with this conditions and does not work!</span><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u><u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><i><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">&lt;condition field=&quot;${curl_response_data}&quot; expression=&quot;^(\+)?(\d{6})?(\d{4,15}|anonymous),(\d{6})?(\d{9}),(\d{3,5}),(\d{3,5}),CUB281281,CUB301993,OP024000$&quot; break=&quot;on-true&quot;&gt;</span></i><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u><u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">and</span><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u><u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><i><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">&lt;condition field=&quot;${curl_response_data}&quot; expression=&quot;^(\+)?(\d{6})?(\d{4,15}|anonymous),(\d{6})?(\d{9}),(\d{3,5}),(\d{3,5}),(CUB281281),(CUB301993),(OP024000)$&quot; break=&quot;on-true&quot;&gt;</span></i><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u><u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222">Any ideas??</span><span style="font-family:&quot;Calibri&quot;,sans-serif"><u></u><u></u></span></p></div></div></div>_________________________________________________________________________<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></blockquote></div>