<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.pln
        {mso-style-name:pln;}
span.tag
        {mso-style-name:tag;}
span.atn
        {mso-style-name:atn;}
span.pun
        {mso-style-name:pun;}
span.atv
        {mso-style-name:atv;}
span.lit
        {mso-style-name:lit;}
span.EmailStyle27
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",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&#8230; the dialplan is not meant to be a scripting language itself.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p>&nbsp;</o:p></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:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] <b>On Behalf Of </b>Ximo Peral<br><b>Sent:</b> Thursday, October 15, 2015 11:54 AM<br><b>To:</b> freeswitch-users@lists.freeswitch.org<br><b>Subject:</b> [Freeswitch-users] Freeswitch - Regular Expression in Condition<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:14.65pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>I have this condition on a dialplan:<o:p></o:p></span></p><pre style='background:#EEEEEE;max-height: 600px;word-wrap: normal;overflow:auto'><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&lt;condition</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>field</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;${curl_response_data}&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>expression</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><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 class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>break</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;on-true&quot;</span></span><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&gt;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'><o:p></o:p></span></span></pre><pre style='background:#EEEEEE'><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&lt;action</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>application</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;set&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>inline</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;true&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>data</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;auto_hunt=true&quot;</span></span><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>/&gt;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'><o:p></o:p></span></span></pre><pre style='background:#EEEEEE'><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&lt;action</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>application</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;transfer&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>data</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;${num_dest} XML routing.Saliente&quot;</span></span><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>/&gt;</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p class=MsoNormal style='margin-bottom:12.0pt;line-height:14.65pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>And this curl response:<o:p></o:p></span></p><pre style='background:#EEEEEE;max-height: 600px;word-wrap: normal;overflow:auto'><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>+</span></span><span class=lit><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>34987654321</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>,</span></span><span class=lit><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>971234567</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>,</span></span><span class=lit><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>000</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>,</span></span><span class=lit><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>00001</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>,</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>CUB281281</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>,</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>CUB301993</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>,</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>OP024000</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p class=MsoNormal style='margin-bottom:12.0pt;line-height:14.65pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>But I do not get the transfer, the regular expression is not working.<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;line-height:14.65pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>I tried this and if it works:<o:p></o:p></span></p><pre style='background:#EEEEEE;max-height: 600px;word-wrap: normal;overflow:auto'><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&lt;condition</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>field</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;${curl_response_data}&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>expression</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><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 class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>break</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;on-true&quot;</span></span><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&gt;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'><o:p></o:p></span></span></pre><pre style='background:#EEEEEE'><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&lt;action</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>application</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;set&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>inline</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;true&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>data</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;auto_hunt=true&quot;</span></span><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>/&gt;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'><o:p></o:p></span></span></pre><pre style='background:#EEEEEE'><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>&lt;action</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>application</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;transfer&quot;</span></span><span class=pln><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'> </span></span><span class=atn><span style='font-family:Consolas;color:red;border:none windowtext 1.0pt;padding:0in'>data</span></span><span class=pun><span style='font-family:Consolas;color:black;border:none windowtext 1.0pt;padding:0in'>=</span></span><span class=atv><span style='font-family:Consolas;color:blue;border:none windowtext 1.0pt;padding:0in'>&quot;${num_dest} XML routing.Saliente&quot;</span></span><span class=tag><span style='font-family:Consolas;color:maroon;border:none windowtext 1.0pt;padding:0in'>/&gt;</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p class=MsoNormal style='margin-bottom:12.0pt;line-height:14.65pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>The problem is from the fourth comma<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;line-height:14.65pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>Desperate, I tried it with this conditions and does not work!</span><span style='font-family:"Calibri",sans-serif'><o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-family:"Calibri",sans-serif'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><i><span style='font-size:11.5pt;font-family:"Helvetica",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:"Calibri",sans-serif'><o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-family:"Calibri",sans-serif'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>and</span><span style='font-family:"Calibri",sans-serif'><o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-family:"Calibri",sans-serif'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><i><span style='font-size:11.5pt;font-family:"Helvetica",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:"Calibri",sans-serif'><o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-family:"Calibri",sans-serif'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;background:white'><span style='font-size:11.5pt;font-family:"Helvetica",sans-serif;color:#222222'>Any ideas??</span><span style='font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div></div></body></html>