<p dir="ltr">Try remove "()" symbols in first condition or all regex.</p>
<br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 29, 2015, 18:26 Dominique Jeannerod <<a href="mailto:dominique.jeannerod@interact-iv.com">dominique.jeannerod@interact-iv.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>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>I'd like to use extensions to split a big dialplan, and make my configuration more readable.</div><div><br></div><div>I'm quite confused by the way the regex is returning the $1 variable inside this extension : ARRAY</div><div>This same code is working without problem inside the main dialplan.</div><div><br></div><div>What am i doing wrong ?</div><div>What would be the best way to do that ?</div><div><br></div><div>Thanks with anticipation for any advice</div><div><br></div><div>Extension :</div><div> <extension name="N_called_FR"><br></div><div><div> <!-- All numeric and non empty called number --></div><div> <condition field="${sip_req_user}" expression="^\+?(\d+)$" break="on-true"></div><div> <condition regex="any"></div><div> <!-- Called number in FR format --></div><div> <regex field="${sip_req_user}" expression="^0(\d{9})$"/><br></div><div> <regex field="${sip_req_user}" expression="^33(\d{9})$"/></div><div> <regex field="${sip_req_user}" expression="^\+33(\d{9})$"/></div><div> <regex field="${sip_req_user}" expression="^0033(\d{9})$"/></div><div><br></div><div> <action application="set" data="iv_dest_number=0$1"/><br></div><div> </condition><br></div><div> </condition></div><div> </extension></div></div><div><br></div><div>Freeswitch log :</div><div><div><div>EXECUTE sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> execute_extension(N_called_FR XML iv_common_N_called)</div><div>2015-09-29 12:09:34.644195 [INFO] mod_dialplan_xml.c:635 Processing Test <33123456789>->N_called_FR in context iv_common_N_called</div><div>Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> parsing [iv_common_N_called->N_called_FR] continue=false</div><div>|--- Dialplan: Processing recursive conditions level:1 [N_called_FR_recur_1] require-nested=TRUE</div><div>|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">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>|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> Regex (PASS) [N_called_FR_recur_1] ${sip_req_user}(0698778763) =~ /^0(\d{9})$/ match=any</div><div>|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> Action log(INFO N_called_FR : FR Called number)</div><div>|--- Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> Action set(iv_dest_number=0RRAY::04)</div><div>Dialplan: sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> Regex (PASS) [N_called_FR] ${sip_req_user}(0698778763) =~ /^\+?(\d+)$/ break=on-true</div><div>2015-09-29 12:09:34.644195 [NOTICE] switch_core_session.c:2866 Execute log(INFO N_called_FR : FR Called number)</div><div>EXECUTE sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> log(INFO N_called_FR : FR Called number)</div><div>2015-09-29 12:09:34.644195 [INFO] mod_dptools.c:1670 N_called_FR : FR Called number</div><div>2015-09-29 12:09:34.644195 [NOTICE] switch_core_session.c:2866 Execute set(iv_dest_number=0RRAY::04)</div><div>EXECUTE sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> set(iv_dest_number=0RRAY::04)</div><div>2015-09-29 12:09:34.644195 [DEBUG] mod_dptools.c:1477 sofia/external_trk/<a href="mailto:33123456789@10.199.16.172" target="_blank">33123456789@10.199.16.172</a> SET [iv_dest_number]=[0RRAY::04]</div></div></div><div><br></div><div>D. Jeannerod</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>