<div dir="ltr">In this example no difference between result of &quot;<span style="font-size:12.8px">set_profile_var&quot; and result of &quot;set&quot; application. You can see only difference in xml_cdr files.</span><div><span style="font-size:12.8px">It important for other application that use caller_id variables. For all cases related to caller_id I use </span>&quot;<span style="font-size:12.8px">set_profile_var&quot; application.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Sergey<br></span><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 5:57 PM, Sergey Safarov <span dir="ltr">&lt;<a href="mailto:s.safarov@gmail.com" target="_blank">s.safarov@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span class=""><div style="font-size:12.8px">&gt;Do you execute this inside your main dialplan, or inside and extension ?</div></span><div style="font-size:12.8px">In dialplan like &quot;default&quot;.</div><span class=""><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">&gt;What&#39;s the difference between set and set_profile_var ?</div></span><div style="font-size:12.8px">It sets caller_id_name number directly to caller_profile and allow set calledid that cannot be setted via effective_caller_id</div><span class=""><font color="#888888"><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Sergey</div><div style="font-size:12.8px"><br></div></font></span></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 5:28 PM, Dominique Jeannerod <span dir="ltr">&lt;<a href="mailto:dominique.jeannerod@interact-iv.com" target="_blank">dominique.jeannerod@interact-iv.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Thank you very much Sergey, for this valuable example.<div>Do you execute this inside your main dialplan, or inside and extension ?</div><div>What&#39;s the difference between set and set_profile_var ?</div></div><div class="gmail_extra"><span><br clear="all"><div><div><div dir="ltr"><div><p><font face="verdana, sans-serif"><b><span lang="EN-US"><span></span><span></span>Dominique
Jeannerod</span></b><span lang="EN-US"></span></font></p>

<p><span lang="EN-US"><i><font face="verdana, sans-serif">Interact-iv.com</font></i></span></p><font face="verdana, sans-serif">Mobile: +33 698 778 763<br><font size="1"><br></font></font><div><font face="verdana, sans-serif"><font size="1">Headquarter : 600 rue Felix Trombe – tecnosud – 66100 Perpignan - France</font><br><font size="1">France : 0826 10 23 21 (0,15€/mn) International +33 (0)4 20 10 45 45</font></font></div></div></div></div></div>
<br></span><div><div><div class="gmail_quote">2015-09-30 16:08 GMT+02:00 Sergey Safarov <span dir="ltr">&lt;<a href="mailto:s.safarov@gmail.com" target="_blank">s.safarov@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">From my dialplan<div><br></div><div><div><br></div><div>      &lt;extension name=&quot;normalizeDestinationNumber&quot; continue=&quot;true&quot;&gt;</div><div>         &lt;!-- Normalizing destination_number --&gt;</div><div>         &lt;condition field=&quot;${destination_number}&quot; expression=&quot;^\+?[\d\*\(\)\s-]*$&quot;&gt;</div><div>            &lt;action application=&quot;set_profile_var&quot;</div><div>                    data=&quot;destination_number=${replace ${destination_number}|-|&#39;&#39; }&quot;</div><div>                    inline=&quot;true&quot;/&gt;</div><div>            &lt;action application=&quot;set_profile_var&quot;</div><div>                    data=&quot;destination_number=${replace ${destination_number}|(|&#39;&#39; }&quot;</div><div>                    inline=&quot;true&quot;/&gt;</div><div>            &lt;action application=&quot;set_profile_var&quot;</div><div>                    data=&quot;destination_number=${replace ${destination_number}|)|&#39;&#39; }&quot;</div><div>                    inline=&quot;true&quot;/&gt;</div><div>            &lt;action application=&quot;set_profile_var&quot;</div><div>                    data=&quot;destination_number=${replace ${destination_number}|\s|&#39;&#39; }&quot;</div><div>                    inline=&quot;true&quot;/&gt;</div><div>         &lt;/condition&gt;</div><div>         &lt;condition field=&quot;${destination_number}&quot; expression=&quot;^9(\d+)$&quot; break=&quot;on-false&quot;&gt;</div><div>            &lt;action application=&quot;set_profile_var&quot; data=&quot;destination_number=$1&quot; inline=&quot;true&quot;/&gt;</div><div>         &lt;/condition&gt;</div><div>         &lt;condition&gt;</div><div>            &lt;action application=&quot;set_profile_var&quot;</div><div>                    data=&quot;destination_number=${translate ${destination_number} ${country}}&quot;</div><div>                    inline=&quot;true&quot;/&gt;</div><div>            &lt;action application=&quot;log&quot; data=&quot;INFO New number ${destination_number}&quot; inline=&quot;true&quot;/&gt;</div><div>         &lt;/condition&gt;</div><div>      &lt;/extension&gt;</div></div><div><br></div><div>and </div><div><br></div><div><br></div><div><div>[root@voip freeswitch]# cat autoload_configs/translate.conf.xml</div><div>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</div><div>&lt;include&gt;</div><div>   &lt;configuration name=&quot;translate.conf&quot; description=&quot;Number Translation Rules&quot;&gt;</div><div>      &lt;profiles&gt;</div><div>         &lt;profile name=&quot;Russia&quot;&gt;</div><div>            &lt;rule regex=&quot;^(\+\d+)$&quot; replace=&quot;$1&quot;/&gt;</div><div>            &lt;rule regex=&quot;^810(\d+)$&quot; replace=&quot;+$1&quot;/&gt;</div><div>            &lt;rule regex=&quot;^8(\d{10})$&quot; replace=&quot;+7$1&quot;/&gt;</div><div>            &lt;rule regex=&quot;^(\d+)$&quot; replace=&quot;+7${areacode}$1&quot;/&gt;<br></div><div>         &lt;/profile&gt;</div></div><div><div>         &lt;/profile&gt;</div><div>      &lt;/profiles&gt;</div><div>   &lt;/configuration&gt;</div></div><div><div>&lt;/include&gt;</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 4:12 PM, Dominique Jeannerod <span dir="ltr">&lt;<a href="mailto:dominique.jeannerod@interact-iv.com" target="_blank">dominique.jeannerod@interact-iv.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I tried to remove the () on the first regex : same result (and problem with ARRAY result)<div>I didn&#39;t try to remove them on the other regex, as I want to catch the 9 digits and set a variable</div><div><br></div><div>I also tried the syntax <span style="font-size:12.8px">&lt;regex field=&quot;sip_req_user&quot; expression=&quot;^0(\d{9})$&quot;/&gt; (without the ${}), but in this case, the variable seems empty (which is not the case as seen with the info app)</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I&#39;m just trying to :</span></div><div><span style="font-size:12.8px">- Call an extension to check the destination number</span></div><div><span style="font-size:12.8px">- Normalise the dest number and modify it (or set a custom variable)</span></div><div><span style="font-size:12.8px">- Return to the main dialplan to route the call</span></div><div><span style="font-size:12.8px"><br></span></div><div>I still stuck on that. Does someone have any advice or a working example ?</div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><p><font face="verdana, sans-serif"><b><span lang="EN-US"><span></span><span></span>Dominique
Jeannerod</span></b><span lang="EN-US"></span></font></p>

<p><span lang="EN-US"><i><font face="verdana, sans-serif">Interact-iv.com</font></i></span></p><font face="verdana, sans-serif">Mobile: +33 698 778 763<br><font size="1"><br></font></font><div><font face="verdana, sans-serif"><font size="1">Headquarter : 600 rue Felix Trombe – tecnosud – 66100 Perpignan - France</font><br><font size="1">France : 0826 10 23 21 (0,15€/mn) International <a href="tel:%2B33%20%280%294%2020%2010%2045%2045" value="+33420104545" target="_blank">+33 (0)4 20 10 45 45</a></font></font></div></div></div></div></div><div><div>
<br><div class="gmail_quote">2015-09-29 18:04 GMT+02:00 Sergey Safarov <span dir="ltr">&lt;<a href="mailto:s.safarov@gmail.com" target="_blank">s.safarov@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><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" target="_blank">dominique.jeannerod@interact-iv.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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>
<br>_________________________________________________________________________<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><br></blockquote></div><br></div></div></div>
<br>_________________________________________________________________________<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><br></blockquote></div><br></div>
<br>_________________________________________________________________________<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><br></blockquote></div><br></div></div></div>
<br>_________________________________________________________________________<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><br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>