Skip to content

Version 3 Defined Variables Outline

Jaybee- edited this page Sep 26, 2011 · 19 revisions

Reserved/Defined Variables

Line Variables

$this->settings['line'][n] //This loops between the elements below
-line //Line on phone -displayname //Displayname of phone
-username
-authname
-password/secret
-SIPServerHost
-SIPServerPort
-BackupSIPServerHost
-BackupSIPServerPort
-UseOutboundProxy
-OutboundHost
-OutboundPort
-BakOutboundHost
-BakOutboundPort
-UseSTUNServer
-STUNServer
-VoiceMailNumber

Other phone variables

-$this->settings[variable]

Engine Variables

$this->root_dir //Path to provisioner lib, use __FILE__ to set

$this->dynamic_mapping; // e.g. ARRAY('thisfile.htm'=>'# Intentionally left blank','thatfile$mac.htm'=>array('thisfile.htm','thatfile$mac.htm'))
// files not in this array are passed through untouched. Strings are returned as is. For arrays, generate_file is called for each entry, and they are combined.

public $config_file_replacements=array();

$this->en_htmlspecialchars //Enable or Disable PHP's htmlspecialchars() function for variables

$this->engine //Engine information, to run reboot commands etc
-location //Path to bin
-type //Freeswitch,Asterisk,Switchvox....
-os //Windows,Linux,SunOS....

Global Variables

$this->mac

$this->provision
-path //Path to provisioner, used in http/https/ftp/tftp
-protocol //can be tftp,http,ftp ??
-type //Can be file or dynamic
-encryption //True or False
-settings
--directory_structure //Directory structure to create as an array
--protected_files //array list of file to NOT over-write on every config file build. They are protected.
--copy_files //array of files or directories to copy. Directories will be recursive

$this->network
-DHCP //TRUE or FALSE
-IPv4 Address
-IPv6 Address
-Subnet Mask
-Gateway
-VLAN

$this->timezone //What Format do we want to enforce is sent here? Or should it just be the datetime class


comments by Jaybee_:

$this->network, $this->mac and $this->provision['protocol'], $this->network, $this->timezone, and $this->line (as described above) contain data for going into config files, so should all be under $this->settings.

$this->settings['network'] should also have the ntp server.

$this->engine is currently only used for sip_notify and sip_show_peers - perhaps we should include callbacks?

function default_asterisk_sipnotify($command,$extension) { exec("/usr/bin/asterisk -rx 'sip notify $command $extension'"); }

$this->engine['sipnotify']='default_asterisk_sipnotify';

function reboot() { // example for a given class try { call_user_func($this->engine['sipnotify'],'polycom-check-cfg',$this->lines[1]['ext']); } Exception(e) { print "Failed to reboot phone. Oh dear."; } }

You can also specify sipnotify to call a function of a class:

$this->engine['sipnotify']=array($my_freeswitch_instance,'sipnotify'); will call $my_freeswitch_instance->sipnotify($command,$extension);