<div dir="ltr">In this example no difference between result of "<span style="font-size:12.8px">set_profile_var" and result of "set" 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>"<span style="font-size:12.8px">set_profile_var" 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"><<a href="mailto:s.safarov@gmail.com" target="_blank">s.safarov@gmail.com</a>></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">>Do you execute this inside your main dialplan, or inside and extension ?</div></span><div style="font-size:12.8px">In dialplan like "default".</div><span class=""><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">>What'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"><<a href="mailto:dominique.jeannerod@interact-iv.com" target="_blank">dominique.jeannerod@interact-iv.com</a>></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'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"><<a href="mailto:s.safarov@gmail.com" target="_blank">s.safarov@gmail.com</a>></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> <extension name="normalizeDestinationNumber" continue="true"></div><div> <!-- Normalizing destination_number --></div><div> <condition field="${destination_number}" expression="^\+?[\d\*\(\)\s-]*$"></div><div> <action application="set_profile_var"</div><div> data="destination_number=${replace ${destination_number}|-|'' }"</div><div> inline="true"/></div><div> <action application="set_profile_var"</div><div> data="destination_number=${replace ${destination_number}|(|'' }"</div><div> inline="true"/></div><div> <action application="set_profile_var"</div><div> data="destination_number=${replace ${destination_number}|)|'' }"</div><div> inline="true"/></div><div> <action application="set_profile_var"</div><div> data="destination_number=${replace ${destination_number}|\s|'' }"</div><div> inline="true"/></div><div> </condition></div><div> <condition field="${destination_number}" expression="^9(\d+)$" break="on-false"></div><div> <action application="set_profile_var" data="destination_number=$1" inline="true"/></div><div> </condition></div><div> <condition></div><div> <action application="set_profile_var"</div><div> data="destination_number=${translate ${destination_number} ${country}}"</div><div> inline="true"/></div><div> <action application="log" data="INFO New number ${destination_number}" inline="true"/></div><div> </condition></div><div> </extension></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><?xml version="1.0" encoding="UTF-8"?></div><div><include></div><div> <configuration name="translate.conf" description="Number Translation Rules"></div><div> <profiles></div><div> <profile name="Russia"></div><div> <rule regex="^(\+\d+)$" replace="$1"/></div><div> <rule regex="^810(\d+)$" replace="+$1"/></div><div> <rule regex="^8(\d{10})$" replace="+7$1"/></div><div> <rule regex="^(\d+)$" replace="+7${areacode}$1"/><br></div><div> </profile></div></div><div><div> </profile></div><div> </profiles></div><div> </configuration></div></div><div><div></include></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"><<a href="mailto:dominique.jeannerod@interact-iv.com" target="_blank">dominique.jeannerod@interact-iv.com</a>></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'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"><regex field="sip_req_user" expression="^0(\d{9})$"/> (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'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"><<a href="mailto:s.safarov@gmail.com" target="_blank">s.safarov@gmail.com</a>></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 "()" 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" target="_blank">dominique.jeannerod@interact-iv.com</a>> 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'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>
<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>