[Freeswitch-users] Best place to set variables?

Dave R. Kompel drk at drkngs.net
Fri Jun 15 21:48:06 MSD 2012


Once a variable is set on a session (one leg) it presists till it's either "unset" or changed. Variables really don't have "default" values, there are just default ways that things work if the variables are not present. With that said you should only have to set variables like "hangup_after_bridge" and so on, only once on the A leg.  
   
The confusing part is what leg to set them on. The easiest way to figure that out, is to see how FS uses it. For example "hangup_after_bridge" is used by the Bridge application (actually in switch_ivr_bridge), so because it's an parameter that tells the bridge how to work, it needs to be set on the A leg. The bridge function connects two legs togetther, and the A leg is the one calling it.  
   
Other variables, the ones used for call origination, for example "origination_uuuid" are used to control how an outbound channel origiates the call. They could be used in the originate API call, with NO other leg preseent. If you are using them in a Bridge, then you must either set them on the B-Leg, or "export" them so that all new B-Legs created from the current, get those variables "cloned" to them.   
   
So in the case that you have more then one "Bridge" inside a condition, any variables you set with "set" will be there for each following bridge, however the ones you set in the channel of the bridge, the ones in the "[]" will not be there for the next ones. Becuase if the bridge fails, the B-Leg for that bridge is gone.  
   
--Dave
      _____  

  From: Avi Marcus [mailto:avi at avimarcus.net]
To: FreeSWITCH Users Help [mailto:freeswitch-users at lists.freeswitch.org]
Sent: Fri, 15 Jun 2012 07:40:49 -0700
Subject: Re: [Freeswitch-users] Best place to set variables?

No. They do persist for the whole <condition> just they aren't
necessarily checked by each bridge line.
-Avi


On Fri, Jun 15, 2012 at 5:30 PM, ocset <ocset at the800group.com> wrote:
> Thanks for your answer.
>
> What you are saying is that the "continue_on_fail=true" and
> "hangup_after_bridge=true" variables are set back to their default
> values in the"B" leg of the dailplan. I thought the variable that are
> set would persist for the whole <condition> section.
>
> Regards
> O
>
> On 15/06/12 21:47, Avi Marcus wrote:
>> Short answer: some variables are for the A leg, and some are for the B leg.
>> The two in their own set tags are for the A leg's execution of the
>> bridge.. whether it should keep trying or not.
>> The one inside the bridge is specific to that leg and bridge attempt
>> of how it should behave.
>>
>> Perhaps someone wants to give the longer answer, but I don't have time
>> right now.
>>
>> -Avi
>>
>>
>> On Fri, Jun 15, 2012 at 4:12 PM, ocset<ocset at the800group.com>  wrote:
>>> Hi
>>>
>>> In the FreeSWITCH-Cookbook, there is the following example
>>>
>>> <extension name="ring_sequentially">
>>> <condition field="destination_number" expression="^(2001)$">
>>> <action application="set" data="continue_on_fail=true"/>
>>> <action application="set" data="hangup_after_bridge=true"/>
>>> <action application="bridge"
>>> data={ignore_early_media=true}sofia/internal/userA at local.pbx.com"/>
>>> <action application="bridge"
>>> data={ignore_early_media=true}sofia/internal/userB at local.pbx.com"/>
>>> </condition>
>>> </extension>
>>>
>>> Is there any reason why the "ignore_early_media=true" was not set before
>>> the bridge commands as is done with the "continue_on_fail"  and
>>> "hangup_after_bridge" variables?
>>>
>>> Example:
>>>
>>> <extension name="ring_sequentially">
>>> <condition field="destination_number" expression="^(2001)$">
>>> <action application="set" data="continue_on_fail=true"/>
>>> <action application="set" data="hangup_after_bridge=true"/>
>>> <action application="set" data="ignore_early_media=true"/>
>>> <action application="bridge" data=sofia/internal/userA at local.pbx.com"/>
>>> <action application="bridge" data=sofia/internal/userB at local.pbx.com"/>
>>> </condition>
>>> </extension>
>>>
>>> Thanks
>>> O
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> Join Us At ClueCon - Aug 7-9, 2012
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> Join Us At ClueCon - Aug 7-9, 2012
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

Join Us At ClueCon - Aug 7-9, 2012

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
      
   
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120615/ee3b5797/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list