<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I can’t say why the regex is giving you the array output, but I can show you a example how I resolved that to normalize the numbers to the IT Format.</div><div class="">I split them to different extensions and it’s not so easy to read, but maybe It helps you to understand.</div><div class="">The last part is calling cidlookup with the normalized number:</div><div class=""><br class=""></div><div class=""><div class="">&lt;extension name="cid_number_cleanup_italy" continue="true" inline="true"&gt;</div><div class="">&nbsp; &lt;condition field="caller_id_number" expression="^(?:\+39|0039)(\d+)$"&gt;</div><div class="">&nbsp; &nbsp; &lt;action application="set" data="effective_caller_id_number=$1" inline="true"/&gt;</div><div class="">&nbsp; &lt;/condition&gt;</div><div class="">&lt;/extension&gt;</div><div class="">&lt;extension name="cid_number_cleanup_other" continue="true" inline="true"&gt;</div><div class="">&nbsp; &lt;condition field="${effective_caller_id_number}" expression="^$"/&gt;</div><div class="">&nbsp; &lt;condition field="caller_id_number" expression="^(?:\+)(\d+)$"&gt;</div><div class="">&nbsp; &nbsp; &lt;action application="set" data="effective_caller_id_number=00$1"/&gt;</div><div class="">&nbsp; &lt;/condition&gt;</div><div class="">&lt;/extension&gt;</div><div class="">&lt;extension name="cid_name_cleanup" continue="true" inline="true"&gt;</div><div class="">&nbsp; &lt;condition field="${effective_caller_id_number}" expression="^$" inline="true"/&gt;</div><div class="">&nbsp; &lt;condition field="caller_id_name" expression="^(?:\+)(\d+)$"&gt;</div><div class="">&nbsp; &nbsp; &lt;action application="set" data="effective_caller_id_name=$1" inline="true"/&gt;</div><div class="">&nbsp; &lt;/condition&gt;</div><div class="">&lt;/extension&gt;</div><div class="">&lt;extension name="cid_lookup-1" continue="true" inline="true"&gt;</div><div class="">&nbsp; &lt;condition field="${module_exists(mod_cidlookup)}" expression="true"/&gt;</div><div class="">&nbsp; &lt;condition field="caller_id_name" expression="(\d+)$"/&gt;</div><div class="">&nbsp; &lt;condition field="${effective_caller_id_number}" expression="^$" inline="true"&gt;</div><div class="">&nbsp; &nbsp; &lt;anti-action application="cidlookup" data="${effective_caller_id_number}"/&gt;</div><div class="">&nbsp; &lt;/condition&gt;</div><div class="">&nbsp; &lt;condition field="caller_id_number" expression="(\d+)$"&gt;</div><div class="">&nbsp; &nbsp; &lt;action application="cidlookup" data="$1"/&gt;</div><div class="">&nbsp; &nbsp; &lt;anti-action application="cidlookup" data="${effective_caller_id_number}"/&gt;</div><div class="">&nbsp; &lt;/condition&gt;</div><div class="">&lt;/extension&gt;</div><div class="">&lt;extension name="verify-caller-name" continue="true" inline="true"&gt;</div><div class="">&nbsp; &lt;condition field="${caller_id_name}" expression="UNKNOWN"&gt;</div><div class="">&nbsp; &nbsp; &lt;action application="log" data="INFO callee_id_name is UNKNOWN reset to caller_id_number '${caller_id_number}'"/&gt;</div><div class="">&nbsp; &nbsp; &lt;action application="set" data="effective_caller_id_name=${caller_id_number}"/&gt;</div><div class="">&nbsp; &nbsp; &lt;anti-action application="log" data="INFO caller_id_name is known as '${caller_id_name}'"/&gt;</div><div class="">&nbsp; &lt;/condition&gt;</div><div class="">&lt;/extension&gt;</div></div><div class=""><br class=""></div><div class="">Raphael</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 29 Sep 2015, at 12:20, Dominique Jeannerod &lt;<a href="mailto:dominique.jeannerod@interact-iv.com" class="">dominique.jeannerod@interact-iv.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello,<div class=""><br class=""></div><div class="">i'm trying to call an extension, to normalize the called number to FR format, needed by an external operator SIP trunk, using the sip_req_user variable, and set a variable iv_dest_number to bridge the call using the normalized dest number.</div><div class="">I'd like to use extensions to split a big dialplan, and make my configuration more readable.</div><div class=""><br class=""></div><div class="">I'm quite confused by the way the regex is returning the $1 variable inside this extension : ARRAY</div><div class="">This same code is working without problem inside the main dialplan.</div><div class=""><br class=""></div><div class="">What am i doing wrong ?</div><div class="">What would be the best way to do that ?</div><div class=""><br class=""></div><div class="">Thanks with anticipation for any advice</div><div class=""><br class=""></div><div class="">Extension :</div><div class="">&nbsp; &nbsp; &lt;extension name="N_called_FR"&gt;<br class=""></div><div class=""><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- All numeric and non empty called number &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;condition field="${sip_req_user}" expression="^\+?(\d+)$" break="on-true"&gt;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;condition regex="any"&gt;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;!-- Called number in FR format &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--&gt;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;regex field="${sip_req_user}" expression="^0(\d{9})$"/&gt;<br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;regex field="${sip_req_user}" expression="^33(\d{9})$"/&gt;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;regex field="${sip_req_user}" expression="^\+33(\d{9})$"/&gt;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;regex field="${sip_req_user}" expression="^0033(\d{9})$"/&gt;</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action application="set" data="iv_dest_number=0$1"/&gt;<br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/condition&gt;<br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/condition&gt;</div><div class="">&nbsp; &nbsp; &lt;/extension&gt;</div></div><div class=""><br class=""></div><div class="">Freeswitch log :</div><div class=""><div class=""><div class="">EXECUTE sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> execute_extension(N_called_FR XML iv_common_N_called)</div><div class="">2015-09-29 12:09:34.644195 [INFO] mod_dialplan_xml.c:635 Processing Test &lt;33123456789&gt;-&gt;N_called_FR in context iv_common_N_called</div><div class="">Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> parsing [iv_common_N_called-&gt;N_called_FR] continue=false</div><div class="">|--- Dialplan: Processing recursive conditions level:1 [N_called_FR_recur_1] require-nested=TRUE</div><div class="">|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> Regex (FAIL) [N_called_FR_recur_1] ${sip_req_user}(0698778763) =~ /^([1-9]\d{8})$/ match=any</div><div class="">|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> Regex (PASS) [N_called_FR_recur_1] ${sip_req_user}(0698778763) =~ /^0(\d{9})$/ match=any</div><div class="">|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> Action log(INFO N_called_FR : FR Called number)</div><div class="">|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> Action set(iv_dest_number=0RRAY::04)</div><div class="">Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> Regex (PASS) [N_called_FR] ${sip_req_user}(0698778763) =~ /^\+?(\d+)$/ break=on-true</div><div class="">2015-09-29 12:09:34.644195 [NOTICE] switch_core_session.c:2866 Execute log(INFO N_called_FR : FR Called number)</div><div class="">EXECUTE sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> log(INFO N_called_FR : FR Called number)</div><div class="">2015-09-29 12:09:34.644195 [INFO] mod_dptools.c:1670 N_called_FR : FR Called number</div><div class="">2015-09-29 12:09:34.644195 [NOTICE] switch_core_session.c:2866 Execute set(iv_dest_number=0RRAY::04)</div><div class="">EXECUTE sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> set(iv_dest_number=0RRAY::04)</div><div class="">2015-09-29 12:09:34.644195 [DEBUG] mod_dptools.c:1477 sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" class="">33123456789@10.199.16.172</a> SET [iv_dest_number]=[0RRAY::04]</div></div></div><div class=""><br class=""></div><div class="">D. Jeannerod</div></div>
_________________________________________________________________________<br class="">Professional FreeSWITCH Consulting Services: <br class=""><a href="mailto:consulting@freeswitch.org" class="">consulting@freeswitch.org</a><br class="">http://www.freeswitchsolutions.com<br class=""><br class="">Official FreeSWITCH Sites<br class="">http://www.freeswitch.org<br class="">http://confluence.freeswitch.org<br class="">http://www.cluecon.com<br class=""><br class="">FreeSWITCH-users mailing list<br class="">FreeSWITCH-users@lists.freeswitch.org<br class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br class="">UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br class="">http://www.freeswitch.org</div></blockquote></div><br class=""></div></body></html>