Adding support for managed services
From SIPfoundry sipXecs IP PBX, The Open Source SIP PBX for Linux - Calivia
In order to add 3rd party service and a new role definition you need to drop in the service plug-in in sipXconfig jar directory. http://track.sipfoundry.org/browse/XX-2115
Service plug-in is similar to phone plug-in: but instead of new phone you describe a new service (SipxService) and optionally a new bundle (SipxServiceBundle). You can have a single plugin adding multiple services (check service.beans.xml and bundle.beans.xml for example defintions).
Defining new service
Example: Openfire Service
1. Under sipXconfig/plugins directory: create a new project called openfire
2. Create a new package: org.sipfoundry.sipxconfig.openfire (must start with: org.sipfoundry.sipxconfig)
Inside the package:
2.1 Create the service java class (must extend SipxService)
public class SipxOpenfireService extends SipxService {
public static final String BEAN_ID = "sipxOpenfireService";
}
2.2 Create the xml spring configuration file: sipxOpenfire-service-models.beans.xml (must end with: -models.beans.xml)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<bean id="imBundle" parent="abstractBundle">
<constructor-arg value="im" />
</bean>
<bean id="sipxOpenfireService" class="org.sipfoundry.sipxconfig.openfire.SipxOpenfireService" scope="prototype" parent="sipxService">
<property name="processName" value="SipXopenfire" />
<property name="bundles">
<set>
<ref bean="imBundle" />
</set>
</property>
</bean>
</beans>
Any other Spring beans that perform any kind of functionality should be added here.
3. Create a corresponding process.xml file that should be added on the sipX installation directory in process.d directory (near the other process.xml files): sipxopenfire-process.xml
<?xml version='1.0' encoding='iso-8859-1' standalone='yes'?>
<sipXecs-process xmlns='http://www.sipfoundry.org/sipX/schema/xml/sipXecs-process-01-00'>
<name>SipXopenfire</name>
<version>@VERSION@</version>
<commands>
<configtest>
<execute>@SIPX_BINDIR@/sipxopenfire.sh</execute>
<parameter>--configtest</parameter>
</configtest>
<start>
<execute>@SIPX_BINDIR@/sipxopenfire.sh</execute>
<parameter>--start</parameter>
</start>
<stop>
<execute>@SIPX_BINDIR@/sipxopenfire.sh</execute>
<parameter>--stop</parameter>
</stop>
</commands>
<status>
<pid>@SIPX_RUNDIR@/sipxopenfire.pid</pid>
<log>@SIPX_LOGDIR@/sipxopenfire.log</log>
</status>
<resources>
</resources>
</sipXecs-process>
Please make sure that <name>SipXopenfire</name> is the same as the name defined in -models.beans.xml file: <property name="processName" value="SipXopenfire" />
Please check sipXconfig's services.beans.xml/bundle.beans.xml for more information
Packaging
It is a paired down version of sipxconfig.spec that might be a template for packaging sipXconfig plugins.
| File: sipxconfig-plugin-acme.spec |
Name: sipxconfig-acme
Version: 1.0
Release: 1
# java, no debug rpm nec.
%define debug_package %{nil}
# disable JAR repacking
%define __jar_repack %{nil}
Summary: Acme phone support for sipXconfig
License: LGPL??
Group: Telcommunications
Vendor: Example Corp.
Packager: First Last <first.last@example.com>
%define sipxpbxconf %{_sysconfdir}/sipxpbx
%define sipxconfiglib %{_datadir}/java/sipXecs/sipXconfig
Requires: sipxconfig
Source: %name-%version.tar.gz
BuildRoot: %{_tmppath}/%name-%version-root
%description
This package adds support for the Acme phones.
%prep
%setup -q
%build
%configure
make
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%clean
rm -rf $RPM_BUILD_ROOT
# build should install one or more jars in sipxconfiglib directory...
%files
%defattr(644,root,root,755)
%{sipxconfiglib}/sipxconfig-acme.jar
%config(noreplace) %{sipxpbxconf}/acme/*
%post
%preun
|
