By Date: <-- -->
By Thread: <-- -->

defaults



Douglas Hubler wrote:
Hannu Strang wrote:

To have system and group wide settings for timezone etc. I'm thinking (and
trying out) something like this:


- a new phone model "Generic phone settings" which is editable at Phone
Models page but the model can't be used for adding a new phone (opposite of
unknown phone)
- that model is loaded with every real phone model to get access to the
settings but hidden from the real phones edit screens
- those settings are used to generate device specific default settings
instead of current timezone and addmappings (needs device specific code)
- server timezone and the values now used for addmapping are used as
defaults for the generic phone settings only
- to have system wide default values, a default phone group which can't be
removed and which is loaded to every phone before any other groups (without
having to add the phones to the group separately)


That would give shared generic settings for all phones supporting the group
structure and without any new user interfaces.


This is a very good idea. One recommendation, because the setttings we'd want to capture would be known and fixed at least for each version, we might be better off with real Class instead of a SettingModel

Example:

 class PhoneDefaults {
   Calendar getTimeZone() {
   }
 }

rather than:

 phone_defaults.xml
  ----------------------
  <setting name="timezone">
   <type></type>   /
 </setting>


Advantages:
1. )We can contruct a much richer UI to edit PhoneDefaults than the settings file values


2.) Phone models would have more maintainable and flexible code

Class PhoneXyx extends Phone {
  setPhoneDefaults(Settings s, PhoneDefaults defaults) {
       String myTimezone = defaults.getTimeZone().getZone();
       getSetting("my-timezone").setValue(myTimeZone);
  }

rather than

Class PhoneXyx extends Phone {
  setPhoneDefaults(Settings s, Setting defaults) {
       String myTimezone = defaults.getSetting(DEFAULTS_TIMEZONE);
       getSetting("my-timezone").setValue(myTimeZone);
  }

There is already a class called PhoneDefaults which kinda already does this, but it's values are pulled from system config file and can be pulled from database instead to support what you'd like to do.

I can get you setup getting PhoneDefaults to/from database if you want and this looks like a good idea.


I too think it's a good idea. At one point I had a grand vision with Phones providing adapters for
a specific group of functionality (dialing, network settings, time zone settings etc.) and the class similar to PhoneDefaults discovering those adapters and modifying the phone settings. Now I think we should start with the design proposed by Hannu and only move to more complicated one if we cannot solve something.


Really nice feature of sipXconfig settings model is that phone does not have to keep a separate copy
of the setting value until it's actually used. Everything is built lazily. If the phone does not
have the value the look-up rolls to the group then to default model. Default model is pretty much what's in XML plus what you set in "defaultSetting". It would be nice if we did not have to have an explicit call to "setPhoneDefaults" but instead PhoneDefaults would be included in the chain of resolving setting values. But I am not sure if it would be easy to implement. And I am definitely OK with just trying to make it work and later checking if we can improve upon it.


BTW: a good test of the design will be implementing dial patterns support for a phone in such a way the the settings are modified by a dial plan configuration of the PBX.

Damian

_______________________________________________
sipx-dev mailing list
sipx-dev (at) list.sipfoundry.org
List Archive: http://list.sipfoundry.org/archive/sipx-dev