en	The following is based on a tutorial to use Matterbridge with the plugin: [Matterbridge + Peertube](https://gitlab.com/refrac/obs-matterbridge-overlay/-/blob/master/documentation/peertube.md)
fr	Voici un tutoriel sur comment utiliser Matterbridge avec ce plugin : <https://gitlab.com/refrac/obs-matterbridge-overlay/-/blob/master/documentation/peertube.md>

en	Requirements

en	[PeerTube plugin livechat](https://github.com/JohnXLivingston/peertube-plugin-livechat) version 3.2.0 or later.
fr	les [jalons sur github](https://github.com/JohnXLivingston/peertube-plugin-livechat/milestones).

en	[Matterbridge](https://github.com/42wim/matterbridge) version 1.22.4 or later.

en	The easiest is if the PeerTube instance and Matterbridge run on the same server.

en	Internal connections only (basic)

en	You will need to enable `{{% livechat_label prosody_c2s_label %}}` in the livechat plugin settings.

en	This will allow localhost XMPP clients to connect to the Prosody XMPP server.

en	You may need to add some line to your `/etc/hosts`:

en	127.0.0.1 anon.example.org room.example.org

en	Replace `example.org` by your actual instance domain name. Afterwards you can continue with the Matterbridge configuration below.

en	Allow external connections (advanced)

en	By default, the internal Prosody XMPP server only listens on localhost (127.0.0.1).

en	On livechat versions >= 10.1.0 a new option call `Client to server network interfaces` was added to allow changing this.

en	It allows to add a list of IPs to listen on, coma separated (spaces will be stripped).

en	You can also use `*` to listen on all IPv4 interfaces, and `::` for all IPv6. Doing so allows external access to the client to server interface.

en	Then you need to open the C2S port (by default `52822`, but check the plugin settings to get the current value) in your firewall so that it can be reached from the internet. If you don't want to use C2S connections for anything else than your Matterbridge service, you should restrict access to this port to your Matterbridge server IP.

en	You also need to add DNS records (A and AAAA) for `anon.example.org` and `room.example.org` (replace `example.org` by your actual domain name).

en	In case you are using a port other than `5222` (XMPP standard port) you also need to set the [xmpp-client SRV record](https://prosody.im/doc/dns#srv_records) to the correct port.

en	Configurating Matterbridge
fr	Utiliser Matterbridge

en	In the version 1.22.4, Matterbridge added support for XMPP anonymous connections needed to connect to the built-in prosody.

en	So in the TOML config file put:

en	[xmpp.mypeertube] Anonymous=true Server="anon.example.org:52822" Muc="room.example.org" Nick="Matterbridge" RemoteNickFormat="[{PROTOCOL}] <{NICK}> " NoTLS=true

en	Replace `example.org` by your actual instance domain name.

en	Replace `52822` by the actual port if you changed it.

en	`mypeertube` can be replaced by another name.

en	Using `peertube` as the Nick will provide put PeerTube icon for overlay messages, can be also done with overlay config modification.

en	The setting `NoTLS=true` allows connecting to a server with self-signed certificates.

en	Now you can add this account to gateways and bridge specific live-chat channels.