JBoss.orgCommunity Documentation

Chapter 5. Configuring the JBoss Communications Media Server

5.1. Timer
5.2. MainDeployer
5.3. RTPFactory
5.4. Digital Signal Processor (DSP)
5.5. Audio Player
5.6. Audio Recorder
5.7. DTMF
5.7.1. Rfc2833 Detector
5.7.2. Inband Detector
5.7.3. Rfc2833 Generator
5.7.4. Inband Generator
5.8. Announcement Server Access Points
5.9. Interactive Voice Response
5.10. Packet Relay Endpoint
5.11. Conference Bridge Endpoint
5.12. MMS STUN Support

All endpoints are plugged as POJO service in JBoss Microcontainers. To create a component for the JBoss Communications Media Server, the appropriate component Factory must be used. Each component within a factory has an identifier and name that is unique across the server implementation. Because each component is unique in the Media Server, it can be referenced and pulled into other applications.

The Timer provides a time source, and functions similar to a crystal oscillator. This endpoint can be configured to specify the millisecond interval between two oscillations.

The configurable aspect of the Timer is:

The MainDeployer endpoint manages hot deployment of components and enpoints. Hot-deployable components and endpoints are defined as those that can be added to or removed from the running server.

MainDeployer scans the /deploy directory, looking for configuration files that have changed since the last scan. When MainDeployer detects any changes to the directory, any changes resulting from the removed configuration file are processed. This includes re-deploying changed beans, adding new beans, or removing beans that are no longer required.

To understand the functionality of the MainDeployer endpoint, experiment by removing the ann-beans.xml configuration file from the /deploy directory while the server is running. Observe how the server behaves once the file is removed from the folder.

The configurable aspects of MainDeployer are:

RTPFactory is responsible for managing the actual RTP Socket. The reference of RTPFactory is passed to each endpoint which, in turn, leverage the RTPFactory to create Connections and decide on supported codecs.

The configurable aspects of the RTPFactory are:

formatMap

Specifies the relationship between the RTP payload type and format. Table 5.1, “Supported RTP Formats” describes the payload types and their supported formats.

bindAddress

Specifies the IP address to which the RTP socket is bound.

portRange

Specifies the port range within which the RTP socket will be created. The first free port in the given range is assigned to the socket.

jitter

Specifies the size of the jitter buffer (in milliseconds) for incoming packets.

timer

Specifies the timer instance from which reading process is synchronized.

stunAddress

Specifies the location of the STUN server to use. For more information regarding STUN, refer to Section 5.12, “MMS STUN Support” .

Supported RTP Formats

The RTPFactory is able to receive the following RTP media types:


The configurable aspect of the DspFactory are:

The configurable aspect of the AudioPlayerFactory are:

The configurable aspect of the RecorderFactory are:

Two different types of components are used to handle inband and rfc2833 mode of detecting and generating DTMF tones.

An Announcement Server endpoint provides access to an announcement service. Upon receiving requests from the call agent, an Announcement Server will “play” a specified announcement. A given announcement endpoint is not expected to support more than one connection at a time. Connections to an Announcement Server are typically one-way ( “half-duplex” ), therefore, the Announcement Server is not expected to listen to audio signals from the connection.

Announcement endpoints do not transcode announced media; in order to achieve this, the application must use Packet Relay endpoints on the media path. Also note that the announcement server endpoint can generate a tones such as DTMF, Busy, Congestion etc.

Example 5.1. The Announcement Endpoint Declaration



    <bean name="Ann-TxChannelFactory"
        class="org.mobicents.media.server.resource.ChannelFactory" />

        <bean name="AnnConnectionFactory" class="org.mobicents.media.server.ConnectionFactory">
            <property name="txChannelFactory"><inject bean="Ann-TxChannelFactory"/></property>
        </bean>    

    <!-- ANNOUNCEMENT  -->
    <bean name="Announcement-Access-Point"
        class="org.mobicents.media.server.EndpointImpl">
        <property name="localName">
            /mobicents/media/aap/[1..10]
        </property>
        <property name="timer">
            <inject bean="Timer" />
        </property>
        <property name="sourceFactory">
            <inject bean="AudioPlayerFactory" />
        </property>
        <property name="rtpFactory">
            <map class="java.util.Hashtable" keyClass="java.lang.String"
                valueClass="org.mobicents.media.server.impl.rtp.RtpFactory">
                <entry>
                    <key>audio</key>
                    <value>
                        <inject bean="RTPAudioFactory" />
                    </value>
                </entry>
            </map>
        </property>
        <property name="connectionFactory">
            <inject bean="AnnConnectionFactory" />
        </property>
    </bean>
            

Configuration of an Announcement Server Access Point

The configurable attributes of the Announcement Server are as follows:

Customization

The Announcement Endpoint by default is configured to only play audio files. Its also possible to generate Tones like DTMF using either Rfc2833Generator or InbandDetector or both. To use these Generators you also need to declare a Multiplexer that multiplexe's the media stream from AudioPlayer and DTMF Generatot to one stream. Bellow shown is example of how Rfc2833Generator can be used.

	<bean name="MuxFactory"
		class="org.mobicents.media.server.impl.resource.MuxFactory">
		<constructor>
			<parameter>Mux</parameter>
		</constructor>
	</bean>

	<bean name="Rfc2833GeneratorFactory"
		class="org.mobicents.media.server.impl.resource.dtmf.Rfc2833GeneratorFactory">
		<property name="name">Rfc2833GeneratorFactory</property>
	</bean>


	<bean name="ann-Pipe-1"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="outlet">Mux</property>
	</bean>
	<bean name="ann-Pipe-2"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="inlet">Rfc2833GeneratorFactory</property>
		<property name="outlet">Mux</property>
	</bean>
	<bean name="ann-Pipe-3"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="inlet">Mux</property>
		<property name="outlet">audio.processor</property>
	</bean>
	<bean name="ann-Pipe-4"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="inlet">audio.processor</property>
	</bean>

	<bean name="TxChannelFactory"
		class="org.mobicents.media.server.resource.ChannelFactory">
		<property name="components">
			<list>
				<inject bean="MuxFactory" />
				<inject bean="Rfc2833GeneratorFactory" />
				<inject bean="AudioProcessorFactory" />
			</list>
		</property>
		<property name="pipes">
			<list>
				<inject bean="ann-Pipe-1" />
				<inject bean="ann-Pipe-2" />
				<inject bean="ann-Pipe-3" />
				<inject bean="ann-Pipe-4" />
			</list>
		</property>
	</bean>

        <bean name="AnnConnectionFactory" class="org.mobicents.media.server.ConnectionFactory">
            <property name="txChannelFactory"><inject bean="TxChannelFactory"/></property>
        </bean>    				
				

An Interactive Voice Response ( IVR ) endpoint provides access to an IVR service. Upon requests from the Call Agent, the IVR server “plays” announcements and tones, and “listens” to voice messages from the user. A given IVR endpoint is not expected to support more than one connection at a time. For example, if several connections were established to the same endpoint, then the same tones and announcements would be played simultaneously over all connections. IVR endpoints do not posses the capability of transcoding played or recorded media streams. IVRs record or play in the format that the data was delivered.

Example 5.2. The IVREndpointManagement MBean



    <bean name="IVR-TxChannelFactory"
        class="org.mobicents.media.server.resource.ChannelFactory" />
        
    <bean name="IVR-Pipe-1"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="outlet">audio.processor</property>
    </bean>
    <bean name="IVR-Pipe-2"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="inlet">audio.processor</property>
        <property name="outlet">DeMux</property>
    </bean>
    <bean name="IVR-Pipe-3"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="inlet">DeMux</property>
        <property name="outlet">Rfc2833DetectorFactory</property>
    </bean>
    <bean name="IVR-Pipe-4"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="inlet">DeMux</property>
    </bean>


    <bean name="IVR-RxChannelFactory"
        class="org.mobicents.media.server.resource.ChannelFactory">
        <property name="components">
            <list>
                <inject bean="DeMuxFactory" />
                <inject bean="Rfc2833DetectorFactory" />
                <inject bean="AudioProcessorFactory" />
            </list>
        </property>
        <property name="pipes">
            <list>
                <inject bean="IVR-Pipe-1" />
                <inject bean="IVR-Pipe-2" />
                <inject bean="IVR-Pipe-3" />
                <inject bean="IVR-Pipe-4" />
            </list>
        </property>
    </bean>

        <bean name="IVRConnectionFactory" class="org.mobicents.media.server.ConnectionFactory">
            <property name="txChannelFactory"><inject bean="IVR-TxChannelFactory"/></property>
            <property name="rxChannelFactory"><inject bean="IVR-RxChannelFactory"/></property>
        </bean>    

    <!-- IVR  -->
    <bean name="IVREndpoint"
        class="org.mobicents.media.server.EndpointImpl">
        <property name="localName">
            /mobicents/media/IVR/[1..10]
        </property>
        <property name="timer">
            <inject bean="Timer" />
        </property>
        <property name="sourceFactory">
            <inject bean="AudioPlayerFactory" />
        </property>
        <property name="sinkFactory">
            <inject bean="RecorderFactory" />
        </property>
        <property name="rtpFactory">
            <map class="java.util.Hashtable" keyClass="java.lang.String"
                valueClass="org.mobicents.media.server.impl.rtp.RtpFactory">
                <entry>
                    <key>audio</key>
                    <value>
                        <inject bean="RTPAudioFactory" />
                    </value>
                </entry>
            </map>
        </property>
        <property name="connectionFactory">
            <inject bean="IVRConnectionFactory" />
        </property>
    </bean>
            

Configuration of the Interactive Voice Response Endpoint

The configurable attributes of the Interactive Voice Response endpoint are as follows:

Customization

The IVR by default detects only RFC 2833 DTMF events. However if you want to use Inband detector instead of RFC2833, replace Rfc2833DetectorFactory with InbandDetectorFactory. You will have to declare the InbandDetectorFactory bean as shown

	<bean name="InbandDetectorFactory"
		class="org.mobicents.media.server.impl.resource.dtmf.InbandDetectorFactory">
		<property name="name">InbandDetectorFactory</property>
	</bean>				
				

It is also possible to have RFC2833 and Inband detector both working at same time. All you need to do is declare InbandDetectorFactory as explained above and have one more pipe that connects this InbandDetectorFactory with already declared DeMux.

	<bean name="InbandDetectorFactory"
		class="org.mobicents.media.server.impl.resource.dtmf.InbandDetectorFactory">
		<property name="name">InbandDetectorFactory</property>
	</bean>	

	<bean name="IVR-TxChannelFactory"
		class="org.mobicents.media.server.resource.ChannelFactory" />
		
	<bean name="IVR-Pipe-1"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="outlet">audio.processor</property>
	</bean>
	<bean name="IVR-Pipe-2"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="inlet">audio.processor</property>
		<property name="outlet">DeMux</property>
	</bean>
	<bean name="IVR-Pipe-3"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="inlet">DeMux</property>
		<property name="outlet">Rfc2833DetectorFactory</property>
	</bean>
	<bean name="IVR-Pipe-4"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="inlet">DeMux</property>
		<property name="outlet">InbandDetectorFactory</property>
	</bean>
	<bean name="IVR-Pipe-5"
		class="org.mobicents.media.server.resource.PipeFactory">
		<property name="inlet">DeMux</property>
	</bean>


	<bean name="IVR-RxChannelFactory"
		class="org.mobicents.media.server.resource.ChannelFactory">
		<property name="components">
			<list>
				<inject bean="DeMuxFactory" />
				<inject bean="Rfc2833DetectorFactory" />
				<inject bean="InbandDetectorFactory" />
				<inject bean="AudioProcessorFactory" />
			</list>
		</property>
		<property name="pipes">
			<list>
				<inject bean="IVR-Pipe-1" />
				<inject bean="IVR-Pipe-2" />
				<inject bean="IVR-Pipe-3" />
				<inject bean="IVR-Pipe-4" />
				<inject bean="IVR-Pipe-5" />
			</list>
		</property>
	</bean>			
			

A packet relay endpoint is a specific form of conference bridge that typically only supports two connections. Packet relays can be found in firewalls between a protected and an open network, or in transcoding servers used to provide interoperation between incompatible gateways (for example, gateways which do not support compatible compression algorithms, or gateways which operate over different transmission networks such as IP or ATM).

Example 5.3. The PREndpointManagement MBean



    <bean name="PR-Pipe1"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="outlet">audio.processor</property>
    </bean>
    <bean name="PR-Pipe2"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="inlet">audio.processor</property>
    </bean>

    <bean name="PR-RxChannelFactory"
        class="org.mobicents.media.server.resource.ChannelFactory">
        <property name="components">
            <list>
                <inject bean="AudioProcessorFactory" />
            </list>
        </property>
        <property name="pipes">
            <list>
                <inject bean="PR-Pipe1" />
                <inject bean="PR-Pipe2" />
            </list>
        </property>
    </bean>

    <bean name="PR-TxChannelFactory"
        class="org.mobicents.media.server.resource.ChannelFactory">
        <property name="components">
            <list>
                <inject bean="AudioProcessorFactory" />
            </list>
        </property>
        <property name="pipes">
            <list>
                <inject bean="PR-Pipe1" />
                <inject bean="PR-Pipe2" />
            </list>
        </property>
    </bean>


        <bean name="PacketRelayConnectionFactory" class="org.mobicents.media.server.ConnectionFactory">
            <property name="txChannelFactory"><inject bean="PR-TxChannelFactory"/></property>
            <property name="rxChannelFactory"><inject bean="PR-RxChannelFactory"/></property>
        </bean>    

    <bean name="PacketRelayBridgeFactory"
        class="org.mobicents.media.server.impl.resource.prelay.BridgeFactory">
        <property name="name">packet.relay</property>
    </bean>

    <bean name="PacketRelayEndpoint"
        class="org.mobicents.media.server.EndpointImpl">
        <property name="localName">
            /mobicents/media/packetrelay/[1..10]
        </property>
        <property name="timer">
            <inject bean="Timer" />
        </property>
        <property name="rtpFactory">
            <map class="java.util.Hashtable" keyClass="java.lang.String"
                valueClass="org.mobicents.media.server.impl.rtp.RtpFactory">
                <entry>
                    <key>audio</key>
                    <value>
                        <inject bean="RTPAudioFactory" />
                    </value>
                </entry>
            </map>
        </property>
        <property name="connectionFactory">
            <inject bean="PacketRelayConnectionFactory" />
        </property>
        <property name="groupFactory">
            <inject bean="PacketRelayBridgeFactory" />
        </property>
    </bean>

            

Configuration of the Packet Relay Endpoint

The configurable attributes of the Packet Relay endpoint are as follows:

The Mobicents Media Server should be able to establish several connections between the endpoint and packet networks, or between the endpoint and other endpoints in the same gateway. The signals originating from these connections shall be mixed according to the connection “mode” . The precise number of connections an endpoint supports is a characteristic of the gateway, and may in fact vary according with the allocation of resources within the gateway. The conf endpoint can play an announcement directly on connections and hence only for the participant listening to an announcement, and can even detect DTMF for connection.

Example 5.4. The ConfEndpointManagement MBean



    <bean name="Cnf-DefaultChannelFactory"
        class="org.mobicents.media.server.resource.ChannelFactory" />
        
    <bean name="Cnf-Pipe-1"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="outlet">audio.processor</property>
    </bean>
    <bean name="Cnf-Pipe-2"
        class="org.mobicents.media.server.resource.PipeFactory">
        <property name="inlet">audio.processor</property>
    </bean>

    <bean name="Cnf-Dsp-ChannelFactory"
        class="org.mobicents.media.server.resource.ChannelFactory">
        <property name="components">
            <list>
                <inject bean="AudioProcessorFactory" />
            </list>
        </property>
        <property name="pipes">
            <list>
                <inject bean="Cnf-Pipe-1" />
                <inject bean="Cnf-Pipe-2" />
            </list>
        </property>
    </bean>

    <bean name="CnfBridgeFactory"
        class="org.mobicents.media.server.impl.resource.cnf.CnfBridgeFactory">
        <property name="name">cnf.bridge</property>
    </bean>

        <bean name="CnfConnectionFactory" class="org.mobicents.media.server.ConnectionFactory">
            <property name="txChannelFactory"><inject bean="Cnf-Dsp-ChannelFactory"/></property>
            <property name="rxChannelFactory"><inject bean="Cnf-Dsp-ChannelFactory"/></property>
        </bean>    

        <!-- Conference with RTP and DSP  -->
    <bean name="CnfEndpoint-1"
        class="org.mobicents.media.server.EndpointImpl">
        <property name="localName">
            /mobicents/media/cnf/[1..10]
        </property>
        <property name="timer">
            <inject bean="Timer" />
        </property>
        
                <property name="groupFactory">
            <inject bean="CnfBridgeFactory" />
        </property>
        
        <property name="rtpFactory">
            <map class="java.util.Hashtable" keyClass="java.lang.String"
                valueClass="org.mobicents.media.server.impl.rtp.RtpFactory">
                <entry>
                    <key>audio</key>
                    <value>
                        <inject bean="RTPAudioFactory" />
                    </value>
                </entry>
            </map>
        </property>
                
        <property name="connectionFactory">
            <inject bean="CnfConnectionFactory" />
        </property>
    </bean>

        <bean name="CnfLocalConnectionFactory" class="org.mobicents.media.server.ConnectionFactory">
            <property name="txChannelFactory"><inject bean="Cnf-DefaultChannelFactory"/></property>
            <property name="rxChannelFactory"><inject bean="Cnf-DefaultChannelFactory"/></property>
        </bean>    

        <!-- Conference local bridge  -->
    <bean name="CnfEndpoint-local"
        class="org.mobicents.media.server.EndpointImpl">
        <property name="localName">
            /mobicents/media/cnf/local/[1..10]
        </property>
        <property name="timer">
            <inject bean="Timer" />
        </property>
        
                <property name="groupFactory">
            <inject bean="CnfBridgeFactory" />
        </property>
        <property name="connectionFactory">
            <inject bean="CnfLocalConnectionFactory" />
        </property>
                
    </bean>
            

Configuration of the Conference Bridge Endpoint

The configurable attributes of the Conference Bridge endpoint are as follows:

localName

Specifies the name under which the endpoint is to be bound.

This parameter allows a set of enpoints to be specified, which are then created and bound automatically by the Media Server. Consider the scenario where a total of 10 endpoints are required. To specify this in the attribute, the following path is provided: /mobicents/media/cnf/local/[1..10] . The [1..10] in the directory path tells the Media Server to create a set of 10 endpoints in the /cnf directory, named according to the endpoint number, which start at one and finish at ten. For example, /mobicents/media/cnf/1, /mobicents/media/cnf/2, ... /mobicents/media/cnf/10 .

timer

Specifies the timer instance from which reading process is synchronized.

connectionFactory

Specifies the instance of ConnectionFactory that wraps the custom transmission and receiving channel factory.

groupFactory

Specifies the instance of BridgeFactory that wraps the source and sink.

When using Mobicents Media Server behind a routing device performing Network Address Translation, you may need to employ the Simple Traversal of User Datagram Protocol through Network Address Translators (abbreviated: STUN ) protocol in order for the server to operate correctly. In general, it is recommended to avoid deploying the MMS behind a NAT, since doing so can incur significant performance penalties and failures. Nevertheless, the current MMS implementation does work with a static NAT, a.k.a. a one-to-one (1-1) NAT, in which no port-mapping occurs. Full Cone NAT should also work with Address-Restricted NAT.

For more information STUN NAT classification, refer to chapter 5 of RFC3489 - STUN - Simple Traversal of User Datagram Protocol (UDP) .

MMS STUN Configuration

Each RTPFactory in the Media Server can have its own STUN preferences. The STUN options are specified in the configuration file mobicents-media-server/mobicents-media-server.sar/META-INF/jboss-service.xml for embedded Media Server and /conf/bootstrap-beans.xml for standalone Media Server Here is an example of an RTPFactory bean with static NAT configuration:

Example 5.5.  Static NAT configuration of an RTPFactory



    <bean name="RTPAudioFactory"
        class="org.mobicents.media.server.impl.rtp.RtpFactory">
        <property name="formatMap">
            <map class="java.util.Hashtable"
                keyClass="java.lang.Integer"
                valueClass="org.mobicents.media.Format">
                <entry>
                    <key>0</key>
                    <value>
                        <inject bean="PCMU" />
                    </value>
                </entry>
                <entry>
                    <key>8</key>
                    <value>
                        <inject bean="PCMA" />
                    </value>
                </entry>
                <entry>
                    <key>3</key>
                    <value>
                        <inject bean="GSM" />
                    </value>
                </entry>
                <entry>
                    <key>97</key>
                    <value>
                        <inject bean="SPEEX" />
                    </value>
                </entry>
                <entry>
                    <key>101</key>
                    <value>
                        <inject bean="DTMF" />
                    </value>
                </entry>
            </map>
        </property>
        <property name="bindAddress">10.65.193.65</property>
        <property name="localPort">9200</property>
        <property name="jitter">60</property>
        <property name="timer">
            <inject bean="Timer" />
        </property>
        <property name="stunAddress">stun.ekiga.net:3478</property>

    </bean>
            

In order to use stun configure stunAddress property and point to STUN server : port. If no port is specified by default it will take 3478.