Set variable for context for condition via Commandline

Status
Not open for further replies.

haglo

New Member
May 14, 2021
8
0
1
63
I set in my dialplan in context default via xml in extension TOD the variable office_status:
XML:
<include>
  <context name="default">
    <extension name="TOD" continue="true">
      <condition wday="2-6" hour="8-12" break="never">
        <action application="set" data="office_status=open" inline="true"/>
        <anti-action application="set" data="office_status=closed" inline="true"/>
      </condition>
    </extension>
  </context>
</include>

Is it possible to set the variable office_status for context default via fs_cli
Something like this:
Code:
fs_cli -x "set office_status=closed"

I want set the variable office_closed for context default via commandexecution on linux.
it would be like:
Code:
fs_cli -x "global_setvar office_status=closed"

But i want it for context default, not global.
 
Last edited:

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
The simplest way would be to put it in your dialplan near the top along with call-direction, variables etc. Then the variable will get set for every call that passes through the dial plan. (Menu->Dialplan->Dialplan manager).
 

haglo

New Member
May 14, 2021
8
0
1
63
Thanks for your answer, but i use freeswitch, not fusionpbx
i must configure it on the commandline.
 

haglo

New Member
May 14, 2021
8
0
1
63
this i have done and it works, but i must to set it via Linuxconsole.
On linuxconsole i must execute a commant which sets the variable.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
You cannot set a channel variable this way because they only exist when the channel is created. But you could probably use a global variable:

fs_cli -x "global_setvar testvar=hello"
fs_cli -x "global_getvar testvar"
 
Status
Not open for further replies.