#!/bin/bash

# Example of relay between Sonobus groups.
# Joins relay_src_group as relay_src_nick
# Repeats relay_src_target
# as relay_dest_nick on relay_dest_group.

relay_src_group=group1
relay_src_nick=nick1
relay_src_target=target
relay_dest_group=group2
relay_dest_nick=nick2
relay_channels=2
# relay_bitrate should match bitrate of relay_src_target.
relay_bitrate=48

# Allow override of target and channels from the command line.
if [ "$1" != '' ]
then
relay_src_target="$1"
fi
if [ "$2" != '' ]
then
relay_channels="$2"
fi

sb-rec -c $relay_channels -n $relay_src_nick \
-N $relay_src_target -g $relay_src_group -r \
|sb-send -e -R 1 -b $relay_bitrate -c $relay_channels -a - \
-g $relay_dest_group -n $relay_dest_nick
