[Freeswitch-users] Need to set and get Global vairables from dialplan

Ken Rice krice at freeswitch.org
Wed Mar 23 16:07:01 MSK 2016


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.

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.

 

In your example the vars are expanded before the set and log application
actions are actually executed.

 

See https://freeswitch.org/confluence/display/FREESWITCH/XML+Dialplan and
look for inline="true" for a more complete explanation on way to do what you
are trying.

 

 

From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Varsha
Agarwal
Sent: Wednesday, March 23, 2016 12:47 AM
To: FreeSWITCH-users at lists.freeswitch.org
Subject: [Freeswitch-users] Need to set and get Global vairables from
dialplan

 

Hi,

 

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? 

 

<extension name="balance_load">

      <condition field="destination_number" expression="^5050$">

                <action application="set" data="continue_on_fail=true"/>

                <action application="set" data="hangup_after_bridge=true"/>

                <action application="log" data="INFO *********LOG
LEVEL******** [${current_node}]"/>

                <condition field="current_node" expression="^1$">

                                <action="set_global" data="current_node=2"/>

                                <action application="log" data="INFO
*********LOG LEVEL******** [${current_node}]"/>

                                <action application="bridge"
data="loopback/5000"/>

                </condition>

                <condition field="current_node" expression="^2$">

                                <action="set_global" data="current_node=2"/>

                                <action application="log" data="INFO
*********LOG LEVEL******** [${current_node}]"/>

                                <action application="bridge"
data="sofia/external/5000 at 172.18.19.72
<mailto:sofia/external/5000 at 172.18.19.72> "/>

                </condition>

                <action="set_global" data="current_node=2"/>

                <action application="log" data="INFO *********LOG LEVEL
AFTER******** [${current_node}]"/>

                <action application="bridge" data="loopback/5000"/>

                

      </condition>

    </extension>

 

Currently log always print current_node = 1 which is the value set in
vars.xml. 

 

Thanks,

Varsha

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160323/6c87dcf7/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list