<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Thanks for the reply. I changed dialplan as following and still same results<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><!--Sample load balancing--><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <extension name="balance_load"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <condition field="destination_number" expression="^5050$"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="set" data="continue_on_fail=true"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="set" data="hangup_after_bridge=true"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="log" data="INFO *********LOG LEVEL******** [${current_node}]"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <condition field="${current_node}" expression="^1$">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action="set" data="current_node=2" inline="true"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="log" data="INFO *********LOG LEVEL******** [${current_node}]"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="bridge" data="loopback/5000"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </condition><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <condition field="${current_node}" expression="^2$"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action="set" data="current_node=1" inline="true"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="log" data="INFO *********LOG LEVEL******** [${current_node}]"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="bridge" data="sofia/external/5000@172.18.19.72"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </condition><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action="set" data="current_node=2" inline="true"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="log" data="INFO *********LOG LEVEL AFTER******** [${current_node}]"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <action application="bridge" data="loopback/5000"/><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </condition><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> </extension><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Interestingly this is what I see in Freeswitch traces<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">2016-03-23 11:07:22.895579 [INFO] mod_dptools.c:1692 *********LOG LEVEL******** [1]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">2016-03-23 11:07:22.895579 [INFO] mod_dptools.c:1692 *********LOG LEVEL AFTER******** [1]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">2016-03-23 11:07:22.895579 [INFO] mod_loopback.c:1075 Sending early media<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Even if value for "current_node" is 1 it does not go to <condition field="${current_node}" expression="^1$"> condition. At least it should go there.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org]
<b>On Behalf Of </b>Ken Rice<br>
<b>Sent:</b> Wednesday, March 23, 2016 6:07 AM<br>
<b>To:</b> 'FreeSWITCH Users Help'<br>
<b>Subject:</b> Re: [Freeswitch-users] Need to set and get Global vairables from dialplan<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As with any variables (channel or global) variables are expanded when the dialplan is processed, then a list of actions is built, based on conditions that are met. This is called the Routing Stage in FreeSWITCH Call Processing.<o:p></o:p></p>
<p class="MsoNormal">One that Routing Stage is completed, then we move to the Execute Stage where the Actions (or anti-actions) that were added to the list of things to do are executed.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In your example the vars are expanded before the set and log application actions are actually executed.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">See <a href="https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan">
https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan</a> and look for inline=”true” for a more complete explanation on way to do what you are trying.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">
freeswitch-users-bounces@lists.freeswitch.org</a> [<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">mailto:freeswitch-users-bounces@lists.freeswitch.org</a>]
<b>On Behalf Of </b>Varsha Agarwal<br>
<b>Sent:</b> Wednesday, March 23, 2016 12:47 AM<br>
<b>To:</b> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<b>Subject:</b> [Freeswitch-users] Need to set and get Global vairables from dialplan<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have created a variable in var.xml, current_node. I am trying to use it in dialplan as below, is this something I can do?
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><extension name="balance_load"><o:p></o:p></p>
<p class="MsoNormal"> <condition field="destination_number" expression="^5050$"><o:p></o:p></p>
<p class="MsoNormal"> <action application="set" data="continue_on_fail=true"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="set" data="hangup_after_bridge=true"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="log" data="INFO *********LOG LEVEL******** [${current_node}]"/><o:p></o:p></p>
<p class="MsoNormal"> <condition field="current_node" expression="^1$"><o:p></o:p></p>
<p class="MsoNormal"> <action="set_global" data="current_node=2"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="log" data="INFO *********LOG LEVEL******** [${current_node}]"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="bridge" data="loopback/5000"/><o:p></o:p></p>
<p class="MsoNormal"> </condition><o:p></o:p></p>
<p class="MsoNormal"> <condition field="current_node" expression="^2$"><o:p></o:p></p>
<p class="MsoNormal"> <action="set_global" data="current_node=2"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="log" data="INFO *********LOG LEVEL******** [${current_node}]"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="bridge" data="<a href="mailto:sofia/external/5000@172.18.19.72">sofia/external/5000@172.18.19.72</a>"/><o:p></o:p></p>
<p class="MsoNormal"> </condition><o:p></o:p></p>
<p class="MsoNormal"> <action="set_global" data="current_node=2"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="log" data="INFO *********LOG LEVEL AFTER******** [${current_node}]"/><o:p></o:p></p>
<p class="MsoNormal"> <action application="bridge" data="loopback/5000"/><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> </condition><o:p></o:p></p>
<p class="MsoNormal"> </extension><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Currently log always print current_node = 1 which is the value set in vars.xml.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Varsha<o:p></o:p></p>
</div>
</body>
</html>