Category:GlobalVariable

From FreeSWITCH Wiki
Revision as of 00:22, 25 January 2014 by Crienzo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Overview

Global variables can be used to share information between all channels. You can save anything in a global variable.


XML configuration Examples

Preprocessor variables set in the XML configuration become global variables in FreeSWITCH.

set

<!-- Set local_ip_v4 -->
<X-PRE-PROCESS cmd="set" data="local_ip_v4=192.168.0.68"/>

exec-set

<!-- Set local_ip_v4 to eth1 address -->
<X-PRE-PROCESS cmd="exec-set" data="local_ip_v4=ip addr show eth1 | awk '/inet /{print $2}' | head -n 1 | cut -d '/' -f 1"/>

get

<param name="sip-port" value="$${external_sip_port}"/>

API examples

global_setvar

freeswitch@localhost> global_setvar foo=1

+OK

global_getvar

freeswitch@localhost> global_getvar foo

1

Pages in category "GlobalVariable"

The following 3 pages are in this category, out of 3 total.