Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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

Step 1. Create project directory
Under sipXconfig/plugins directory: create a new project called . For example: openfire

Step 2. Create package
Create a new package. For example: org.sipfoundry.sipxconfig.openfire (must start with: org.sipfoundry.sipxconfig)

Step 3. Create implementation.
Inside the package:

2.1 Create the service java class (. It must extend SipxService) org.sipfoundry.sipxconfig.service.SipxService otherwise system will not recognize your class as a possible service.

Code Block
public class SipxOpenfireService extends SipxService {
    public static final String BEAN_ID = "sipxOpenfireService";
}

2.2 Step 4. Create plugin manifest
Create the xml spring configuration file: sipxOpenfire-service-modelssipxplugins.beans.xml (must end with: -models.beans.xml) located in the root of your source tree

Code Block
<?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. Step 5. Create service start/stop script
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

Code Block
<?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><at:var at:name="VERSION" /><<version>@VERSION@</version>
  <commands>
    <configtest>
      <execute><at:var at:name="SIPX_BINDIR" /><execute>@SIPX_BINDIR@/sipxopenfire.sh</execute>
      <parameter>--configtest</parameter>
    </configtest>
    <start>
      <execute><at:var at:name="SIPX_BINDIR" />/<execute>@SIPX_BINDIR@/sipxopenfire.sh</execute>
      <parameter>--start</parameter>
    </start>
    <stop>
      <execute><at:var at:name="SIPX_BINDIR" /><execute>@SIPX_BINDIR@/sipxopenfire.sh</execute>
      <parameter>--stop</parameter>
    </stop>
  </commands>
  <status>
    <pid><at:var at:name="SIPX_RUNDIR" />/<pid>@SIPX_RUNDIR@/sipxopenfire.pid</pid>
    <log><at:var at:name="SIPX_LOGDIR" />/<log>@SIPX_LOGDIR@/sipxopenfire.log</log>
  </status>
  <resources>
  </resources>
</sipXecs-process>

Please make Be sure that SipXopenfire 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 in sipxplugins.beans.xml for more information

Packaging

It is a paired down version of sipxconfig.spec that might be a template for packaging sipXconfig plugins.

sipxconfig-plugin-acme.spec

...

matches
<name>SipXopenfire</name> in your service start/stop script.

Step 6. Packaging
Update appropriate Makefile, and rpm spec file to build and install your plugin.