<p dir="ltr">Try remove &quot;()&quot; 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 &lt;<a href="mailto:dominique.jeannerod@interact-iv.com">dominique.jeannerod@interact-iv.com</a>&gt; 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&#39;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&#39;d like to use extensions to split a big dialplan, and make my configuration more readable.</div><div><br></div><div>I&#39;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>    &lt;extension name=&quot;N_called_FR&quot;&gt;<br></div><div><div>        &lt;!-- All numeric and non empty called number                    --&gt;</div><div>        &lt;condition field=&quot;${sip_req_user}&quot; expression=&quot;^\+?(\d+)$&quot; break=&quot;on-true&quot;&gt;</div><div>            &lt;condition regex=&quot;any&quot;&gt;</div><div>                &lt;!-- Called number in FR format                          --&gt;</div><div>                &lt;regex field=&quot;${sip_req_user}&quot; expression=&quot;^0(\d{9})$&quot;/&gt;<br></div><div>                &lt;regex field=&quot;${sip_req_user}&quot; expression=&quot;^33(\d{9})$&quot;/&gt;</div><div>                &lt;regex field=&quot;${sip_req_user}&quot; expression=&quot;^\+33(\d{9})$&quot;/&gt;</div><div>                &lt;regex field=&quot;${sip_req_user}&quot; expression=&quot;^0033(\d{9})$&quot;/&gt;</div><div><br></div><div>                &lt;action application=&quot;set&quot; data=&quot;iv_dest_number=0$1&quot;/&gt;<br></div><div>            &lt;/condition&gt;<br></div><div>        &lt;/condition&gt;</div><div>    &lt;/extension&gt;</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 &lt;33123456789&gt;-&gt;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-&gt;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>