<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div>But the expression is malformed?</div><div><br></div><div>The dialplan is very big for editing now.</div><br><div><hr id="stopSpelling">From: s.safarov@gmail.com<br>Date: Thu, 15 Oct 2015 17:08:59 +0000<br>To: freeswitch-users@lists.freeswitch.org<br>Subject: Re: [Freeswitch-users] Freeswitch - Regular Expression in Condition<br><br><p dir="ltr">Or try parse curl response in lua script.</p>
<br><div class="ecxgmail_quote"><div dir="ltr">On Thu, Oct 15, 2015, 19:59&nbsp;Ken Rice &lt;<a href="mailto:krice@freeswitch.org">krice@freeswitch.org</a>&gt; wrote:<br></div><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;"><div lang="EN-US"><div><p class="ecxMsoNormal"><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="ecxMsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d;"><u></u>&nbsp;<u></u></span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d;"><u></u>&nbsp;<u></u></span></p><p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d;"><u></u>&nbsp;<u></u></span></p><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in;"><p class="ecxMsoNormal"><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"><div><p class="ecxMsoNormal"><u></u>&nbsp;<u></u></p><div><p class="ecxMsoNormal" style="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;">"${curl_response_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: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;">"^(\+)?(\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})?$"</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;">"on-true"</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;">"set"</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;">"true"</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;">"auto_hunt=true"</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;">"transfer"</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;">"${num_dest} XML routing.Saliente"</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="ecxMsoNormal" style="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="ecxMsoNormal" style="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="ecxMsoNormal" style="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;">"${curl_response_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: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;">"^(\+)?(\d{6})?(\d{4,15}|anonymous),(\d{6})?(\d{9}),(\d{3,5}),(\d{3,5})(,(\w*))*$"</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;">"on-true"</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;">"set"</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;">"true"</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;">"auto_hunt=true"</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;">"transfer"</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;">"${num_dest} XML routing.Saliente"</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="ecxMsoNormal" style="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="ecxMsoNormal" style="line-height:14.65pt;background:white;"><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222;"><u></u>&nbsp;<u></u></span></p><p class="ecxMsoNormal" style="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="ecxMsoNormal" style="background:white;"><span style="font-family:&quot;Calibri&quot;,sans-serif;"><u></u>&nbsp;<u></u></span></p><p class="ecxMsoNormal" style="background:white;"><i><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222;">&lt;condition field="${curl_response_data}" expression="^(\+)?(\d{6})?(\d{4,15}|anonymous),(\d{6})?(\d{9}),(\d{3,5}),(\d{3,5}),CUB281281,CUB301993,OP024000$" break="on-true"&gt;</span></i><span style="font-family:&quot;Calibri&quot;,sans-serif;"><u></u><u></u></span></p><p class="ecxMsoNormal" style="background:white;"><span style="font-family:&quot;Calibri&quot;,sans-serif;"><u></u>&nbsp;<u></u></span></p><p class="ecxMsoNormal" style="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="ecxMsoNormal" style="background:white;"><span style="font-family:&quot;Calibri&quot;,sans-serif;"><u></u>&nbsp;<u></u></span></p><p class="ecxMsoNormal" style="background:white;"><i><span style="font-size:11.5pt;font-family:&quot;Helvetica&quot;,sans-serif;color:#222222;">&lt;condition field="${curl_response_data}" expression="^(\+)?(\d{6})?(\d{4,15}|anonymous),(\d{6})?(\d{9}),(\d{3,5}),(\d{3,5}),(CUB281281),(CUB301993),(OP024000)$" break="on-true"&gt;</span></i><span style="font-family:&quot;Calibri&quot;,sans-serif;"><u></u><u></u></span></p><p class="ecxMsoNormal" style="background:white;"><span style="font-family:&quot;Calibri&quot;,sans-serif;"><u></u>&nbsp;<u></u></span></p><p class="ecxMsoNormal" style="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>
<br>_________________________________________________________________________
Professional FreeSWITCH Consulting Services: 
consulting@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org</div>                                               </div></body>
</html>