How to set FS variable to the value returned by linux command
Hello, I run the same config on multiple boxes. Need to tell apart which box CDR is coming from without setting it manually per-box. Is there a way to set a global variable to the output of linux 'hostname -s' command? E.g. instead of: <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc1"/> <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc2"/> ..... <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbcN"/> I need something like: <X-PRE-PROCESS cmd="set" data="'hostname -s'"/>\ Thank you, -Victor
If you are using cdr_csv, then you should be able to differentiate by hostname variable. On Mon, Mar 10, 2014 at 2:07 PM, Victor Chukalovskiy < victor.chukalovskiy@gmail.com> wrote:
Hello,
I run the same config on multiple boxes. Need to tell apart which box CDR is coming from without setting it manually per-box.
Is there a way to set a global variable to the output of linux 'hostname -s' command?
E.g. instead of: <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc1"/> <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc2"/> ..... <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbcN"/>
I need something like: <X-PRE-PROCESS cmd="set" data="'hostname -s'"/>\
Thank you, -Victor
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Maybe system will work for you, perhaps with the API: http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_system Perhaps:
<X-PRE-PROCESS cmd="set" data="sbc_hostname=${system foo.sh}"/>
-Avi On Mon, Mar 10, 2014 at 11:07 PM, Victor Chukalovskiy < victor.chukalovskiy@gmail.com> wrote:
Hello,
I run the same config on multiple boxes. Need to tell apart which box CDR is coming from without setting it manually per-box.
Is there a way to set a global variable to the output of linux 'hostname -s' command?
E.g. instead of: <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc1"/> <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc2"/> ..... <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbcN"/>
I need something like: <X-PRE-PROCESS cmd="set" data="'hostname -s'"/>\
Thank you, -Victor
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On Monday 10 March 2014 17:07:40 Victor Chukalovskiy wrote:
Hello, Hi
I run the same config on multiple boxes. Need to tell apart which box CDR is coming from without setting it manually per-box.
Is there a way to set a global variable to the output of linux 'hostname -s' command? I'm not sure but I think you can use https://wiki.freeswitch.org/wiki/Mod_commands#system[1]
E.g. instead of: <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc1"/> <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc2"/> ..... <X-PRE-PROCESS cmd="set" data="sbc_hostname=sbcN"/>
I need something like: <X-PRE-PROCESS cmd="set" data="'hostname -s'"/>\ Maybe try <X-PRE-PROCESS cmd="system" data="sbc_hostname=${hostname -s}"/>. Not sure if it will be executed in the X-PRE-PROCESS but worth a try IMO.
Thank you, -Victor Cheers,-- Iskren Hadzhinedev System Administrator
The Idea Factory | 20 Mearns Street | Aberdeen | AB11 5AT | UK T: 01224 607500 VAT Reg No: 982 4936 74. Company registered in Scotland, SC237116 -------- [1] https://wiki.freeswitch.org/wiki/Mod_commands#system
I use this on my install to pull in from a secured password stash: <X-PRE-PROCESS cmd="exec-set" data="database_password=authsrv-decrypt freeswitch freeswitchdev mysql" /> On 03/10/2014 04:24 PM, Iskren Hadzhinedev wrote:
On Monday 10 March 2014 17:07:40 Victor Chukalovskiy wrote:
Hello,
Hi
I run the same config on multiple boxes. Need to tell apart which box
CDR is coming from without setting it manually per-box.
Is there a way to set a global variable to the output of linux 'hostname
-s' command?
I'm not sure but I think you can use https://wiki.freeswitch.org/wiki/Mod_commands#system
E.g. instead of:
<X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc1"/>
<X-PRE-PROCESS cmd="set" data="sbc_hostname=sbc2"/>
.....
<X-PRE-PROCESS cmd="set" data="sbc_hostname=sbcN"/>
I need something like:
<X-PRE-PROCESS cmd="set" data="'hostname -s'"/>\
Maybe try <X-PRE-PROCESS cmd="system" data="sbc_hostname=${hostname -s}"/>.
Not sure if it will be executed in the X-PRE-PROCESS but worth a try IMO.
Thank you,
-Victor
Cheers, --
Iskren Hadzhinedev
System Administrator
The Idea Factory | 20 Mearns Street | Aberdeen | AB11 5AT | UK
T: 01224 607500
VAT Reg No: 982 4936 74. Company registered in Scotland, SC237116
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------------------------ Nathan Neulinger nneul@mst.edu Missouri S&T Information Technology (573) 612-1412 System Administrator - Architect
participants (5)
-
Avi Marcus
-
DJB International
-
Iskren Hadzhinedev
-
Nathan Neulinger
-
Victor Chukalovskiy