Adding support for managed gateways
Introduction
sipXconfig is an extensible management system for complete Enterprise communications solutions based on SIP. It is capable of managing both the server side infrastructure as well as all the required devices, such as phones and gateways and additional applications.
...
After those 3 steps are completed, sipXconfig users will be able to select new gateway type, configure the gateway using sipXconfig provided UI and generate gateway configuration files.
Registering a new gateway type
Gateway class
To add support for a newly released gateway from Acme Corp. we start by defining a class the gateway model class. Instances of this class will represent physical gateways known to sipXconfig. A newly added class has to extend the existing org.sipfoundry.sipxconfig.gateway.Gateway class.
...
- m_defaults will be magically injected in your gateway class - this is the instance of the PhoneDefaults class and despite its name it contains whole bunch of quite itneresting data about the system - you can get access to SIP Proxy address, TFTP server directory etc.
- generateProfiles and removeProfiles are called by sipXconfig when system needs to generate (or respectively clean) configuration for this gateway - the usual implementation of generateProfiles will use some kind of templating system (for example Velocity) to inject Gateway settings into configuration file template, removeProfiles should clean all the files generated by generateProfiles
- defaultSettings is a function that is called always before the instance of the gateway object is used - it's a change to set the default values for some common settings that cannot be hardcoded since they depend on specific installation - usually all settings the require IP address name of the SIP proxy or SIP domain name get their default value here
Registering gateway class
To register gateway class we need also to define gateway model and settings model.
...
Some of the tests will fail since the setting file is missing.
Defining the gateway model
Of course just letting users select a new gateway is not very exciting. We would also like to configure some settings of this gateway with the sipXconfig UI. The nice thing is that we do not actually have to write any GUI code or learn HTML to accomplish this. All we need to do is to define all the parameters of the new gateway that we want to configure through the sipXconfig UI in the gateway model XML file. The format used for the model file to define gateway properties is exactly the same as the format used to define phone properties when adding support for a new phone.
...
Defining the settings allows sipXconfig not only to display them in the UI, but also persist them in the database, and back them up with all other managed configurations.
Implementing gateway profile generation
Profile generation is the most gateway specific part of the process. Whenever the user presses the Send Profiles button on the Gateways page, sipXconfig calls the generateProfiles function in the AcmeGateway class. Depending on the configuration protocol supported by the gateway, implementing generateProfiles can be really simple or may require substantial time.
...