Skip to main content
Skip table of contents

Advanced BGM/Paging/Emergency system with IPAC, RetalPlayer, Barionet and Paging Gateway

We will describe here how to build an advanced Paging system integrating Barix components.

The core application of the system is IP Audio Client (IPAC), running on IP Former-TPA400, MPA400 and M400, that feeds the amplifiers/loudspeakers.

IPAC allows the possibility to set up multiple "sources" from where getting the audio and organize them in a multi-layer priority hierarchy, meaning that the source with an higher priority will always play over sources with lower priority. 

In the system described here, it receives RTP streams from RetailPlayer (BGM, lowest priority), PSTouch/Paging Gateway/SIP (local paging in IC Paging mode / SIP call, mid priority) and plays, triggered by Barionet 400, local audio files (highest priority).

Here the manual:

https://help.barix.com/exstreamer4xx/IP-Audio-Client-user-manual---Standard-mode.14509311562.html

PS Touch is an universal, TCP/IP connected intercom station for use in IP Intercom, Paging and VoIP applications. It is delivered with Simple Paging Master firmware or IC Paging Master
firmware.

In this application it acts as IC Paging Master, talking with the IC Client source configured on IPAC.

Here the manual:

https://help.barix.com/pstouch/IC-Paging-User-Guide.7696879255.html

Paging Gateway allows to page from mobile phones and from any computer or tablet on the local
network. It easily integrates with most existing analog paging systems. The web app provides a simple to use interface that allows paging into any paging system, even fully analog ones (no application needs to be
installed). Access protection makes sure, only persons allowed to page, can use the system.

In this application Paging Gateway M400 is used as a zone-based paging station. The user selects the zones he wants to page to and the fully IP based IC paging solution routes the paging to the right IPAC TPA400/MPA400/M400.

RetailPlayer is a multi-site, multi-channel streaming platform for background music distribution and messages scheduling playback. RetailPlayer is a Cloud-managed system, the perfect solution when there are multiple devices installed in different geographical locations, configured, controlled and supervised from a central Web App.

With RetailPlayer you can control centrally (or locally via a Web App) the single player, select the channel (Internet Radio), trigger audio files, schedule the channels and the file to be played, schedule power on/off and volume level.

In this application it's used the new RTP Forwarding function that offers the possibility to forward the audio played (main audio output) to a destination address using RTP. The audio format used is Linear PCM 16bit Big Endian Stereo 44.1kHz (RTP static payload type 10).

Here the manual:

https://help.barix.com/retailplayer/User-Manual-RetailPlayer.14324272147.html

Barionet 400 is a fully programmable I/O device server, based on Linux/Lede/OpenWRT. The device features a wide range of interfaces such as USB, digital Inputs, Relays. It is IPv4 or IPv6 capable. Supporting multiple communication protocols, the Barionet can be used in multiple applications such as automation building control, public transport and many more.

In this application it runs a tailored LUA program that sends UDP commands to IPAC to play the local audio files when the four input contacts are shorted to ground.

Here the Quik Install Guide:

https://help.barix.com/barionet/Barionet-400---Quick-Install-Guide-V-2.16.7382059959.html

IP Audio Client Configuration

Here the IPAC-M400 sources configuration.

M400 is configured with IC Paging Station ID17, MPA400 with Station ID18, and the two PA400 with Station ID19 and 20.

The SIP extensions (User Name) are 251, 252, 253, 254 respectively on M400, MPA400 and TPA400.

Here the configuration of audio files triggered by Barionet 400.

They are triggered with UDP commands sent on port 8000 (e.g. FILEPLAY=7.mp3\n).

PS Touch Configuration

Here the PS Touch configuration.

Paging Gateway Configuration

Here the Paging Gateway configuration.

Barionet 400 Configuration

On Barionet 400 is uploaded a tailored LUA program, configured as Custom App.

ipspeaker_1.lua sends UDP commands to IPAC to play the local audio files when the four input contacts are shorted to ground.

Here the configuration and the ipspeaker_1.lua code.

CODE
local socket = require "socket"											--dependencies
local udp = socket.udp()


-- The UDP Sender function is used to send the UDP command to a specific IP and Port - Insert the right IP and Port to the corresponding variables - Add the command to be sent via UDP to the udp_command variable
    ipspkr_ip = "192.168.50.51" 										-- Define Destination IP
    ipspkr_udp_port = 8000      										-- Define destionation Port 


function UDP_sender_file1()
    local socket = require "socket"											--dependencies
    local udp = socket.udp()

    udp_command = "FILEPLAY=6.mp3\n"   							-- Define the string to be sent, the actual command

    udp:setoption('reuseaddr',true)
    udp:setsockname('*', 0)
    udp:setpeername(ipspkr_ip, ipspkr_udp_port)
    udp:send(udp_command)
    print(" UDP Command: "..udp_command.."was Sent at: "..os.date("%c").." UTC".." to this Socket: "..ipspkr_ip..":"..ipspkr_udp_port);
end

function UDP_sender_file2()
    local socket = require "socket"											--dependencies
    local udp = socket.udp()
    
    udp_command = "FILEPLAY=7.mp3\n"   							-- Define the string to be sent, the actual command

    udp:setoption('reuseaddr',true)
    udp:setsockname('*', 0)
    udp:setpeername(ipspkr_ip, ipspkr_udp_port)
    udp:send(udp_command)
    print(" UDP Command: "..udp_command.."was Sent at: "..os.date("%c").." UTC".." to this Socket: "..ipspkr_ip..":"..ipspkr_udp_port);
end

function UDP_sender_file3()
	local socket = require "socket"
	local udp = socket.udp()

    udp_command = "FILEPLAY=8.mp3\n"   							-- Define the string to be sent, the actual command

    udp:setoption('reuseaddr',true)
    udp:setsockname('*', 0)
    udp:setpeername(ipspkr_ip, ipspkr_udp_port)
    udp:send(udp_command)
    print(" UDP Command: "..udp_command.."was Sent at: "..os.date("%c").." UTC".." to this Socket: "..ipspkr_ip..":"..ipspkr_udp_port);
end

function UDP_sender_file4()
    local socket = require "socket"											--dependencies
    local udp = socket.udp()

    udp_command = "FILEPLAY=9.mp3\n"   							-- Define the string to be sent, the actual command

    udp:setoption('reuseaddr',true)
    udp:setsockname('*', 0)
    udp:setpeername(ipspkr_ip, ipspkr_udp_port)
    udp:send(udp_command)
    print(" UDP Command: "..udp_command.."was Sent at: "..os.date("%c").." UTC".." to this Socket: "..ipspkr_ip..":"..ipspkr_udp_port);
end
                                                                                                                                                     
                                                           
-- Sleep function to temporize the iteratrion in the app function (see below)
function sleep(sec)
    socket.sleep(sec)
end


-- my main application: a loop that keeps the digital input 1 of barionet is monitored and if value is 1 it calls the UDP sender function
-- This function can be re used to read changes in specific files of the system, just use the correct path

function app()
	while true do
	local file = io.open('/dev/gpio/in1/value','r') 						-- Change the patch according to where the change must be read. In this example the gpio value of Digital Input 1 is monitored. 
	local in1 = file:read('*n')
	local file = io.open('/dev/gpio/in2/value','r') 						-- Change the patch according to where the change must be read. In this example the gpio value of Digital Input 1 is monitored. 
	local in2 = file:read('*n')
	local file = io.open('/dev/gpio/in3/value','r') 						-- Change the patch according to where the change must be read. In this example the gpio value of Digital Input 1 is monitored. 
	local in3 = file:read('*n')
	local file = io.open('/dev/gpio/in4/value','r') 						-- Change the patch according to where the change must be read. In this example the gpio value of Digital Input 1 is monitored. 
	local in4 = file:read('*n')

	    if in1 == 1 then UDP_sender_file1()
        sleep(5)
        elseif in2 == 1 then UDP_sender_file2()
        sleep(5)	    
        elseif in3 == 1 then UDP_sender_file3()
        sleep(5)
	    elseif in4 == 1 then UDP_sender_file4()
        sleep(5)
        end
	sleep(1) 
	end
end

-- Call the app function to run the application
app()

Note about SIP Server configuration

Registering the IPAC on a SIP Server it’s trivial, just put the credentials.

Then you can call the IPAC with a simple call or, if present, through the Paging/Intercom function.

See here about Intercom Paging module in FreePBX:

https://wiki.freepbx.org/display/FPG/Paging+and+Intercom+User+Guide#PagingandIntercomUserGuide-rtp-multicastRTPMulticast

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.