Skip to main content

mod_rtmp

About

mod_rtmp is an RTMP (Real time media protocol) endpoint for FreeSWITCH (similar to mod_sofia for example). The RTMP protocol is primarily used by Flash for streaming audio, video, and data over the Internet. The proliferation of WebRTC media streaming has largely supplanted the use of RTMP.

Click here to expand Table of Contents

Installation

The lastest git for FreeSWITCH already have mod_rtmp source included. Before compilation, edit modules.conf. Uncomment "endpoints/mod_rtmp" and save the file. Run your FreeSWITCH compilation like you would normally do.

Configuration

RTMP Configuration Files, rtmp.conf.xml

See RTMP Configuration Files.

API

Status

To view the endpoint status:

freeswitch> rtmp status

To view the status of a profile:

freeswitch> rtmp status profile <profile>

To view sessions on a profile:

freeswitch> rtmp status profile <profile> sessions

To view registrations on a profile:

freeswitch> rtmp status profile <profile> reg

Profiles

To start, stop or restart a profile:

freeswitch> rtmp profile <profile> start freeswitch> rtmp profile <profile> stop freeswitch> rtmp profile <profile> restart

To rescan the configuration for a profile:

freeswitch> rtmp profile <profile> rescan

Sessions

To kill a session:

freeswitch> rtmp session <session> kill

To login or logout a session:

freeswitch> rtmp session <session> login freeswitch> rtmp session <session> logout

Contact

To get a dialstring to call a registered user (optionally with nickname):

rtmp_contact profile/user@domain[/[!]nickname]

This can be used to bridge a call to the user:

<action application="bridge" data="${rtmp_contact($${rtmp_profile}/${dialed_ext}@$${domain})}"/>

Latency

If you experience latency when receiving streamed audio through Flash, first check the latency isn't generated through Flash's interaction with your browser and audio system. For example on some Linux distributions which use PulseAudio you may find executing the following command in a desktop terminal window has a great effect on reducing latency for the current session:

\export PULSE_LATENCY_MSEC=20 /usr/bin/firefox "$@"

Flex Client

There is also a sample flex client that works with mod_rtmp. The source is currently located right under the /usr/src/freeswitch/clients/flex. You need to copy those files and put it under a web server directory. Modify the freeswitch.html file and modify the following section:

var flashvars = { 
rtmp_url: 'rtmp://my.ip.address.here/phone'
};

replace my.ip.address.here to your freeswitch server IP running the mod_rtmp module. Now open your browser and load the freeswitch.html page to see the client in action.